Lines Matching refs:Constant

43 static Constant *BitCastConstantVector(Constant *CV, VectorType *DstTy) {  in BitCastConstantVector()
45 if (CV->isAllOnesValue()) return Constant::getAllOnesValue(DstTy); in BitCastConstantVector()
46 if (CV->isNullValue()) return Constant::getNullValue(DstTy); in BitCastConstantVector()
62 if (Constant *Splat = CV->getSplatValue()) { in BitCastConstantVector()
67 SmallVector<Constant*, 16> Result; in BitCastConstantVector()
70 Constant *C = in BitCastConstantVector()
109 static Constant *FoldBitCast(Constant *V, Type *DestTy) { in FoldBitCast()
123 Constant::getNullValue(Type::getInt32Ty(DPTy->getContext())); in FoldBitCast()
147 return Constant::getNullValue(DestTy); in FoldBitCast()
213 static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart, in ExtractConstantBytes()
240 Constant *RHS = ExtractConstantBytes(CE->getOperand(1), ByteStart,ByteSize); in ExtractConstantBytes()
249 Constant *LHS = ExtractConstantBytes(CE->getOperand(0), ByteStart,ByteSize); in ExtractConstantBytes()
255 Constant *RHS = ExtractConstantBytes(CE->getOperand(1), ByteStart,ByteSize); in ExtractConstantBytes()
263 Constant *LHS = ExtractConstantBytes(CE->getOperand(0), ByteStart,ByteSize); in ExtractConstantBytes()
280 return Constant::getNullValue( in ExtractConstantBytes()
303 return Constant::getNullValue( in ExtractConstantBytes()
320 return Constant::getNullValue(IntegerType::get(CE->getContext(), in ExtractConstantBytes()
336 Constant *Res = CE->getOperand(0); in ExtractConstantBytes()
350 Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V, in ConstantFoldCastInstruction()
361 return Constant::getNullValue(DestTy); in ConstantFoldCastInstruction()
367 return Constant::getNullValue(DestTy); in ConstantFoldCastInstruction()
411 if (Constant *Splat = V->getSplatValue()) { in ConstantFoldCastInstruction()
416 SmallVector<Constant *, 16> res; in ConstantFoldCastInstruction()
421 Constant *C = in ConstantFoldCastInstruction()
509 if (Constant *Res = ExtractConstantBytes(V, 0, DestBitWidth / 8)) in ConstantFoldCastInstruction()
521 Constant *llvm::ConstantFoldSelectInstruction(Constant *Cond, in ConstantFoldSelectInstruction()
522 Constant *V1, Constant *V2) { in ConstantFoldSelectInstruction()
530 SmallVector<Constant*, 16> Result; in ConstantFoldSelectInstruction()
533 Constant *V; in ConstantFoldSelectInstruction()
534 Constant *V1Element = ConstantExpr::getExtractElement(V1, in ConstantFoldSelectInstruction()
536 Constant *V2Element = ConstantExpr::getExtractElement(V2, in ConstantFoldSelectInstruction()
538 auto *Cond = cast<Constant>(CondV->getOperand(i)); in ConstantFoldSelectInstruction()
574 auto NotPoison = [](Constant *C) { in ConstantFoldSelectInstruction()
610 Constant *llvm::ConstantFoldExtractElementInstruction(Constant *Val, in ConstantFoldExtractElementInstruction()
611 Constant *Idx) { in ConstantFoldExtractElementInstruction()
636 SmallVector<Constant *, 8> Ops; in ConstantFoldExtractElementInstruction()
639 Constant *Op = CE->getOperand(i); in ConstantFoldExtractElementInstruction()
641 Constant *ScalarOp = ConstantExpr::getExtractElement(Op, Idx); in ConstantFoldExtractElementInstruction()
662 if (Constant *C = Val->getAggregateElement(CIdx)) in ConstantFoldExtractElementInstruction()
667 if (Constant *SplatVal = Val->getSplatValue()) in ConstantFoldExtractElementInstruction()
674 Constant *llvm::ConstantFoldInsertElementInstruction(Constant *Val, in ConstantFoldInsertElementInstruction()
675 Constant *Elt, in ConstantFoldInsertElementInstruction()
676 Constant *Idx) { in ConstantFoldInsertElementInstruction()
699 SmallVector<Constant*, 16> Result; in ConstantFoldInsertElementInstruction()
709 Constant *C = ConstantExpr::getExtractElement(Val, ConstantInt::get(Ty, i)); in ConstantFoldInsertElementInstruction()
716 Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2, in ConstantFoldShuffleVectorInstruction()
733 Constant *Elt = in ConstantFoldShuffleVectorInstruction()
750 SmallVector<Constant*, 32> Result; in ConstantFoldShuffleVectorInstruction()
757 Constant *InElt; in ConstantFoldShuffleVectorInstruction()
775 Constant *llvm::ConstantFoldExtractValueInstruction(Constant *Agg, in ConstantFoldExtractValueInstruction()
781 if (Constant *C = Agg->getAggregateElement(Idxs[0])) in ConstantFoldExtractValueInstruction()
787 Constant *llvm::ConstantFoldInsertValueInstruction(Constant *Agg, in ConstantFoldInsertValueInstruction()
788 Constant *Val, in ConstantFoldInsertValueInstruction()
800 SmallVector<Constant*, 32> Result; in ConstantFoldInsertValueInstruction()
802 Constant *C = Agg->getAggregateElement(i); in ConstantFoldInsertValueInstruction()
816 Constant *llvm::ConstantFoldUnaryInstruction(unsigned Opcode, Constant *C) { in ConstantFoldUnaryInstruction()
851 if (Constant *Splat = C->getSplatValue()) { in ConstantFoldUnaryInstruction()
852 Constant *Elt = ConstantExpr::get(Opcode, Splat); in ConstantFoldUnaryInstruction()
857 SmallVector<Constant *, 16> Result; in ConstantFoldUnaryInstruction()
859 Constant *ExtractIdx = ConstantInt::get(Ty, i); in ConstantFoldUnaryInstruction()
860 Constant *Elt = ConstantExpr::getExtractElement(C, ExtractIdx); in ConstantFoldUnaryInstruction()
872 Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1, in ConstantFoldBinaryInstruction()
873 Constant *C2) { in ConstantFoldBinaryInstruction()
881 Constant *Identity = ConstantExpr::getBinOpIdentity(Opcode, C1->getType()); in ConstantFoldBinaryInstruction()
905 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
913 return Constant::getNullValue(C1->getType()); // undef & X -> 0 in ConstantFoldBinaryInstruction()
925 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
937 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
945 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
949 return Constant::getAllOnesValue(C1->getType()); // undef | X -> ~0 in ConstantFoldBinaryInstruction()
958 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
968 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
977 return Constant::getNullValue(C1->getType()); in ConstantFoldBinaryInstruction()
1030 return Constant::getNullValue(CI2->getType()); // X % 1 == 0 in ConstantFoldBinaryInstruction()
1087 return Constant::getNullValue(CI2->getType()); in ConstantFoldBinaryInstruction()
1217 if (Constant *C2Splat = C2->getSplatValue()) { in ConstantFoldBinaryInstruction()
1220 if (Constant *C1Splat = C1->getSplatValue()) { in ConstantFoldBinaryInstruction()
1221 Constant *Res = in ConstantFoldBinaryInstruction()
1233 SmallVector<Constant*, 16> Result; in ConstantFoldBinaryInstruction()
1236 Constant *ExtractIdx = ConstantInt::get(Ty, i); in ConstantFoldBinaryInstruction()
1237 Constant *LHS = ConstantExpr::getExtractElement(C1, ExtractIdx); in ConstantFoldBinaryInstruction()
1238 Constant *RHS = ConstantExpr::getExtractElement(C2, ExtractIdx); in ConstantFoldBinaryInstruction()
1244 Constant *Res = ConstantExpr::isDesirableBinOp(Opcode) in ConstantFoldBinaryInstruction()
1264 Constant *T = ConstantExpr::get(Opcode, CE1->getOperand(1), C2); in ConstantFoldBinaryInstruction()
1319 static FCmpInst::Predicate evaluateFCmpRelation(Constant *V1, Constant *V2) { in evaluateFCmpRelation()
1408 static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2, in evaluateICmpRelation()
1500 Constant *CE1Op0 = CE1->getOperand(0); in evaluateICmpRelation()
1531 Constant::getNullValue(CE1Op0->getType()), in evaluateICmpRelation()
1560 const Constant *CE2Op0 = cast<Constant>(CE2GEP->getPointerOperand()); in evaluateICmpRelation()
1581 Constant *llvm::ConstantFoldCompareInstruction(CmpInst::Predicate Predicate, in ConstantFoldCompareInstruction()
1582 Constant *C1, Constant *C2) { in ConstantFoldCompareInstruction()
1592 return Constant::getNullValue(ResultTy); in ConstantFoldCompareInstruction()
1595 return Constant::getAllOnesValue(ResultTy); in ConstantFoldCompareInstruction()
1649 return Constant::getAllOnesValue(ResultTy); in ConstantFoldCompareInstruction()
1652 return Constant::getNullValue(ResultTy); in ConstantFoldCompareInstruction()
1680 if (Constant *C1Splat = C1->getSplatValue()) in ConstantFoldCompareInstruction()
1681 if (Constant *C2Splat = C2->getSplatValue()) in ConstantFoldCompareInstruction()
1693 SmallVector<Constant*, 4> ResElts; in ConstantFoldCompareInstruction()
1698 Constant *C1E = in ConstantFoldCompareInstruction()
1700 Constant *C2E = in ConstantFoldCompareInstruction()
1875 Constant *CE2Op0 = CE2->getOperand(0); in ConstantFoldCompareInstruction()
1879 Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType()); in ConstantFoldCompareInstruction()
1890 Constant *CE1Op0 = CE1->getOperand(0); in ConstantFoldCompareInstruction()
1891 Constant *CE1Inverse = ConstantExpr::getTrunc(CE1, CE1Op0->getType()); in ConstantFoldCompareInstruction()
1894 Constant *C2Inverse = ConstantExpr::getTrunc(C2, CE1Op0->getType()); in ConstantFoldCompareInstruction()
1921 if (cast<Constant>(Idxs[0])->isNullValue()) return true; in isInBoundsIndices()
1936 if (!cast<Constant>(Idxs[i])->isNullValue()) in isInBoundsIndices()
1961 static Constant *foldGEPOfGEP(GEPOperator *GEP, Type *PointeeTy, bool InBounds, in foldGEPOfGEP()
1966 Constant *Idx0 = cast<Constant>(Idxs[0]); in foldGEPOfGEP()
1974 GEP->getSourceElementType(), cast<Constant>(GEP->getPointerOperand()), in foldGEPOfGEP()
1993 auto *LastIdx = cast<Constant>(GEP->getOperand(GEP->getNumOperands()-1)); in foldGEPOfGEP()
2027 GEP->getSourceElementType(), cast<Constant>(GEP->getPointerOperand()), in foldGEPOfGEP()
2031 Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C, in ConstantFoldGetElementPtr()
2054 Constant *IdxC = cast<Constant>(Idx); in ConstantFoldGetElementPtr()
2067 if (!isa<UndefValue>(Idx) && !cast<Constant>(Idx)->isNullValue()) { in ConstantFoldGetElementPtr()
2093 return Constant::getNullValue(GEPTy); in ConstantFoldGetElementPtr()
2099 if (Constant *C = foldGEPOfGEP(GEP, PointeeTy, InBounds, Idxs)) in ConstantFoldGetElementPtr()
2111 Constant *Idx0 = cast<Constant>(Idxs[0]); in ConstantFoldGetElementPtr()
2126 (Constant *)CE->getOperand(0), in ConstantFoldGetElementPtr()
2135 SmallVector<Constant *, 8> NewIdxs; in ConstantFoldGetElementPtr()
2206 Constant *CurrIdx = cast<Constant>(Idxs[i]); in ConstantFoldGetElementPtr()
2208 NewIdxs[i - 1] ? NewIdxs[i - 1] : cast<Constant>(Idxs[i - 1]); in ConstantFoldGetElementPtr()
2221 Constant *Factor = in ConstantFoldGetElementPtr()
2233 Constant *Div = in ConstantFoldGetElementPtr()
2267 if (!NewIdxs[i]) NewIdxs[i] = cast<Constant>(Idxs[i]); in ConstantFoldGetElementPtr()