LLVM  15.0.0git
ConstantFolder.h
Go to the documentation of this file.
1 //===- ConstantFolder.h - Constant folding helper ---------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the ConstantFolder class, a helper for IRBuilder.
10 // It provides IRBuilder with a set of methods for creating constants
11 // with minimal folding. For general constant creation and folding,
12 // use ConstantExpr and the routines in llvm/Analysis/ConstantFolding.h.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_IR_CONSTANTFOLDER_H
17 #define LLVM_IR_CONSTANTFOLDER_H
18 
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/ADT/STLExtras.h"
21 #include "llvm/IR/Constants.h"
23 #include "llvm/IR/Instruction.h"
24 
25 namespace llvm {
26 
27 /// ConstantFolder - Create constants with minimum, target independent, folding.
28 class ConstantFolder final : public IRBuilderFolder {
29  virtual void anchor();
30 
31 public:
32  explicit ConstantFolder() = default;
33 
34  //===--------------------------------------------------------------------===//
35  // Value-based folders.
36  //
37  // Return an existing value or a constant if the operation can be simplified.
38  // Otherwise return nullptr.
39  //===--------------------------------------------------------------------===//
40  Value *FoldAdd(Value *LHS, Value *RHS, bool HasNUW = false,
41  bool HasNSW = false) const override {
42  auto *LC = dyn_cast<Constant>(LHS);
43  auto *RC = dyn_cast<Constant>(RHS);
44  if (LC && RC)
45  return ConstantExpr::getAdd(LC, RC, HasNUW, HasNSW);
46  return nullptr;
47  }
48 
49  Value *FoldAnd(Value *LHS, Value *RHS) const override {
50  auto *LC = dyn_cast<Constant>(LHS);
51  auto *RC = dyn_cast<Constant>(RHS);
52  if (LC && RC)
53  return ConstantExpr::getAnd(LC, RC);
54  return nullptr;
55  }
56 
57  Value *FoldOr(Value *LHS, Value *RHS) const override {
58  auto *LC = dyn_cast<Constant>(LHS);
59  auto *RC = dyn_cast<Constant>(RHS);
60  if (LC && RC)
61  return ConstantExpr::getOr(LC, RC);
62  return nullptr;
63  }
64 
66  auto *LC = dyn_cast<Constant>(LHS);
67  auto *RC = dyn_cast<Constant>(RHS);
68  if (LC && RC)
69  return ConstantExpr::getCompare(P, LC, RC);
70  return nullptr;
71  }
72 
73  Value *FoldGEP(Type *Ty, Value *Ptr, ArrayRef<Value *> IdxList,
74  bool IsInBounds = false) const override {
75  if (auto *PC = dyn_cast<Constant>(Ptr)) {
76  // Every index must be constant.
77  if (any_of(IdxList, [](Value *V) { return !isa<Constant>(V); }))
78  return nullptr;
79 
80  if (IsInBounds)
81  return ConstantExpr::getInBoundsGetElementPtr(Ty, PC, IdxList);
82  else
83  return ConstantExpr::getGetElementPtr(Ty, PC, IdxList);
84  }
85  return nullptr;
86  }
87 
88  Value *FoldSelect(Value *C, Value *True, Value *False) const override {
89  auto *CC = dyn_cast<Constant>(C);
90  auto *TC = dyn_cast<Constant>(True);
91  auto *FC = dyn_cast<Constant>(False);
92  if (CC && TC && FC)
93  return ConstantExpr::getSelect(CC, TC, FC);
94  return nullptr;
95  }
96 
98  ArrayRef<unsigned> IdxList) const override {
99  if (auto *CAgg = dyn_cast<Constant>(Agg))
100  return ConstantExpr::getExtractValue(CAgg, IdxList);
101  return nullptr;
102  };
103 
105  ArrayRef<unsigned> IdxList) const override {
106  auto *CAgg = dyn_cast<Constant>(Agg);
107  auto *CVal = dyn_cast<Constant>(Val);
108  if (CAgg && CVal)
109  return ConstantExpr::getInsertValue(CAgg, CVal, IdxList);
110  return nullptr;
111  }
112 
113  //===--------------------------------------------------------------------===//
114  // Binary Operators
115  //===--------------------------------------------------------------------===//
116 
117  Constant *CreateFAdd(Constant *LHS, Constant *RHS) const override {
118  return ConstantExpr::getFAdd(LHS, RHS);
119  }
120 
122  bool HasNUW = false, bool HasNSW = false) const override {
123  return ConstantExpr::getSub(LHS, RHS, HasNUW, HasNSW);
124  }
125 
126  Constant *CreateFSub(Constant *LHS, Constant *RHS) const override {
127  return ConstantExpr::getFSub(LHS, RHS);
128  }
129 
131  bool HasNUW = false, bool HasNSW = false) const override {
132  return ConstantExpr::getMul(LHS, RHS, HasNUW, HasNSW);
133  }
134 
135  Constant *CreateFMul(Constant *LHS, Constant *RHS) const override {
136  return ConstantExpr::getFMul(LHS, RHS);
137  }
138 
140  bool isExact = false) const override {
141  return ConstantExpr::getUDiv(LHS, RHS, isExact);
142  }
143 
145  bool isExact = false) const override {
146  return ConstantExpr::getSDiv(LHS, RHS, isExact);
147  }
148 
149  Constant *CreateFDiv(Constant *LHS, Constant *RHS) const override {
150  return ConstantExpr::getFDiv(LHS, RHS);
151  }
152 
153  Constant *CreateURem(Constant *LHS, Constant *RHS) const override {
154  return ConstantExpr::getURem(LHS, RHS);
155  }
156 
157  Constant *CreateSRem(Constant *LHS, Constant *RHS) const override {
158  return ConstantExpr::getSRem(LHS, RHS);
159  }
160 
161  Constant *CreateFRem(Constant *LHS, Constant *RHS) const override {
162  return ConstantExpr::getFRem(LHS, RHS);
163  }
164 
166  bool HasNUW = false, bool HasNSW = false) const override {
167  return ConstantExpr::getShl(LHS, RHS, HasNUW, HasNSW);
168  }
169 
171  bool isExact = false) const override {
172  return ConstantExpr::getLShr(LHS, RHS, isExact);
173  }
174 
176  bool isExact = false) const override {
177  return ConstantExpr::getAShr(LHS, RHS, isExact);
178  }
179 
181  return ConstantExpr::getOr(LHS, RHS);
182  }
183 
184  Constant *CreateXor(Constant *LHS, Constant *RHS) const override {
185  return ConstantExpr::getXor(LHS, RHS);
186  }
187 
189  Constant *LHS, Constant *RHS) const override {
190  return ConstantExpr::get(Opc, LHS, RHS);
191  }
192 
193  //===--------------------------------------------------------------------===//
194  // Unary Operators
195  //===--------------------------------------------------------------------===//
196 
198  bool HasNUW = false, bool HasNSW = false) const override {
199  return ConstantExpr::getNeg(C, HasNUW, HasNSW);
200  }
201 
202  Constant *CreateFNeg(Constant *C) const override {
203  return ConstantExpr::getFNeg(C);
204  }
205 
206  Constant *CreateNot(Constant *C) const override {
207  return ConstantExpr::getNot(C);
208  }
209 
211  return ConstantExpr::get(Opc, C);
212  }
213 
214  //===--------------------------------------------------------------------===//
215  // Cast/Conversion Operators
216  //===--------------------------------------------------------------------===//
217 
219  Type *DestTy) const override {
220  return ConstantExpr::getCast(Op, C, DestTy);
221  }
222 
223  Constant *CreatePointerCast(Constant *C, Type *DestTy) const override {
224  return ConstantExpr::getPointerCast(C, DestTy);
225  }
226 
228  Type *DestTy) const override {
230  }
231 
233  bool isSigned) const override {
234  return ConstantExpr::getIntegerCast(C, DestTy, isSigned);
235  }
236 
237  Constant *CreateFPCast(Constant *C, Type *DestTy) const override {
238  return ConstantExpr::getFPCast(C, DestTy);
239  }
240 
241  Constant *CreateBitCast(Constant *C, Type *DestTy) const override {
242  return CreateCast(Instruction::BitCast, C, DestTy);
243  }
244 
245  Constant *CreateIntToPtr(Constant *C, Type *DestTy) const override {
246  return CreateCast(Instruction::IntToPtr, C, DestTy);
247  }
248 
249  Constant *CreatePtrToInt(Constant *C, Type *DestTy) const override {
250  return CreateCast(Instruction::PtrToInt, C, DestTy);
251  }
252 
253  Constant *CreateZExtOrBitCast(Constant *C, Type *DestTy) const override {
254  return ConstantExpr::getZExtOrBitCast(C, DestTy);
255  }
256 
257  Constant *CreateSExtOrBitCast(Constant *C, Type *DestTy) const override {
258  return ConstantExpr::getSExtOrBitCast(C, DestTy);
259  }
260 
261  Constant *CreateTruncOrBitCast(Constant *C, Type *DestTy) const override {
262  return ConstantExpr::getTruncOrBitCast(C, DestTy);
263  }
264 
265  //===--------------------------------------------------------------------===//
266  // Compare Instructions
267  //===--------------------------------------------------------------------===//
268 
270  Constant *RHS) const override {
271  return ConstantExpr::getCompare(P, LHS, RHS);
272  }
273 
274  //===--------------------------------------------------------------------===//
275  // Other Instructions
276  //===--------------------------------------------------------------------===//
277 
278  Constant *CreateExtractElement(Constant *Vec, Constant *Idx) const override {
279  return ConstantExpr::getExtractElement(Vec, Idx);
280  }
281 
283  Constant *Idx) const override {
284  return ConstantExpr::getInsertElement(Vec, NewElt, Idx);
285  }
286 
288  ArrayRef<int> Mask) const override {
290  }
291 };
292 
293 } // end namespace llvm
294 
295 #endif // LLVM_IR_CONSTANTFOLDER_H
llvm::ConstantFolder::CreateExtractElement
Constant * CreateExtractElement(Constant *Vec, Constant *Idx) const override
Definition: ConstantFolder.h:278
llvm::ConstantFolder::CreateInsertElement
Constant * CreateInsertElement(Constant *Vec, Constant *NewElt, Constant *Idx) const override
Definition: ConstantFolder.h:282
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::ConstantExpr::getFDiv
static Constant * getFDiv(Constant *C1, Constant *C2)
Definition: Constants.cpp:2758
llvm::ConstantExpr::getExtractElement
static Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2577
llvm::ConstantFolder::CreateSExtOrBitCast
Constant * CreateSExtOrBitCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:257
llvm::ConstantExpr::getNot
static Constant * getNot(Constant *C)
Definition: Constants.cpp:2709
llvm::ConstantExpr::getZExtOrBitCast
static Constant * getZExtOrBitCast(Constant *C, Type *Ty)
Definition: Constants.cpp:2041
llvm::Instruction::UnaryOps
UnaryOps
Definition: Instruction.h:779
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:719
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::ConstantExpr::getFRem
static Constant * getFRem(Constant *C1, Constant *C2)
Definition: Constants.cpp:2770
llvm::ConstantExpr::getFPCast
static Constant * getFPCast(Constant *C, Type *Ty)
Create a FPExt, Bitcast or FPTrunc for fp -> fp casts.
Definition: Constants.cpp:2108
llvm::IRBuilderFolder
IRBuilderFolder - Interface for constant folding in IRBuilder.
Definition: IRBuilderFolder.h:24
R600_InstFlag::FC
@ FC
Definition: R600Defines.h:32
llvm::ConstantExpr::getSelect
static Constant * getSelect(Constant *C, Constant *V1, Constant *V2, Type *OnlyIfReducedTy=nullptr)
Select constant expr.
Definition: Constants.cpp:2445
llvm::ConstantExpr::getInsertValue
static Constant * getInsertValue(Constant *Agg, Constant *Val, ArrayRef< unsigned > Idxs, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2648
llvm::ConstantFolder::CreateAShr
Constant * CreateAShr(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: ConstantFolder.h:175
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::ConstantFolder::CreateFMul
Constant * CreateFMul(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:135
llvm::ConstantFolder::CreateShl
Constant * CreateShl(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: ConstantFolder.h:165
llvm::ConstantFolder::CreateFNeg
Constant * CreateFNeg(Constant *C) const override
Definition: ConstantFolder.h:202
llvm::ConstantFolder::CreateSub
Constant * CreateSub(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: ConstantFolder.h:121
llvm::ConstantFolder::FoldAdd
Value * FoldAdd(Value *LHS, Value *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: ConstantFolder.h:40
llvm::ConstantExpr::getInBoundsGetElementPtr
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
Definition: Constants.h:1270
STLExtras.h
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::ConstantFolder::FoldICmp
Value * FoldICmp(CmpInst::Predicate P, Value *LHS, Value *RHS) const override
Definition: ConstantFolder.h:65
llvm::ConstantFolder::CreatePointerBitCastOrAddrSpaceCast
Constant * CreatePointerBitCastOrAddrSpaceCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:227
llvm::ConstantFolder::CreateOr
Constant * CreateOr(Constant *LHS, Constant *RHS) const
Definition: ConstantFolder.h:180
llvm::ConstantFolder::CreateSRem
Constant * CreateSRem(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:157
llvm::ConstantExpr::getPointerCast
static Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.
Definition: Constants.cpp:2070
llvm::ConstantFolder::FoldSelect
Value * FoldSelect(Value *C, Value *True, Value *False) const override
Definition: ConstantFolder.h:88
llvm::ConstantExpr::getSub
static Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2726
llvm::ConstantFolder::CreateFRem
Constant * CreateFRem(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:161
llvm::BitmaskEnumDetail::Mask
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:80
Instruction.h
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::ConstantFolder
ConstantFolder - Create constants with minimum, target independent, folding.
Definition: ConstantFolder.h:28
llvm::ConstantFolder::CreateSDiv
Constant * CreateSDiv(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: ConstantFolder.h:144
Constants.h
llvm::ConstantFolder::CreateZExtOrBitCast
Constant * CreateZExtOrBitCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:253
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::ConstantFolder::CreateNeg
Constant * CreateNeg(Constant *C, bool HasNUW=false, bool HasNSW=false) const override
Definition: ConstantFolder.h:197
llvm::ConstantFolder::CreateNot
Constant * CreateNot(Constant *C) const override
Definition: ConstantFolder.h:206
llvm::ConstantFolder::CreateUnOp
Constant * CreateUnOp(Instruction::UnaryOps Opc, Constant *C) const override
Definition: ConstantFolder.h:210
llvm::ConstantExpr::getUDiv
static Constant * getUDiv(Constant *C1, Constant *C2, bool isExact=false)
Definition: Constants.cpp:2748
llvm::Instruction::CastOps
CastOps
Definition: Instruction.h:800
llvm::ConstantExpr::getXor
static Constant * getXor(Constant *C1, Constant *C2)
Definition: Constants.cpp:2782
llvm::ConstantExpr::getURem
static Constant * getURem(Constant *C1, Constant *C2)
Definition: Constants.cpp:2762
llvm::ConstantFolder::CreateUDiv
Constant * CreateUDiv(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: ConstantFolder.h:139
llvm::ConstantFolder::ConstantFolder
ConstantFolder()=default
llvm::ConstantExpr::getFNeg
static Constant * getFNeg(Constant *C)
Definition: Constants.cpp:2703
llvm::ConstantExpr::getAShr
static Constant * getAShr(Constant *C1, Constant *C2, bool isExact=false)
Definition: Constants.cpp:2803
llvm::ConstantExpr::getShuffleVector
static Constant * getShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2622
llvm::ConstantFolder::CreatePtrToInt
Constant * CreatePtrToInt(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:249
llvm::ConstantFolder::FoldAnd
Value * FoldAnd(Value *LHS, Value *RHS) const override
Definition: ConstantFolder.h:49
llvm::ConstantExpr::getCompare
static Constant * getCompare(unsigned short pred, Constant *C1, Constant *C2, bool OnlyIfReduced=false)
Return an ICmp or FCmp comparison operator constant expression.
Definition: Constants.cpp:2423
llvm::ConstantFolder::FoldGEP
Value * FoldGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, bool IsInBounds=false) const override
Definition: ConstantFolder.h:73
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::ConstantFolder::CreateFAdd
Constant * CreateFAdd(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:117
llvm::ConstantFolder::CreateURem
Constant * CreateURem(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:153
llvm::ConstantFolder::CreateBinOp
Constant * CreateBinOp(Instruction::BinaryOps Opc, Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:188
llvm::ConstantExpr::get
static Constant * get(unsigned Opcode, Constant *C1, unsigned Flags=0, Type *OnlyIfReducedTy=nullptr)
get - Return a unary operator constant expression, folding if possible.
Definition: Constants.cpp:2292
llvm::ConstantExpr::getShl
static Constant * getShl(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2791
llvm::ConstantExpr::getFSub
static Constant * getFSub(Constant *C1, Constant *C2)
Definition: Constants.cpp:2733
llvm::ConstantFolder::CreatePointerCast
Constant * CreatePointerCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:223
llvm::ConstantExpr::getOr
static Constant * getOr(Constant *C1, Constant *C2)
Definition: Constants.cpp:2778
ArrayRef.h
IRBuilderFolder.h
llvm::ConstantFolder::FoldOr
Value * FoldOr(Value *LHS, Value *RHS) const override
Definition: ConstantFolder.h:57
llvm::ConstantExpr::getCast
static Constant * getCast(unsigned ops, Constant *C, Type *Ty, bool OnlyIfReduced=false)
Convenience function for getting a Cast operation.
Definition: Constants.cpp:2002
llvm::ConstantFolder::CreateMul
Constant * CreateMul(Constant *LHS, Constant *RHS, bool HasNUW=false, bool HasNSW=false) const override
Definition: ConstantFolder.h:130
llvm::ConstantExpr::getTruncOrBitCast
static Constant * getTruncOrBitCast(Constant *C, Type *Ty)
Definition: Constants.cpp:2053
llvm::ConstantFolder::CreateXor
Constant * CreateXor(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:184
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::any_of
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1614
llvm::ConstantExpr::getSExtOrBitCast
static Constant * getSExtOrBitCast(Constant *C, Type *Ty)
Definition: Constants.cpp:2047
llvm::ConstantExpr::getInsertElement
static Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2599
llvm::ConstantFolder::CreateFCmp
Constant * CreateFCmp(CmpInst::Predicate P, Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:269
llvm::ConstantFolder::CreateIntToPtr
Constant * CreateIntToPtr(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:245
llvm::ConstantExpr::getIntegerCast
static Constant * getIntegerCast(Constant *C, Type *Ty, bool IsSigned)
Create a ZExt, Bitcast or Trunc for integer -> integer casts.
Definition: Constants.cpp:2096
llvm::ConstantFolder::CreateShuffleVector
Constant * CreateShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask) const override
Definition: ConstantFolder.h:287
llvm::ConstantExpr::getFMul
static Constant * getFMul(Constant *C1, Constant *C2)
Definition: Constants.cpp:2744
llvm::NVPTX::PTXLdStInstCode::V2
@ V2
Definition: NVPTX.h:123
llvm::ConstantExpr::getSDiv
static Constant * getSDiv(Constant *C1, Constant *C2, bool isExact=false)
Definition: Constants.cpp:2753
llvm::ConstantFolder::CreateFSub
Constant * CreateFSub(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:126
llvm::ConstantFolder::CreateFPCast
Constant * CreateFPCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:237
llvm::ConstantExpr::getNeg
static Constant * getNeg(Constant *C, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2696
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:344
llvm::ConstantExpr::getAdd
static Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2715
llvm::ConstantFolder::FoldExtractValue
Value * FoldExtractValue(Value *Agg, ArrayRef< unsigned > IdxList) const override
Definition: ConstantFolder.h:97
llvm::ConstantExpr::getAnd
static Constant * getAnd(Constant *C1, Constant *C2)
Definition: Constants.cpp:2774
llvm::ConstantFolder::CreateBitCast
Constant * CreateBitCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:241
llvm::ConstantExpr::getGetElementPtr
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList, bool InBounds=false, Optional< unsigned > InRangeIndex=None, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
Definition: Constants.h:1243
llvm::ConstantExpr::getLShr
static Constant * getLShr(Constant *C1, Constant *C2, bool isExact=false)
Definition: Constants.cpp:2798
llvm::ConstantFolder::CreateTruncOrBitCast
Constant * CreateTruncOrBitCast(Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:261
llvm::Instruction::BinaryOps
BinaryOps
Definition: Instruction.h:786
llvm::ConstantFolder::CreateLShr
Constant * CreateLShr(Constant *LHS, Constant *RHS, bool isExact=false) const override
Definition: ConstantFolder.h:170
llvm::ConstantFolder::CreateIntCast
Constant * CreateIntCast(Constant *C, Type *DestTy, bool isSigned) const override
Definition: ConstantFolder.h:232
llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast
static Constant * getPointerBitCastOrAddrSpaceCast(Constant *C, Type *Ty)
Create a BitCast or AddrSpaceCast for a pointer type depending on the address space.
Definition: Constants.cpp:2085
llvm::ConstantExpr::getSRem
static Constant * getSRem(Constant *C1, Constant *C2)
Definition: Constants.cpp:2766
llvm::ConstantExpr::getMul
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
Definition: Constants.cpp:2737
llvm::ConstantFolder::CreateFDiv
Constant * CreateFDiv(Constant *LHS, Constant *RHS) const override
Definition: ConstantFolder.h:149
llvm::ConstantFolder::FoldInsertValue
Value * FoldInsertValue(Value *Agg, Value *Val, ArrayRef< unsigned > IdxList) const override
Definition: ConstantFolder.h:104
llvm::ConstantExpr::getFAdd
static Constant * getFAdd(Constant *C1, Constant *C2)
Definition: Constants.cpp:2722
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::ConstantExpr::getExtractValue
static Constant * getExtractValue(Constant *Agg, ArrayRef< unsigned > Idxs, Type *OnlyIfReducedTy=nullptr)
Definition: Constants.cpp:2672
llvm::ConstantFolder::CreateCast
Constant * CreateCast(Instruction::CastOps Op, Constant *C, Type *DestTy) const override
Definition: ConstantFolder.h:218