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()
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)) 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)) 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()
763 return Constant::getNullValue(Ty); in ConstantFoldLoadFromUniformValue()
766 return Constant::getAllOnesValue(Ty); in ConstantFoldLoadFromUniformValue()
776 Constant *SymbolicallyEvaluateBinop(unsigned Opc, Constant *Op0, Constant *Op1, in SymbolicallyEvaluateBinop()
824 Constant *CastGEPIndices(Type *SrcElemTy, ArrayRef<Constant *> Ops, in CastGEPIndices()
832 SmallVector<Constant*, 32> NewIdxs; in CastGEPIndices()
841 Constant *NewIdx = ConstantFoldCastOperand( in CastGEPIndices()
854 Constant *C = ConstantExpr::getGetElementPtr( in CastGEPIndices()
860 Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP, in SymbolicallyEvaluateGEP()
861 ArrayRef<Constant *> Ops, in SymbolicallyEvaluateGEP()
873 if (Constant *C = CastGEPIndices(SrcElemTy, Ops, ResTy, in SymbolicallyEvaluateGEP()
878 Constant *Ptr = Ops[0]; in SymbolicallyEvaluateGEP()
911 Ptr = cast<Constant>(GEP->getOperand(0)); in SymbolicallyEvaluateGEP()
929 Constant *C = ConstantInt::get(Ptr->getContext(), Offset + BasePtr); in SymbolicallyEvaluateGEP()
964 SmallVector<Constant *, 32> NewIdxs; in SymbolicallyEvaluateGEP()
991 Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, unsigned Opcode, in ConstantFoldInstOperandsImpl()
992 ArrayRef<Constant *> Ops, in ConstantFoldInstOperandsImpl()
1027 if (Constant *C = SymbolicallyEvaluateGEP(GEP, Ops, DL, TLI)) in ConstantFoldInstOperandsImpl()
1091 Constant *
1092 ConstantFoldConstantImpl(const Constant *C, const DataLayout &DL, in ConstantFoldConstantImpl()
1094 SmallDenseMap<Constant *, Constant *> &FoldedOps) { in ConstantFoldConstantImpl() argument
1096 return const_cast<Constant *>(C); in ConstantFoldConstantImpl()
1098 SmallVector<Constant *, 8> Ops; in ConstantFoldConstantImpl()
1100 Constant *OldC = cast<Constant>(&OldU); in ConstantFoldConstantImpl()
1101 Constant *NewC = OldC; in ConstantFoldConstantImpl()
1117 if (Constant *Res = in ConstantFoldConstantImpl()
1120 return const_cast<Constant *>(C); in ConstantFoldConstantImpl()
1129 Constant *llvm::ConstantFoldInstruction(Instruction *I, const DataLayout &DL, in ConstantFoldInstruction()
1133 Constant *CommonValue = nullptr; in ConstantFoldInstruction()
1135 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldInstruction()
1144 auto *C = dyn_cast<Constant>(Incoming); in ConstantFoldInstruction()
1162 if (!all_of(I->operands(), [](Use &U) { return isa<Constant>(U); })) in ConstantFoldInstruction()
1165 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldInstruction()
1166 SmallVector<Constant *, 8> Ops; in ConstantFoldInstruction()
1168 auto *Op = cast<Constant>(&OpU); in ConstantFoldInstruction()
1177 Constant *llvm::ConstantFoldConstant(const Constant *C, const DataLayout &DL, in ConstantFoldConstant()
1179 SmallDenseMap<Constant *, Constant *> FoldedOps; in ConstantFoldConstant()
1183 Constant *llvm::ConstantFoldInstOperands(Instruction *I, in ConstantFoldInstOperands()
1184 ArrayRef<Constant *> Ops, in ConstantFoldInstOperands()
1190 Constant *llvm::ConstantFoldCompareInstOperands( in ConstantFoldCompareInstOperands()
1191 unsigned IntPredicate, Constant *Ops0, Constant *Ops1, const DataLayout &DL, in ConstantFoldCompareInstOperands()
1210 if (Constant *C = ConstantFoldIntegerCast(CE0->getOperand(0), IntPtrTy, in ConstantFoldCompareInstOperands()
1212 Constant *Null = Constant::getNullValue(C->getType()); in ConstantFoldCompareInstOperands()
1222 Constant *C = CE0->getOperand(0); in ConstantFoldCompareInstOperands()
1223 Constant *Null = Constant::getNullValue(C->getType()); in ConstantFoldCompareInstOperands()
1236 Constant *C0 = ConstantFoldIntegerCast(CE0->getOperand(0), IntPtrTy, in ConstantFoldCompareInstOperands()
1238 Constant *C1 = ConstantFoldIntegerCast(CE1->getOperand(0), IntPtrTy, in ConstantFoldCompareInstOperands()
1295 Constant *llvm::ConstantFoldUnaryOpOperand(unsigned Opcode, Constant *Op, in ConstantFoldUnaryOpOperand()
1302 Constant *llvm::ConstantFoldBinaryOpOperands(unsigned Opcode, Constant *LHS, in ConstantFoldBinaryOpOperands()
1303 Constant *RHS, in ConstantFoldBinaryOpOperands()
1307 if (Constant *C = SymbolicallyEvaluateBinop(Opcode, LHS, RHS, DL)) in ConstantFoldBinaryOpOperands()
1315 Constant *llvm::FlushFPConstant(Constant *Operand, const Instruction *I, in FlushFPConstant()
1358 Constant *llvm::ConstantFoldFPInstOperands(unsigned Opcode, Constant *LHS, in ConstantFoldFPInstOperands()
1359 Constant *RHS, const DataLayout &DL, in ConstantFoldFPInstOperands()
1363 Constant *Op0 = FlushFPConstant(LHS, I, /* IsOutput */ false); in ConstantFoldFPInstOperands()
1366 Constant *Op1 = FlushFPConstant(RHS, I, /* IsOutput */ false); in ConstantFoldFPInstOperands()
1371 Constant *C = ConstantFoldBinaryOpOperands(Opcode, Op0, Op1, DL); in ConstantFoldFPInstOperands()
1383 Constant *llvm::ConstantFoldCastOperand(unsigned Opcode, Constant *C, in ConstantFoldCastOperand()
1391 Constant *FoldedValue = nullptr; in ConstantFoldCastOperand()
1405 auto *Base = cast<Constant>(GEP->stripAndAccumulateConstantOffsets( in ConstantFoldCastOperand()
1413 auto *Ptr = cast<Constant>(GEP->getPointerOperand()); in ConstantFoldCastOperand()
1438 Constant *SrcPtr = CE->getOperand(0); in ConstantFoldCastOperand()
1470 Constant *llvm::ConstantFoldIntegerCast(Constant *C, Type *DestTy, in ConstantFoldIntegerCast()
1729 Constant *GetConstantFoldFPValue(double V, Type *Ty) { in GetConstantFoldFPValue()
1761 Constant *ConstantFoldFP(double (*NativeFP)(double), const APFloat &V, in ConstantFoldFP()
1773 Constant *ConstantFoldBinaryFP(double (*NativeFP)(double, double), in ConstantFoldBinaryFP()
1785 Constant *constantFoldVectorReduce(Intrinsic::ID IID, Constant *Op) { in constantFoldVectorReduce()
1853 Constant *ConstantFoldSSEConvertToInt(const APFloat &Val, bool roundTowardZero, in ConstantFoldSSEConvertToInt()
1941 static Constant *constantFoldCanonicalize(const Type *Ty, const CallBase *CI, in constantFoldCanonicalize()
1990 static Constant *ConstantFoldScalarCall1(StringRef Name, in ConstantFoldScalarCall1()
1993 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall1()
2022 return Constant::getNullValue(Ty); in ConstantFoldScalarCall1()
2477 if (Constant *C = constantFoldVectorReduce(IntrinsicID, Operands[0])) in ConstantFoldScalarCall1()
2485 auto *Op = cast<Constant>(Operands[0]); in ConstantFoldScalarCall1()
2514 static Constant *evaluateCompare(const APFloat &Op1, const APFloat &Op2, in evaluateCompare()
2532 static Constant *ConstantFoldScalarCall2(StringRef Name, in ConstantFoldScalarCall2()
2535 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall2()
2756 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2765 {Constant::getAllOnesValue(Ty->getStructElementType(0)), in ConstantFoldScalarCall2()
2766 Constant::getNullValue(Ty->getStructElementType(1))}); in ConstantFoldScalarCall2()
2774 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2799 Constant *Ops[] = { in ConstantFoldScalarCall2()
2815 return Constant::getAllOnesValue(Ty); in ConstantFoldScalarCall2()
2830 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2843 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2859 return Constant::getNullValue(Ty); in ConstantFoldScalarCall2()
2864 return dyn_cast<Constant>(Operands[0]); in ConstantFoldScalarCall2()
2877 auto *Op = cast<Constant>(Operands[0]); in ConstantFoldScalarCall2()
2980 static Constant *ConstantFoldAMDGCNPermIntrinsic(ArrayRef<Constant *> Operands, in ConstantFoldAMDGCNPermIntrinsic()
3020 static Constant *ConstantFoldScalarCall3(StringRef Name, in ConstantFoldScalarCall3()
3023 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall3()
3098 return Constant::getNullValue(Ty); in ConstantFoldScalarCall3()
3157 static Constant *ConstantFoldScalarCall(StringRef Name, in ConstantFoldScalarCall()
3160 ArrayRef<Constant *> Operands, in ConstantFoldScalarCall()
3175 static Constant *ConstantFoldFixedVectorCall( in ConstantFoldFixedVectorCall()
3177 ArrayRef<Constant *> Operands, const DataLayout &DL, in ConstantFoldFixedVectorCall()
3179 SmallVector<Constant *, 4> Result(FVTy->getNumElements()); in ConstantFoldFixedVectorCall()
3180 SmallVector<Constant *, 4> Lane(Operands.size()); in ConstantFoldFixedVectorCall()
3189 Constant *VecData = ConstantFoldLoadFromConstPtr(SrcPtr, FVTy, DL); in ConstantFoldFixedVectorCall()
3191 SmallVector<Constant *, 32> NewElements; in ConstantFoldFixedVectorCall()
3230 SmallVector<Constant *, 16> NCs; in ConstantFoldFixedVectorCall()
3249 SmallVector<Constant *, 16> NCs; in ConstantFoldFixedVectorCall()
3273 Constant *Agg = Operands[J]->getAggregateElement(I); in ConstantFoldFixedVectorCall()
3281 Constant *Folded = in ConstantFoldFixedVectorCall()
3291 static Constant *ConstantFoldScalableVectorCall( in ConstantFoldScalableVectorCall()
3293 ArrayRef<Constant *> Operands, const DataLayout &DL, in ConstantFoldScalableVectorCall()
3297 auto *Src = dyn_cast<Constant>(Operands[0]); in ConstantFoldScalableVectorCall()
3309 static std::pair<Constant *, Constant *>
3310 ConstantFoldScalarFrexpCall(Constant *Op, Type *IntTy) { in ConstantFoldScalarFrexpCall()
3321 Constant *Result0 = ConstantFP::get(ConstFP->getType(), FrexpMant); in ConstantFoldScalarFrexpCall()
3325 Constant *Result1 = FrexpMant.isFinite() ? ConstantInt::get(IntTy, FrexpExp) in ConstantFoldScalarFrexpCall()
3331 static Constant *
3333 StructType *StTy, ArrayRef<Constant *> Operands, in ConstantFoldStructCall()
3343 SmallVector<Constant *, 4> Results0(FVTy0->getNumElements()); in ConstantFoldStructCall()
3344 SmallVector<Constant *, 4> Results1(FVTy0->getNumElements()); in ConstantFoldStructCall()
3347 Constant *Lane = Operands[0]->getAggregateElement(I); in ConstantFoldStructCall()
3374 Constant *llvm::ConstantFoldCall(const CallBase *Call, Function *F, in ConstantFoldCall()
3375 ArrayRef<Constant *> Operands, in ConstantFoldCall()