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, DL)) 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()
291 bool llvm::IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV, in IsConstantOffsetFromGlobal()
344 Constant *llvm::ConstantFoldLoadThroughBitcast(Constant *C, Type *DestTy, in ConstantFoldLoadThroughBitcast()
358 if (Constant *Res = ConstantFoldLoadFromUniformValue(C, DestTy, DL)) in ConstantFoldLoadThroughBitcast()
392 Constant *ElemC; in ConstantFoldLoadThroughBitcast()
417 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, DL)) 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()
738 C = cast<Constant>(C->stripAndAccumulateConstantOffsets( in ConstantFoldLoadFromConstPtr()
742 if (Constant *Result = ConstantFoldLoadFromConst(GV->getInitializer(), Ty, in ConstantFoldLoadFromConstPtr()
751 Constant *llvm::ConstantFoldLoadFromConstPtr(Constant *C, Type *Ty, in ConstantFoldLoadFromConstPtr()
757 Constant *llvm::ConstantFoldLoadFromUniformValue(Constant *C, Type *Ty, in ConstantFoldLoadFromUniformValue()
768 return Constant::getNullValue(Ty); in ConstantFoldLoadFromUniformValue()
771 return Constant::getAllOnesValue(Ty); in ConstantFoldLoadFromUniformValue()
781 Constant *SymbolicallyEvaluateBinop(unsigned Opc, Constant *Op0, Constant *Op1, in SymbolicallyEvaluateBinop()
829 Constant *CastGEPIndices(Type *SrcElemTy, ArrayRef<Constant *> Ops, in CastGEPIndices()
837 SmallVector<Constant*, 32> NewIdxs; in CastGEPIndices()
846 Constant *NewIdx = ConstantFoldCastOperand( in CastGEPIndices()
859 Constant *C = in CastGEPIndices()
865 Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP, in SymbolicallyEvaluateGEP()
866 ArrayRef<Constant *> Ops, in SymbolicallyEvaluateGEP()
874 if (Constant *C = CastGEPIndices(SrcElemTy, Ops, ResTy, GEP->getNoWrapFlags(), in SymbolicallyEvaluateGEP()
878 Constant *Ptr = Ops[0]; in SymbolicallyEvaluateGEP()
924 Ptr = cast<Constant>(GEP->getOperand(0)); in SymbolicallyEvaluateGEP()
949 Constant *C = ConstantInt::get(Ptr->getContext(), Offset + BasePtr); in SymbolicallyEvaluateGEP()
975 Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, unsigned Opcode, in ConstantFoldInstOperandsImpl()
976 ArrayRef<Constant *> Ops, in ConstantFoldInstOperandsImpl()
1013 if (Constant *C = SymbolicallyEvaluateGEP(GEP, Ops, DL, TLI)) in ConstantFoldInstOperandsImpl()
1074 Constant *
1075 ConstantFoldConstantImpl(const Constant *C, const DataLayout &DL, in ConstantFoldConstantImpl()
1077 SmallDenseMap<Constant *, Constant *> &FoldedOps) { in ConstantFoldConstantImpl() argument
1079 return const_cast<Constant *>(C); in ConstantFoldConstantImpl()
1081 SmallVector<Constant *, 8> Ops; in ConstantFoldConstantImpl()
1083 Constant *OldC = cast<Constant>(&OldU); in ConstantFoldConstantImpl()
1084 Constant *NewC = OldC; in ConstantFoldConstantImpl()
1100 if (Constant *Res = ConstantFoldInstOperandsImpl( in ConstantFoldConstantImpl()
1103 return const_cast<Constant *>(C); in ConstantFoldConstantImpl()
1112 Constant *llvm::ConstantFoldInstruction(Instruction *I, const DataLayout &DL, in ConstantFoldInstruction()
1116 Constant *CommonValue = nullptr; in ConstantFoldInstruction()
1118 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldInstruction()
1127 auto *C = dyn_cast<Constant>(Incoming); in ConstantFoldInstruction()
1145 if (!all_of(I->operands(), [](Use &U) { return isa<Constant>(U); })) in ConstantFoldInstruction()
1148 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldInstruction()
1149 SmallVector<Constant *, 8> Ops; in ConstantFoldInstruction()
1151 auto *Op = cast<Constant>(&OpU); in ConstantFoldInstruction()
1160 Constant *llvm::ConstantFoldConstant(const Constant *C, const DataLayout &DL, in ConstantFoldConstant()
1162 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldConstant()
1166 Constant *llvm::ConstantFoldInstOperands(Instruction *I, in ConstantFoldInstOperands()
1167 ArrayRef<Constant *> Ops, in ConstantFoldInstOperands()
1175 Constant *llvm::ConstantFoldCompareInstOperands( in ConstantFoldCompareInstOperands()
1176 unsigned IntPredicate, Constant *Ops0, Constant *Ops1, const DataLayout &DL, in ConstantFoldCompareInstOperands()
1195 if (Constant *C = ConstantFoldIntegerCast(CE0->getOperand(0), IntPtrTy, in ConstantFoldCompareInstOperands()
1197 Constant *Null = Constant::getNullValue(C->getType()); in ConstantFoldCompareInstOperands()
1207 Constant *C = CE0->getOperand(0); in ConstantFoldCompareInstOperands()
1208 Constant *Null = Constant::getNullValue(C->getType()); in ConstantFoldCompareInstOperands()
1221 Constant *C0 = ConstantFoldIntegerCast(CE0->getOperand(0), IntPtrTy, in ConstantFoldCompareInstOperands()
1223 Constant *C1 = ConstantFoldIntegerCast(CE1->getOperand(0), IntPtrTy, in ConstantFoldCompareInstOperands()
1280 Constant *llvm::ConstantFoldUnaryOpOperand(unsigned Opcode, Constant *Op, in ConstantFoldUnaryOpOperand()
1287 Constant *llvm::ConstantFoldBinaryOpOperands(unsigned Opcode, Constant *LHS, in ConstantFoldBinaryOpOperands()
1288 Constant *RHS, in ConstantFoldBinaryOpOperands()
1292 if (Constant *C = SymbolicallyEvaluateBinop(Opcode, LHS, RHS, DL)) in ConstantFoldBinaryOpOperands()
1300 Constant *llvm::FlushFPConstant(Constant *Operand, const Instruction *I, in FlushFPConstant()
1343 Constant *llvm::ConstantFoldFPInstOperands(unsigned Opcode, Constant *LHS, in ConstantFoldFPInstOperands()
1344 Constant *RHS, const DataLayout &DL, in ConstantFoldFPInstOperands()
1349 Constant *Op0 = FlushFPConstant(LHS, I, /* IsOutput */ false); in ConstantFoldFPInstOperands()
1352 Constant *Op1 = FlushFPConstant(RHS, I, /* IsOutput */ false); in ConstantFoldFPInstOperands()
1366 Constant *C = ConstantFoldBinaryOpOperands(Opcode, Op0, Op1, DL); in ConstantFoldFPInstOperands()
1386 Constant *llvm::ConstantFoldCastOperand(unsigned Opcode, Constant *C, in ConstantFoldCastOperand()
1394 Constant *FoldedValue = nullptr; in ConstantFoldCastOperand()
1408 auto *Base = cast<Constant>(GEP->stripAndAccumulateConstantOffsets( in ConstantFoldCastOperand()
1416 auto *Ptr = cast<Constant>(GEP->getPointerOperand()); in ConstantFoldCastOperand()
1441 Constant *SrcPtr = CE->getOperand(0); in ConstantFoldCastOperand()
1473 Constant *llvm::ConstantFoldIntegerCast(Constant *C, Type *DestTy, in ConstantFoldIntegerCast()
1734 Constant *GetConstantFoldFPValue(double V, Type *Ty) { in GetConstantFoldFPValue()
1747 Constant *GetConstantFoldFPValue128(float128 V, Type *Ty) { in GetConstantFoldFPValue128()
1774 Constant *ConstantFoldFP(double (*NativeFP)(double), const APFloat &V, in ConstantFoldFP()
1787 Constant *ConstantFoldFP128(float128 (*NativeFP)(float128), const APFloat &V, in ConstantFoldFP128()
1800 Constant *ConstantFoldBinaryFP(double (*NativeFP)(double, double), in ConstantFoldBinaryFP()
1812 Constant *constantFoldVectorReduce(Intrinsic::ID IID, Constant *Op) { in constantFoldVectorReduce()
1880 Constant *ConstantFoldSSEConvertToInt(const APFloat &Val, bool roundTowardZero, in ConstantFoldSSEConvertToInt()
1968 static Constant *constantFoldCanonicalize(const Type *Ty, const CallBase *CI, in constantFoldCanonicalize()
2017 static Constant *ConstantFoldScalarCall1(StringRef Name, in ConstantFoldScalarCall1()
2020 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall1()
2049 return Constant::getNullValue(Ty); in ConstantFoldScalarCall1()
2520 if (Constant *C = constantFoldVectorReduce(IntrinsicID, Operands[0])) in ConstantFoldScalarCall1()
2528 auto *Op = cast<Constant>(Operands[0]); in ConstantFoldScalarCall1()
2557 static Constant *evaluateCompare(const APFloat &Op1, const APFloat &Op2, in evaluateCompare()
2575 static Constant *ConstantFoldLibCall2(StringRef Name, Type *Ty, in ConstantFoldLibCall2()
2576 ArrayRef<Constant *> Operands, in ConstantFoldLibCall2()
2639 static Constant *ConstantFoldIntrinsicCall2(Intrinsic::ID IntrinsicID, Type *Ty, in ConstantFoldIntrinsicCall2()
2640 ArrayRef<Constant *> Operands, in ConstantFoldIntrinsicCall2()
2831 return Constant::getNullValue(Ty); in ConstantFoldIntrinsicCall2()
2840 {Constant::getAllOnesValue(Ty->getStructElementType(0)), in ConstantFoldIntrinsicCall2()
2841 Constant::getNullValue(Ty->getStructElementType(1))}); in ConstantFoldIntrinsicCall2()
2849 return Constant::getNullValue(Ty); in ConstantFoldIntrinsicCall2()
2874 Constant *Ops[] = { in ConstantFoldIntrinsicCall2()
2890 return Constant::getAllOnesValue(Ty); in ConstantFoldIntrinsicCall2()
2905 return Constant::getNullValue(Ty); in ConstantFoldIntrinsicCall2()
2918 return Constant::getNullValue(Ty); in ConstantFoldIntrinsicCall2()
2934 return Constant::getNullValue(Ty); in ConstantFoldIntrinsicCall2()
2939 return dyn_cast<Constant>(Operands[0]); in ConstantFoldIntrinsicCall2()
2952 auto *Op = cast<Constant>(Operands[0]); in ConstantFoldIntrinsicCall2()
3055 static Constant *ConstantFoldAMDGCNPermIntrinsic(ArrayRef<Constant *> Operands, in ConstantFoldAMDGCNPermIntrinsic()
3095 static Constant *ConstantFoldScalarCall3(StringRef Name, in ConstantFoldScalarCall3()
3098 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall3()
3173 return Constant::getNullValue(Ty); in ConstantFoldScalarCall3()
3232 static Constant *ConstantFoldScalarCall(StringRef Name, in ConstantFoldScalarCall()
3235 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall()
3242 if (Constant *FoldedLibCall = in ConstantFoldScalarCall()
3255 static Constant *ConstantFoldFixedVectorCall( in ConstantFoldFixedVectorCall()
3257 ArrayRef<Constant *> Operands, const DataLayout &DL, in ConstantFoldFixedVectorCall()
3259 SmallVector<Constant *, 4> Result(FVTy->getNumElements()); in ConstantFoldFixedVectorCall()
3260 SmallVector<Constant *, 4> Lane(Operands.size()); in ConstantFoldFixedVectorCall()
3269 Constant *VecData = ConstantFoldLoadFromConstPtr(SrcPtr, FVTy, DL); in ConstantFoldFixedVectorCall()
3271 SmallVector<Constant *, 32> NewElements; in ConstantFoldFixedVectorCall()
3310 SmallVector<Constant *, 16> NCs; in ConstantFoldFixedVectorCall()
3329 SmallVector<Constant *, 16> NCs; in ConstantFoldFixedVectorCall()
3353 Constant *Agg = Operands[J]->getAggregateElement(I); in ConstantFoldFixedVectorCall()
3361 Constant *Folded = in ConstantFoldFixedVectorCall()
3371 static Constant *ConstantFoldScalableVectorCall( in ConstantFoldScalableVectorCall()
3373 ArrayRef<Constant *> Operands, const DataLayout &DL, in ConstantFoldScalableVectorCall()
3377 auto *Src = dyn_cast<Constant>(Operands[0]); in ConstantFoldScalableVectorCall()
3389 static std::pair<Constant *, Constant *>
3390 ConstantFoldScalarFrexpCall(Constant *Op, Type *IntTy) { in ConstantFoldScalarFrexpCall()
3401 Constant *Result0 = ConstantFP::get(ConstFP->getType(), FrexpMant); in ConstantFoldScalarFrexpCall()
3405 Constant *Result1 = FrexpMant.isFinite() ? ConstantInt::get(IntTy, FrexpExp) in ConstantFoldScalarFrexpCall()
3411 static Constant *
3413 StructType *StTy, ArrayRef<Constant *> Operands, in ConstantFoldStructCall()
3423 SmallVector<Constant *, 4> Results0(FVTy0->getNumElements()); in ConstantFoldStructCall()
3424 SmallVector<Constant *, 4> Results1(FVTy0->getNumElements()); in ConstantFoldStructCall()
3427 Constant *Lane = Operands[0]->getAggregateElement(I); in ConstantFoldStructCall()
3454 Constant *llvm::ConstantFoldBinaryIntrinsic(Intrinsic::ID ID, Constant *LHS, in ConstantFoldBinaryIntrinsic()
3455 Constant *RHS, Type *Ty, in ConstantFoldBinaryIntrinsic()
3461 Constant *llvm::ConstantFoldCall(const CallBase *Call, Function *F, in ConstantFoldCall()
3462 ArrayRef<Constant *> Operands, in ConstantFoldCall()