Lines Matching refs:Constant
71 static Constant *foldConstVectorToAPInt(APInt &Result, Type *DestTy, in foldConstVectorToAPInt()
72 Constant *C, Type *SrcEltTy, in foldConstVectorToAPInt()
79 Constant *Element; in foldConstVectorToAPInt()
104 Constant *FoldBitCast(Constant *C, Type *DestTy, const DataLayout &DL) { in FoldBitCast()
109 if (Constant *Res = ConstantFoldLoadFromUniformValue(C, DestTy)) in FoldBitCast()
129 if (Constant *CE = foldConstVectorToAPInt(Result, DestTy, C, in FoldBitCast()
149 Constant *Ops = C; // don't take the address of C! in FoldBitCast()
208 SmallVector<Constant*, 32> Result; in FoldBitCast()
211 Constant *Zero = Constant::getNullValue(DstEltTy); in FoldBitCast()
217 Constant *Elt = Zero; in FoldBitCast()
220 Constant *Src = C->getAggregateElement(SrcElt++); in FoldBitCast()
222 Src = Constant::getNullValue( in FoldBitCast()
270 Constant *Elt = ConstantExpr::getLShr(Src, in FoldBitCast()
278 Constant *CE = ConstantExpr::getTrunc(Elt, DstIntTy); in FoldBitCast()
295 bool llvm::IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV, in IsConstantOffsetFromGlobal()
348 Constant *llvm::ConstantFoldLoadThroughBitcast(Constant *C, Type *DestTy, in ConstantFoldLoadThroughBitcast()
362 if (Constant *Res = ConstantFoldLoadFromUniformValue(C, DestTy)) in ConstantFoldLoadThroughBitcast()
396 Constant *ElemC; in ConstantFoldLoadThroughBitcast()
421 bool ReadDataFromGlobal(Constant *C, uint64_t ByteOffset, unsigned char *CurPtr, in ReadDataFromGlobal()
546 Constant *FoldReinterpretLoadFromConst(Constant *C, Type *LoadTy, in FoldReinterpretLoadFromConst()
566 if (Constant *Res = FoldReinterpretLoadFromConst(C, MapTy, Offset, DL)) { in FoldReinterpretLoadFromConst()
570 return Constant::getNullValue(LoadTy); in FoldReinterpretLoadFromConst()
577 return Constant::getNullValue(LoadTy); in FoldReinterpretLoadFromConst()
642 Constant *llvm::ReadByteArrayFromGlobal(const GlobalVariable *GV, in ReadByteArrayFromGlobal()
648 Constant *Init = const_cast<Constant *>(GV->getInitializer()); in ReadByteArrayFromGlobal()
672 Constant *getConstantAtOffset(Constant *Base, APInt Offset, in getConstantAtOffset()
685 Constant *C = Base; in getConstantAtOffset()
698 Constant *llvm::ConstantFoldLoadFromConst(Constant *C, Type *Ty, in ConstantFoldLoadFromConst()
701 if (Constant *AtOffset = getConstantAtOffset(C, Offset, DL)) in ConstantFoldLoadFromConst()
702 if (Constant *Result = ConstantFoldLoadThroughBitcast(AtOffset, Ty, DL)) in ConstantFoldLoadFromConst()
712 if (Constant *Result = ConstantFoldLoadFromUniformValue(C, Ty)) in ConstantFoldLoadFromConst()
717 if (Constant *Result = in ConstantFoldLoadFromConst()
724 Constant *llvm::ConstantFoldLoadFromConst(Constant *C, Type *Ty, in ConstantFoldLoadFromConst()
729 Constant *llvm::ConstantFoldLoadFromConstPtr(Constant *C, Type *Ty, in ConstantFoldLoadFromConstPtr()
732 C = cast<Constant>(C->stripAndAccumulateConstantOffsets( in ConstantFoldLoadFromConstPtr()
737 if (Constant *Result = ConstantFoldLoadFromConst(GV->getInitializer(), Ty, in ConstantFoldLoadFromConstPtr()
745 if (Constant *Res = in ConstantFoldLoadFromConstPtr()
754 Constant *llvm::ConstantFoldLoadFromConstPtr(Constant *C, Type *Ty, in ConstantFoldLoadFromConstPtr()
760 Constant *llvm::ConstantFoldLoadFromUniformValue(Constant *C, Type *Ty) { in ConstantFoldLoadFromUniformValue()
766 return Constant::getNullValue(Ty); in ConstantFoldLoadFromUniformValue()
769 return Constant::getAllOnesValue(Ty); in ConstantFoldLoadFromUniformValue()
779 Constant *SymbolicallyEvaluateBinop(unsigned Opc, Constant *Op0, Constant *Op1, in SymbolicallyEvaluateBinop()
827 Constant *CastGEPIndices(Type *SrcElemTy, ArrayRef<Constant *> Ops, in CastGEPIndices()
834 SmallVector<Constant*, 32> NewIdxs; in CastGEPIndices()
856 Constant *C = ConstantExpr::getGetElementPtr( in CastGEPIndices()
862 Constant *StripPtrCastKeepAS(Constant *Ptr) { in StripPtrCastKeepAS()
865 Ptr = cast<Constant>(Ptr->stripPointerCasts()); in StripPtrCastKeepAS()
878 Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP, in SymbolicallyEvaluateGEP()
879 ArrayRef<Constant *> Ops, in SymbolicallyEvaluateGEP()
891 if (Constant *C = CastGEPIndices(SrcElemTy, Ops, ResTy, in SymbolicallyEvaluateGEP()
895 Constant *Ptr = Ops[0]; in SymbolicallyEvaluateGEP()
930 Ptr = cast<Constant>(GEP->getOperand(0)); in SymbolicallyEvaluateGEP()
949 Constant *C = ConstantInt::get(Ptr->getContext(), Offset + BasePtr); in SymbolicallyEvaluateGEP()
988 SmallVector<Constant *, 32> NewIdxs; in SymbolicallyEvaluateGEP()
1006 Constant *C = ConstantExpr::getGetElementPtr(SrcElemTy, Ptr, NewIdxs, in SymbolicallyEvaluateGEP()
1025 Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, unsigned Opcode, in ConstantFoldInstOperandsImpl()
1026 ArrayRef<Constant *> Ops, in ConstantFoldInstOperandsImpl()
1057 if (Constant *C = SymbolicallyEvaluateGEP(GEP, Ops, DL, TLI)) in ConstantFoldInstOperandsImpl()
1121 Constant *
1122 ConstantFoldConstantImpl(const Constant *C, const DataLayout &DL, in ConstantFoldConstantImpl()
1124 SmallDenseMap<Constant *, Constant *> &FoldedOps) { in ConstantFoldConstantImpl() argument
1126 return const_cast<Constant *>(C); in ConstantFoldConstantImpl()
1128 SmallVector<Constant *, 8> Ops; in ConstantFoldConstantImpl()
1130 Constant *OldC = cast<Constant>(&OldU); in ConstantFoldConstantImpl()
1131 Constant *NewC = OldC; in ConstantFoldConstantImpl()
1147 if (Constant *Res = in ConstantFoldConstantImpl()
1150 return const_cast<Constant *>(C); in ConstantFoldConstantImpl()
1159 Constant *llvm::ConstantFoldInstruction(Instruction *I, const DataLayout &DL, in ConstantFoldInstruction()
1163 Constant *CommonValue = nullptr; in ConstantFoldInstruction()
1165 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldInstruction()
1174 auto *C = dyn_cast<Constant>(Incoming); in ConstantFoldInstruction()
1192 if (!all_of(I->operands(), [](Use &U) { return isa<Constant>(U); })) in ConstantFoldInstruction()
1195 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldInstruction()
1196 SmallVector<Constant *, 8> Ops; in ConstantFoldInstruction()
1198 auto *Op = cast<Constant>(&OpU); in ConstantFoldInstruction()
1207 Constant *llvm::ConstantFoldConstant(const Constant *C, const DataLayout &DL, in ConstantFoldConstant()
1209 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldConstant()
1213 Constant *llvm::ConstantFoldInstOperands(Instruction *I, in ConstantFoldInstOperands()
1214 ArrayRef<Constant *> Ops, in ConstantFoldInstOperands()
1220 Constant *llvm::ConstantFoldCompareInstOperands( in ConstantFoldCompareInstOperands()
1221 unsigned IntPredicate, Constant *Ops0, Constant *Ops1, const DataLayout &DL, in ConstantFoldCompareInstOperands()
1240 Constant *C = ConstantExpr::getIntegerCast(CE0->getOperand(0), in ConstantFoldCompareInstOperands()
1242 Constant *Null = Constant::getNullValue(C->getType()); in ConstantFoldCompareInstOperands()
1251 Constant *C = CE0->getOperand(0); in ConstantFoldCompareInstOperands()
1252 Constant *Null = Constant::getNullValue(C->getType()); in ConstantFoldCompareInstOperands()
1265 Constant *C0 = ConstantExpr::getIntegerCast(CE0->getOperand(0), in ConstantFoldCompareInstOperands()
1267 Constant *C1 = ConstantExpr::getIntegerCast(CE1->getOperand(0), in ConstantFoldCompareInstOperands()
1289 Constant *LHS = ConstantFoldCompareInstOperands( in ConstantFoldCompareInstOperands()
1291 Constant *RHS = ConstantFoldCompareInstOperands( in ConstantFoldCompareInstOperands()
1332 Constant *llvm::ConstantFoldUnaryOpOperand(unsigned Opcode, Constant *Op, in ConstantFoldUnaryOpOperand()
1339 Constant *llvm::ConstantFoldBinaryOpOperands(unsigned Opcode, Constant *LHS, in ConstantFoldBinaryOpOperands()
1340 Constant *RHS, in ConstantFoldBinaryOpOperands()
1344 if (Constant *C = SymbolicallyEvaluateBinop(Opcode, LHS, RHS, DL)) in ConstantFoldBinaryOpOperands()
1352 Constant *llvm::FlushFPConstant(Constant *Operand, const Instruction *I, in FlushFPConstant()
1390 Constant *llvm::ConstantFoldFPInstOperands(unsigned Opcode, Constant *LHS, in ConstantFoldFPInstOperands()
1391 Constant *RHS, const DataLayout &DL, in ConstantFoldFPInstOperands()
1395 Constant *Op0 = FlushFPConstant(LHS, I, /* IsOutput */ false); in ConstantFoldFPInstOperands()
1396 Constant *Op1 = FlushFPConstant(RHS, I, /* IsOutput */ false); in ConstantFoldFPInstOperands()
1399 Constant *C = ConstantFoldBinaryOpOperands(Opcode, Op0, Op1, DL); in ConstantFoldFPInstOperands()
1411 Constant *llvm::ConstantFoldCastOperand(unsigned Opcode, Constant *C, in ConstantFoldCastOperand()
1419 Constant *FoldedValue = nullptr; in ConstantFoldCastOperand()
1433 auto *Base = cast<Constant>(GEP->stripAndAccumulateConstantOffsets( in ConstantFoldCastOperand()
1441 auto *Ptr = cast<Constant>(GEP->getPointerOperand()); in ConstantFoldCastOperand()
1466 Constant *SrcPtr = CE->getOperand(0); in ConstantFoldCastOperand()
1733 Constant *GetConstantFoldFPValue(double V, Type *Ty) { in GetConstantFoldFPValue()
1765 Constant *ConstantFoldFP(double (*NativeFP)(double), const APFloat &V, in ConstantFoldFP()
1777 Constant *ConstantFoldBinaryFP(double (*NativeFP)(double, double), in ConstantFoldBinaryFP()
1789 Constant *constantFoldVectorReduce(Intrinsic::ID IID, Constant *Op) { in constantFoldVectorReduce()
1857 Constant *ConstantFoldSSEConvertToInt(const APFloat &Val, bool roundTowardZero, in ConstantFoldSSEConvertToInt()
1944 static Constant *ConstantFoldScalarCall1(StringRef Name, in ConstantFoldScalarCall1()
1947 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall1()
1968 return Constant::getNullValue(Ty); in ConstantFoldScalarCall1()
2384 if (Constant *C = constantFoldVectorReduce(IntrinsicID, Operands[0])) in ConstantFoldScalarCall1()
2392 auto *Op = cast<Constant>(Operands[0]); in ConstantFoldScalarCall1()
2421 static Constant *evaluateCompare(const APFloat &Op1, const APFloat &Op2, in evaluateCompare()
2439 static Constant *ConstantFoldScalarCall2(StringRef Name, in ConstantFoldScalarCall2()
2442 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall2()
2643 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2652 {Constant::getAllOnesValue(Ty->getStructElementType(0)), in ConstantFoldScalarCall2()
2653 Constant::getNullValue(Ty->getStructElementType(1))}); in ConstantFoldScalarCall2()
2661 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2686 Constant *Ops[] = { in ConstantFoldScalarCall2()
2702 return Constant::getAllOnesValue(Ty); in ConstantFoldScalarCall2()
2717 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2730 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2746 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2761 auto *Op = cast<Constant>(Operands[0]); in ConstantFoldScalarCall2()
2864 static Constant *ConstantFoldAMDGCNPermIntrinsic(ArrayRef<Constant *> Operands, in ConstantFoldAMDGCNPermIntrinsic()
2904 static Constant *ConstantFoldScalarCall3(StringRef Name, in ConstantFoldScalarCall3()
2907 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall3()
2982 return Constant::getNullValue(Ty); in ConstantFoldScalarCall3()
3041 static Constant *ConstantFoldScalarCall(StringRef Name, in ConstantFoldScalarCall()
3044 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall()
3059 static Constant *ConstantFoldFixedVectorCall( in ConstantFoldFixedVectorCall()
3061 ArrayRef<Constant *> Operands, const DataLayout &DL, in ConstantFoldFixedVectorCall()
3063 SmallVector<Constant *, 4> Result(FVTy->getNumElements()); in ConstantFoldFixedVectorCall()
3064 SmallVector<Constant *, 4> Lane(Operands.size()); in ConstantFoldFixedVectorCall()
3073 Constant *VecData = ConstantFoldLoadFromConstPtr(SrcPtr, FVTy, DL); in ConstantFoldFixedVectorCall()
3075 SmallVector<Constant *, 32> NewElements; in ConstantFoldFixedVectorCall()
3114 SmallVector<Constant *, 16> NCs; in ConstantFoldFixedVectorCall()
3133 SmallVector<Constant *, 16> NCs; in ConstantFoldFixedVectorCall()
3157 Constant *Agg = Operands[J]->getAggregateElement(I); in ConstantFoldFixedVectorCall()
3165 Constant *Folded = in ConstantFoldFixedVectorCall()
3175 static Constant *ConstantFoldScalableVectorCall( in ConstantFoldScalableVectorCall()
3177 ArrayRef<Constant *> Operands, const DataLayout &DL, in ConstantFoldScalableVectorCall()
3181 auto *Src = dyn_cast<Constant>(Operands[0]); in ConstantFoldScalableVectorCall()
3195 Constant *llvm::ConstantFoldCall(const CallBase *Call, Function *F, in ConstantFoldCall()
3196 ArrayRef<Constant *> Operands, in ConstantFoldCall()