Lines Matching refs:Constant

70 static Constant *FoldBitCast(Constant *V, Type *DestTy) {  in FoldBitCast()
79 return Constant::getAllOnesValue(DestTy); in FoldBitCast()
132 static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart, in ExtractConstantBytes()
170 return Constant::getNullValue( in ExtractConstantBytes()
183 static Constant *foldMaybeUndesirableCast(unsigned opc, Constant *V, in foldMaybeUndesirableCast()
190 Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V, in ConstantFoldCastInstruction()
201 return Constant::getNullValue(DestTy); in ConstantFoldCastInstruction()
207 return Constant::getNullValue(DestTy); in ConstantFoldCastInstruction()
229 if (Constant *Splat = V->getSplatValue()) { in ConstantFoldCastInstruction()
230 Constant *Res = foldMaybeUndesirableCast(opc, Splat, DstEltTy); in ConstantFoldCastInstruction()
236 SmallVector<Constant *, 16> res; in ConstantFoldCastInstruction()
241 Constant *C = ConstantExpr::getExtractElement(V, ConstantInt::get(Ty, i)); in ConstantFoldCastInstruction()
242 Constant *Casted = foldMaybeUndesirableCast(opc, C, DstEltTy); in ConstantFoldCastInstruction()
321 if (Constant *Res = ExtractConstantBytes(V, 0, DestBitWidth / 8)) in ConstantFoldCastInstruction()
335 Constant *llvm::ConstantFoldSelectInstruction(Constant *Cond, in ConstantFoldSelectInstruction()
336 Constant *V1, Constant *V2) { in ConstantFoldSelectInstruction()
344 SmallVector<Constant*, 16> Result; in ConstantFoldSelectInstruction()
347 Constant *V; in ConstantFoldSelectInstruction()
348 Constant *V1Element = ConstantExpr::getExtractElement(V1, in ConstantFoldSelectInstruction()
350 Constant *V2Element = ConstantExpr::getExtractElement(V2, in ConstantFoldSelectInstruction()
352 auto *Cond = cast<Constant>(CondV->getOperand(i)); in ConstantFoldSelectInstruction()
388 auto NotPoison = [](Constant *C) { in ConstantFoldSelectInstruction()
413 Constant *llvm::ConstantFoldExtractElementInstruction(Constant *Val, in ConstantFoldExtractElementInstruction()
414 Constant *Idx) { in ConstantFoldExtractElementInstruction()
439 SmallVector<Constant *, 8> Ops; in ConstantFoldExtractElementInstruction()
442 Constant *Op = CE->getOperand(i); in ConstantFoldExtractElementInstruction()
444 Constant *ScalarOp = ConstantExpr::getExtractElement(Op, Idx); in ConstantFoldExtractElementInstruction()
465 if (Constant *C = Val->getAggregateElement(CIdx)) in ConstantFoldExtractElementInstruction()
470 if (Constant *SplatVal = Val->getSplatValue()) in ConstantFoldExtractElementInstruction()
477 Constant *llvm::ConstantFoldInsertElementInstruction(Constant *Val, in ConstantFoldInsertElementInstruction()
478 Constant *Elt, in ConstantFoldInsertElementInstruction()
479 Constant *Idx) { in ConstantFoldInsertElementInstruction()
502 SmallVector<Constant*, 16> Result; in ConstantFoldInsertElementInstruction()
512 Constant *C = ConstantExpr::getExtractElement(Val, ConstantInt::get(Ty, i)); in ConstantFoldInsertElementInstruction()
519 Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2, in ConstantFoldShuffleVectorInstruction()
536 Constant *Elt = in ConstantFoldShuffleVectorInstruction()
553 SmallVector<Constant*, 32> Result; in ConstantFoldShuffleVectorInstruction()
560 Constant *InElt; in ConstantFoldShuffleVectorInstruction()
578 Constant *llvm::ConstantFoldExtractValueInstruction(Constant *Agg, in ConstantFoldExtractValueInstruction()
584 if (Constant *C = Agg->getAggregateElement(Idxs[0])) in ConstantFoldExtractValueInstruction()
590 Constant *llvm::ConstantFoldInsertValueInstruction(Constant *Agg, in ConstantFoldInsertValueInstruction()
591 Constant *Val, in ConstantFoldInsertValueInstruction()
603 SmallVector<Constant*, 32> Result; in ConstantFoldInsertValueInstruction()
605 Constant *C = Agg->getAggregateElement(i); in ConstantFoldInsertValueInstruction()
619 Constant *llvm::ConstantFoldUnaryInstruction(unsigned Opcode, Constant *C) { in ConstantFoldUnaryInstruction()
654 if (Constant *Splat = C->getSplatValue()) in ConstantFoldUnaryInstruction()
655 if (Constant *Elt = ConstantFoldUnaryInstruction(Opcode, Splat)) in ConstantFoldUnaryInstruction()
659 SmallVector<Constant *, 16> Result; in ConstantFoldUnaryInstruction()
661 Constant *ExtractIdx = ConstantInt::get(Ty, i); in ConstantFoldUnaryInstruction()
662 Constant *Elt = ConstantExpr::getExtractElement(C, ExtractIdx); in ConstantFoldUnaryInstruction()
663 Constant *Res = ConstantFoldUnaryInstruction(Opcode, Elt); in ConstantFoldUnaryInstruction()
676 Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1, in ConstantFoldBinaryInstruction()
677 Constant *C2) { in ConstantFoldBinaryInstruction()
682 if (Constant *Identity = ConstantExpr::getBinOpIdentity( in ConstantFoldBinaryInstruction()
688 } else if (Constant *Identity = ConstantExpr::getBinOpIdentity( in ConstantFoldBinaryInstruction()
710 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
718 return Constant::getNullValue(C1->getType()); // undef & X -> 0 in ConstantFoldBinaryInstruction()
730 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
739 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
747 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
751 return Constant::getAllOnesValue(C1->getType()); // undef | X -> ~0 in ConstantFoldBinaryInstruction()
757 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
764 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
770 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
814 return Constant::getNullValue(CI2->getType()); // X % 1 == 0 in ConstantFoldBinaryInstruction()
856 return Constant::getNullValue(CI2->getType()); in ConstantFoldBinaryInstruction()
980 if (Constant *C2Splat = C2->getSplatValue()) { in ConstantFoldBinaryInstruction()
983 if (Constant *C1Splat = C1->getSplatValue()) { in ConstantFoldBinaryInstruction()
984 Constant *Res = in ConstantFoldBinaryInstruction()
996 SmallVector<Constant*, 16> Result; in ConstantFoldBinaryInstruction()
999 Constant *ExtractIdx = ConstantInt::get(Ty, i); in ConstantFoldBinaryInstruction()
1000 Constant *LHS = ConstantExpr::getExtractElement(C1, ExtractIdx); in ConstantFoldBinaryInstruction()
1001 Constant *RHS = ConstantExpr::getExtractElement(C2, ExtractIdx); in ConstantFoldBinaryInstruction()
1007 Constant *Res = ConstantExpr::isDesirableBinOp(Opcode) in ConstantFoldBinaryInstruction()
1027 Constant *T = ConstantExpr::get(Opcode, CE1->getOperand(1), C2); in ConstantFoldBinaryInstruction()
1099 static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2) { in evaluateICmpRelation()
1112 auto GetComplexity = [](Constant *V) { in evaluateICmpRelation()
1161 Constant *CE1Op0 = CE1->getOperand(0); in evaluateICmpRelation()
1188 const Constant *CE2Op0 = cast<Constant>(CE2GEP->getPointerOperand()); in evaluateICmpRelation()
1209 Constant *llvm::ConstantFoldCompareInstruction(CmpInst::Predicate Predicate, in ConstantFoldCompareInstruction()
1210 Constant *C1, Constant *C2) { in ConstantFoldCompareInstruction()
1220 return Constant::getNullValue(ResultTy); in ConstantFoldCompareInstruction()
1223 return Constant::getAllOnesValue(ResultTy); in ConstantFoldCompareInstruction()
1252 return Constant::getAllOnesValue(ResultTy); in ConstantFoldCompareInstruction()
1255 return Constant::getNullValue(ResultTy); in ConstantFoldCompareInstruction()
1283 if (Constant *C1Splat = C1->getSplatValue()) in ConstantFoldCompareInstruction()
1284 if (Constant *C2Splat = C2->getSplatValue()) in ConstantFoldCompareInstruction()
1296 SmallVector<Constant*, 4> ResElts; in ConstantFoldCompareInstruction()
1301 Constant *C1E = in ConstantFoldCompareInstruction()
1303 Constant *C2E = in ConstantFoldCompareInstruction()
1427 if (cast<Constant>(Idxs[0])->isNullValue()) return true; in isInBoundsIndices()
1442 if (!cast<Constant>(Idxs[i])->isNullValue()) in isInBoundsIndices()
1467 static Constant *foldGEPOfGEP(GEPOperator *GEP, Type *PointeeTy, bool InBounds, in foldGEPOfGEP()
1472 Constant *Idx0 = cast<Constant>(Idxs[0]); in foldGEPOfGEP()
1480 GEP->getSourceElementType(), cast<Constant>(GEP->getPointerOperand()), in foldGEPOfGEP()
1499 auto *LastIdx = cast<Constant>(GEP->getOperand(GEP->getNumOperands()-1)); in foldGEPOfGEP()
1538 GEP->getSourceElementType(), cast<Constant>(GEP->getPointerOperand()), in foldGEPOfGEP()
1542 Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C, in ConstantFoldGetElementPtr()
1564 Constant *IdxC = cast<Constant>(Idx); in ConstantFoldGetElementPtr()
1576 if (Constant *C = foldGEPOfGEP(GEP, PointeeTy, InBounds, Idxs)) in ConstantFoldGetElementPtr()
1582 SmallVector<Constant *, 8> NewIdxs; in ConstantFoldGetElementPtr()
1659 Constant *CurrIdx = cast<Constant>(Idxs[i]); in ConstantFoldGetElementPtr()
1661 NewIdxs[i - 1] ? NewIdxs[i - 1] : cast<Constant>(Idxs[i - 1]); in ConstantFoldGetElementPtr()
1674 Constant *Factor = in ConstantFoldGetElementPtr()
1686 Constant *Div = in ConstantFoldGetElementPtr()
1722 if (!NewIdxs[i]) NewIdxs[i] = cast<Constant>(Idxs[i]); in ConstantFoldGetElementPtr()