Lines Matching refs:Constant
66 Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP,
67 ArrayRef<Constant *> Ops,
76 static Constant *foldConstVectorToAPInt(APInt &Result, Type *DestTy, in foldConstVectorToAPInt()
77 Constant *C, Type *SrcEltTy, in foldConstVectorToAPInt()
84 Constant *Element; in foldConstVectorToAPInt()
109 Constant *FoldBitCast(Constant *C, Type *DestTy, const DataLayout &DL) { in FoldBitCast()
115 return Constant::getNullValue(DestTy); in FoldBitCast()
118 return Constant::getAllOnesValue(DestTy); in FoldBitCast()
137 if (Constant *CE = foldConstVectorToAPInt(Result, DestTy, C, in FoldBitCast()
157 Constant *Ops = C; // don't take the address of C! in FoldBitCast()
216 SmallVector<Constant*, 32> Result; in FoldBitCast()
219 Constant *Zero = Constant::getNullValue(DstEltTy); in FoldBitCast()
225 Constant *Elt = Zero; in FoldBitCast()
228 Constant *Src = C->getAggregateElement(SrcElt++); in FoldBitCast()
230 Src = Constant::getNullValue( in FoldBitCast()
278 Constant *Elt = ConstantExpr::getLShr(Src, in FoldBitCast()
286 Constant *CE = ConstantExpr::getTrunc(Elt, DstIntTy); in FoldBitCast()
303 bool llvm::IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV, in IsConstantOffsetFromGlobal()
356 Constant *llvm::ConstantFoldLoadThroughBitcast(Constant *C, Type *DestTy, in ConstantFoldLoadThroughBitcast()
368 return Constant::getNullValue(DestTy); in ConstantFoldLoadThroughBitcast()
376 return Constant::getAllOnesValue(DestTy); in ConstantFoldLoadThroughBitcast()
409 Constant *ElemC; in ConstantFoldLoadThroughBitcast()
428 bool ReadDataFromGlobal(Constant *C, uint64_t ByteOffset, unsigned char *CurPtr, in ReadDataFromGlobal()
553 Constant *FoldReinterpretLoadFromConstPtr(Constant *C, Type *LoadTy, in FoldReinterpretLoadFromConstPtr()
584 if (Constant *Res = FoldReinterpretLoadFromConstPtr(C, MapTy, DL)) { in FoldReinterpretLoadFromConstPtr()
588 return Constant::getNullValue(LoadTy); in FoldReinterpretLoadFromConstPtr()
595 return Constant::getNullValue(LoadTy); in FoldReinterpretLoadFromConstPtr()
664 Constant *ConstantFoldLoadThroughBitcastExpr(ConstantExpr *CE, Type *DestTy, in ConstantFoldLoadThroughBitcastExpr()
675 Constant *llvm::ConstantFoldLoadFromConstPtr(Constant *C, Type *Ty, in ConstantFoldLoadFromConstPtr()
694 if (Constant *V = ConstantFoldLoadThroughGEPConstantExpr( in ConstantFoldLoadFromConstPtr()
703 SmallVector<Constant *> Ops; in ConstantFoldLoadFromConstPtr()
705 Ops.push_back(cast<Constant>(CE->getOperand(I))); in ConstantFoldLoadFromConstPtr()
716 if (Constant *V = ConstantFoldLoadThroughGEPConstantExpr( in ConstantFoldLoadFromConstPtr()
729 if (Constant *LoadedC = ConstantFoldLoadThroughBitcastExpr(CE, Ty, DL)) in ConstantFoldLoadFromConstPtr()
759 Constant *Res = ConstantInt::get(CE->getContext(), StrVal); in ConstantFoldLoadFromConstPtr()
771 return Constant::getNullValue(Ty); in ConstantFoldLoadFromConstPtr()
787 Constant *SymbolicallyEvaluateBinop(unsigned Opc, Constant *Op0, Constant *Op1, in SymbolicallyEvaluateBinop()
835 Constant *CastGEPIndices(Type *SrcElemTy, ArrayRef<Constant *> Ops, in CastGEPIndices()
842 SmallVector<Constant*, 32> NewIdxs; in CastGEPIndices()
864 Constant *C = ConstantExpr::getGetElementPtr( in CastGEPIndices()
870 Constant *StripPtrCastKeepAS(Constant *Ptr, bool ForLoadOperand) { in StripPtrCastKeepAS()
873 Ptr = cast<Constant>(Ptr->stripPointerCasts()); in StripPtrCastKeepAS()
893 Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP, in SymbolicallyEvaluateGEP()
894 ArrayRef<Constant *> Ops, in SymbolicallyEvaluateGEP()
907 if (Constant *C = CastGEPIndices(SrcElemTy, Ops, ResTy, in SymbolicallyEvaluateGEP()
911 Constant *Ptr = Ops[0]; in SymbolicallyEvaluateGEP()
925 Constant *Res = ConstantExpr::getPtrToInt(Ptr, CE->getType()); in SymbolicallyEvaluateGEP()
961 Ptr = cast<Constant>(GEP->getOperand(0)); in SymbolicallyEvaluateGEP()
980 Constant *C = ConstantInt::get(Ptr->getContext(), Offset + BasePtr); in SymbolicallyEvaluateGEP()
988 SmallVector<Constant *, 32> NewIdxs; in SymbolicallyEvaluateGEP()
1068 Constant *C = ConstantExpr::getGetElementPtr(SrcElemTy, Ptr, NewIdxs, in SymbolicallyEvaluateGEP()
1086 Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, unsigned Opcode, in ConstantFoldInstOperandsImpl()
1087 ArrayRef<Constant *> Ops, in ConstantFoldInstOperandsImpl()
1102 if (Constant *C = SymbolicallyEvaluateGEP(GEP, Ops, DL, TLI, in ConstantFoldInstOperandsImpl()
1150 Constant *
1151 ConstantFoldConstantImpl(const Constant *C, const DataLayout &DL, in ConstantFoldConstantImpl()
1153 SmallDenseMap<Constant *, Constant *> &FoldedOps) { in ConstantFoldConstantImpl() argument
1155 return const_cast<Constant *>(C); in ConstantFoldConstantImpl()
1157 SmallVector<Constant *, 8> Ops; in ConstantFoldConstantImpl()
1159 Constant *OldC = cast<Constant>(&OldU); in ConstantFoldConstantImpl()
1160 Constant *NewC = OldC; in ConstantFoldConstantImpl()
1189 Constant *llvm::ConstantFoldInstruction(Instruction *I, const DataLayout &DL, in ConstantFoldInstruction()
1193 Constant *CommonValue = nullptr; in ConstantFoldInstruction()
1195 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldInstruction()
1204 auto *C = dyn_cast<Constant>(Incoming); in ConstantFoldInstruction()
1222 if (!all_of(I->operands(), [](Use &U) { return isa<Constant>(U); })) in ConstantFoldInstruction()
1225 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldInstruction()
1226 SmallVector<Constant *, 8> Ops; in ConstantFoldInstruction()
1228 auto *Op = cast<Constant>(&OpU); in ConstantFoldInstruction()
1253 Constant *llvm::ConstantFoldConstant(const Constant *C, const DataLayout &DL, in ConstantFoldConstant()
1255 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldConstant()
1259 Constant *llvm::ConstantFoldInstOperands(Instruction *I, in ConstantFoldInstOperands()
1260 ArrayRef<Constant *> Ops, in ConstantFoldInstOperands()
1266 Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate, in ConstantFoldCompareInstOperands()
1267 Constant *Ops0, Constant *Ops1, in ConstantFoldCompareInstOperands()
1286 Constant *C = ConstantExpr::getIntegerCast(CE0->getOperand(0), in ConstantFoldCompareInstOperands()
1288 Constant *Null = Constant::getNullValue(C->getType()); in ConstantFoldCompareInstOperands()
1297 Constant *C = CE0->getOperand(0); in ConstantFoldCompareInstOperands()
1298 Constant *Null = Constant::getNullValue(C->getType()); in ConstantFoldCompareInstOperands()
1311 Constant *C0 = ConstantExpr::getIntegerCast(CE0->getOperand(0), in ConstantFoldCompareInstOperands()
1313 Constant *C1 = ConstantExpr::getIntegerCast(CE1->getOperand(0), in ConstantFoldCompareInstOperands()
1335 Constant *LHS = ConstantFoldCompareInstOperands( in ConstantFoldCompareInstOperands()
1337 Constant *RHS = ConstantFoldCompareInstOperands( in ConstantFoldCompareInstOperands()
1353 Constant *llvm::ConstantFoldUnaryOpOperand(unsigned Opcode, Constant *Op, in ConstantFoldUnaryOpOperand()
1360 Constant *llvm::ConstantFoldBinaryOpOperands(unsigned Opcode, Constant *LHS, in ConstantFoldBinaryOpOperands()
1361 Constant *RHS, in ConstantFoldBinaryOpOperands()
1365 if (Constant *C = SymbolicallyEvaluateBinop(Opcode, LHS, RHS, DL)) in ConstantFoldBinaryOpOperands()
1371 Constant *llvm::ConstantFoldCastOperand(unsigned Opcode, Constant *C, in ConstantFoldCastOperand()
1382 Constant *Input = CE->getOperand(0); in ConstantFoldCastOperand()
1386 Constant *Mask = in ConstantFoldCastOperand()
1403 Constant *SrcPtr = CE->getOperand(0); in ConstantFoldCastOperand()
1432 Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C, in ConstantFoldLoadThroughGEPConstantExpr()
1449 Constant *
1450 llvm::ConstantFoldLoadThroughGEPIndices(Constant *C, in ConstantFoldLoadThroughGEPIndices()
1451 ArrayRef<Constant *> Indices) { in ConstantFoldLoadThroughGEPIndices()
1454 for (Constant *Index : Indices) { in ConstantFoldLoadThroughGEPIndices()
1696 Constant *GetConstantFoldFPValue(double V, Type *Ty) { in GetConstantFoldFPValue()
1728 Constant *ConstantFoldFP(double (*NativeFP)(double), const APFloat &V, in ConstantFoldFP()
1740 Constant *ConstantFoldBinaryFP(double (*NativeFP)(double, double), in ConstantFoldBinaryFP()
1752 Constant *constantFoldVectorReduce(Intrinsic::ID IID, Constant *Op) { in constantFoldVectorReduce()
1820 Constant *ConstantFoldSSEConvertToInt(const APFloat &Val, bool roundTowardZero, in ConstantFoldSSEConvertToInt()
1914 static Constant *ConstantFoldScalarCall1(StringRef Name, in ConstantFoldScalarCall1()
1917 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall1()
1938 return Constant::getNullValue(Ty); in ConstantFoldScalarCall1()
2352 if (Constant *C = constantFoldVectorReduce(IntrinsicID, Operands[0])) in ConstantFoldScalarCall1()
2360 auto *Op = cast<Constant>(Operands[0]); in ConstantFoldScalarCall1()
2389 static Constant *ConstantFoldScalarCall2(StringRef Name, in ConstantFoldScalarCall2()
2392 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall2()
2600 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2609 {Constant::getAllOnesValue(Ty->getStructElementType(0)), in ConstantFoldScalarCall2()
2610 Constant::getNullValue(Ty->getStructElementType(1))}); in ConstantFoldScalarCall2()
2618 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2643 Constant *Ops[] = { in ConstantFoldScalarCall2()
2654 return Constant::getAllOnesValue(Ty); in ConstantFoldScalarCall2()
2664 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2677 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2691 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2706 auto *Op = cast<Constant>(Operands[0]); in ConstantFoldScalarCall2()
2809 static Constant *ConstantFoldAMDGCNPermIntrinsic(ArrayRef<Constant *> Operands, in ConstantFoldAMDGCNPermIntrinsic()
2849 static Constant *ConstantFoldScalarCall3(StringRef Name, in ConstantFoldScalarCall3()
2852 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall3()
2927 return Constant::getNullValue(Ty); in ConstantFoldScalarCall3()
2986 static Constant *ConstantFoldScalarCall(StringRef Name, in ConstantFoldScalarCall()
2989 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall()
3004 static Constant *ConstantFoldFixedVectorCall( in ConstantFoldFixedVectorCall()
3006 ArrayRef<Constant *> Operands, const DataLayout &DL, in ConstantFoldFixedVectorCall()
3008 SmallVector<Constant *, 4> Result(FVTy->getNumElements()); in ConstantFoldFixedVectorCall()
3009 SmallVector<Constant *, 4> Lane(Operands.size()); in ConstantFoldFixedVectorCall()
3018 Constant *VecData = ConstantFoldLoadFromConstPtr(SrcPtr, FVTy, DL); in ConstantFoldFixedVectorCall()
3020 SmallVector<Constant *, 32> NewElements; in ConstantFoldFixedVectorCall()
3063 SmallVector<Constant *, 16> NCs; in ConstantFoldFixedVectorCall()
3082 SmallVector<Constant *, 16> NCs; in ConstantFoldFixedVectorCall()
3106 Constant *Agg = Operands[J]->getAggregateElement(I); in ConstantFoldFixedVectorCall()
3114 Constant *Folded = in ConstantFoldFixedVectorCall()
3124 static Constant *ConstantFoldScalableVectorCall( in ConstantFoldScalableVectorCall()
3126 ArrayRef<Constant *> Operands, const DataLayout &DL, in ConstantFoldScalableVectorCall()
3130 auto *Src = dyn_cast<Constant>(Operands[0]); in ConstantFoldScalableVectorCall()
3144 Constant *llvm::ConstantFoldCall(const CallBase *Call, Function *F, in ConstantFoldCall()
3145 ArrayRef<Constant *> Operands, in ConstantFoldCall()