32 #ifndef LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
33 #define LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
40 class AssumptionCache;
45 class TargetLibraryInfo;
53 const TargetLibraryInfo *TLI =
nullptr,
54 const DominatorTree *DT =
nullptr,
55 AssumptionCache *AC =
nullptr,
56 const Instruction *CxtI =
nullptr);
62 const TargetLibraryInfo *TLI =
nullptr,
63 const DominatorTree *DT =
nullptr,
64 AssumptionCache *AC =
nullptr,
65 const Instruction *CxtI =
nullptr);
71 const TargetLibraryInfo *TLI =
nullptr,
72 const DominatorTree *DT =
nullptr,
73 AssumptionCache *AC =
nullptr,
74 const Instruction *CxtI =
nullptr);
80 const TargetLibraryInfo *TLI =
nullptr,
81 const DominatorTree *DT =
nullptr,
82 AssumptionCache *AC =
nullptr,
83 const Instruction *CxtI =
nullptr);
89 const TargetLibraryInfo *TLI =
nullptr,
90 const DominatorTree *DT =
nullptr,
91 AssumptionCache *AC =
nullptr,
92 const Instruction *CxtI =
nullptr);
97 const TargetLibraryInfo *TLI =
nullptr,
98 const DominatorTree *DT =
nullptr,
99 AssumptionCache *AC =
nullptr,
100 const Instruction *CxtI =
nullptr);
105 const TargetLibraryInfo *TLI =
nullptr,
106 const DominatorTree *DT =
nullptr,
107 AssumptionCache *AC =
nullptr,
108 const Instruction *CxtI =
nullptr);
113 const TargetLibraryInfo *TLI =
nullptr,
114 const DominatorTree *DT =
nullptr,
115 AssumptionCache *AC =
nullptr,
116 const Instruction *CxtI =
nullptr);
121 const DataLayout &DL,
122 const TargetLibraryInfo *TLI =
nullptr,
123 const DominatorTree *DT =
nullptr,
124 AssumptionCache *AC =
nullptr,
125 const Instruction *CxtI =
nullptr);
130 const TargetLibraryInfo *TLI =
nullptr,
131 const DominatorTree *DT =
nullptr,
132 AssumptionCache *AC =
nullptr,
133 const Instruction *CxtI =
nullptr);
138 const TargetLibraryInfo *TLI =
nullptr,
139 const DominatorTree *DT =
nullptr,
140 AssumptionCache *AC =
nullptr,
141 const Instruction *CxtI =
nullptr);
146 const DataLayout &DL,
147 const TargetLibraryInfo *TLI =
nullptr,
148 const DominatorTree *DT =
nullptr,
149 AssumptionCache *AC =
nullptr,
150 const Instruction *CxtI =
nullptr);
155 const DataLayout &DL,
156 const TargetLibraryInfo *TLI =
nullptr,
157 const DominatorTree *DT =
nullptr,
158 AssumptionCache *AC =
nullptr,
159 const Instruction *CxtI =
nullptr);
164 const DataLayout &DL,
165 const TargetLibraryInfo *TLI =
nullptr,
166 const DominatorTree *DT =
nullptr,
167 AssumptionCache *AC =
nullptr,
168 const Instruction *CxtI =
nullptr);
173 const DataLayout &DL,
174 const TargetLibraryInfo *TLI =
nullptr,
175 const DominatorTree *DT =
nullptr,
176 AssumptionCache *AC =
nullptr,
177 const Instruction *CxtI =
nullptr);
182 const TargetLibraryInfo *TLI =
nullptr,
183 const DominatorTree *DT =
nullptr,
184 AssumptionCache *AC =
nullptr,
185 const Instruction *CxtI =
nullptr);
189 Value *
SimplifyOrInst(Value *LHS, Value *RHS,
const DataLayout &DL,
190 const TargetLibraryInfo *TLI =
nullptr,
191 const DominatorTree *DT =
nullptr,
192 AssumptionCache *AC =
nullptr,
193 const Instruction *CxtI =
nullptr);
198 const TargetLibraryInfo *TLI =
nullptr,
199 const DominatorTree *DT =
nullptr,
200 AssumptionCache *AC =
nullptr,
201 const Instruction *CxtI =
nullptr);
206 const DataLayout &DL,
207 const TargetLibraryInfo *TLI =
nullptr,
208 const DominatorTree *DT =
nullptr,
209 AssumptionCache *AC =
nullptr,
210 Instruction *CxtI =
nullptr);
215 FastMathFlags FMF,
const DataLayout &DL,
216 const TargetLibraryInfo *TLI =
nullptr,
217 const DominatorTree *DT =
nullptr,
218 AssumptionCache *AC =
nullptr,
219 const Instruction *CxtI =
nullptr);
224 const DataLayout &DL,
225 const TargetLibraryInfo *TLI =
nullptr,
226 const DominatorTree *DT =
nullptr,
227 AssumptionCache *AC =
nullptr,
228 const Instruction *CxtI =
nullptr);
233 const TargetLibraryInfo *TLI =
nullptr,
234 const DominatorTree *DT =
nullptr,
235 AssumptionCache *AC =
nullptr,
236 const Instruction *CxtI =
nullptr);
241 ArrayRef<unsigned> Idxs,
const DataLayout &DL,
242 const TargetLibraryInfo *TLI =
nullptr,
243 const DominatorTree *DT =
nullptr,
244 AssumptionCache *AC =
nullptr,
245 const Instruction *CxtI =
nullptr);
250 const DataLayout &DL,
251 const TargetLibraryInfo *TLI =
nullptr,
252 const DominatorTree *DT =
nullptr,
253 AssumptionCache *AC =
nullptr,
254 const Instruction *CxtI =
nullptr);
259 const DataLayout &DL,
260 const TargetLibraryInfo *TLI =
nullptr,
261 const DominatorTree *DT =
nullptr,
262 AssumptionCache *AC =
nullptr,
263 const Instruction *CxtI =
nullptr);
268 const TargetLibraryInfo *TLI =
nullptr,
269 const DominatorTree *DT =
nullptr,
270 AssumptionCache *AC =
nullptr,
271 const Instruction *CxtI =
nullptr);
279 const DataLayout &DL,
280 const TargetLibraryInfo *TLI =
nullptr,
281 const DominatorTree *DT =
nullptr,
282 AssumptionCache *AC =
nullptr,
283 const Instruction *CxtI =
nullptr);
287 Value *
SimplifyBinOp(
unsigned Opcode, Value *LHS, Value *RHS,
288 const DataLayout &DL,
289 const TargetLibraryInfo *TLI =
nullptr,
290 const DominatorTree *DT =
nullptr,
291 AssumptionCache *AC =
nullptr,
292 const Instruction *CxtI =
nullptr);
298 const FastMathFlags &FMF,
const DataLayout &DL,
299 const TargetLibraryInfo *TLI =
nullptr,
300 const DominatorTree *DT =
nullptr,
301 AssumptionCache *AC =
nullptr,
302 const Instruction *CxtI =
nullptr);
310 const TargetLibraryInfo *TLI =
nullptr,
311 const DominatorTree *DT =
nullptr,
312 AssumptionCache *AC =
nullptr,
313 const Instruction *CxtI =
nullptr);
319 Value *
SimplifyCall(Value *V, ArrayRef<Value *> Args,
const DataLayout &DL,
320 const TargetLibraryInfo *TLI =
nullptr,
321 const DominatorTree *DT =
nullptr,
322 AssumptionCache *AC =
nullptr,
323 const Instruction *CxtI =
nullptr);
328 const TargetLibraryInfo *TLI =
nullptr,
329 const DominatorTree *DT =
nullptr,
330 AssumptionCache *AC =
nullptr);
341 const TargetLibraryInfo *TLI =
nullptr,
342 const DominatorTree *DT =
nullptr,
343 AssumptionCache *AC =
nullptr);
352 const TargetLibraryInfo *TLI =
nullptr,
353 const DominatorTree *DT =
nullptr,
354 AssumptionCache *AC =
nullptr);
Value * SimplifyCall(Value *V, User::op_iterator ArgBegin, User::op_iterator ArgEnd, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
Given a function and iterators over arguments, see if we can fold the result.
Value * SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, Instruction *CxtI=nullptr)
SimplifyICmpInst - Given operands for an ICmpInst, see if we can fold the result. ...
Value * SimplifySDivInst(Value *LHS, Value *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifySDivInst - Given operands for an SDiv, see if we can fold the result.
Value * SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS, FastMathFlags FMF, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyFCmpInst - Given operands for an FCmpInst, see if we can fold the result. ...
Value * SimplifyAddInst(Value *LHS, Value *RHS, bool isNSW, bool isNUW, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyAddInst - Given operands for an Add, see if we can fold the result.
Value * SimplifyFSubInst(Value *LHS, Value *RHS, FastMathFlags FMF, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
Given operands for an FSub, see if we can fold the result.
Value * SimplifyFAddInst(Value *LHS, Value *RHS, FastMathFlags FMF, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
Given operands for an FAdd, see if we can fold the result.
Value * SimplifyFMulInst(Value *LHS, Value *RHS, FastMathFlags FMF, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
Given operands for an FMul, see if we can fold the result.
Value * SimplifyOrInst(Value *LHS, Value *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyOrInst - Given operands for an Or, see if we can fold the result.
Value * SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyShlInst - Given operands for a Shl, see if we can fold the result.
Value * SimplifyFPBinOp(unsigned Opcode, Value *LHS, Value *RHS, const FastMathFlags &FMF, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyFPBinOp - Given operands for a BinaryOperator, see if we can fold the result.
Value * SimplifySRemInst(Value *LHS, Value *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifySRemInst - Given operands for an SRem, see if we can fold the result.
Value * SimplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifySelectInst - Given operands for a SelectInst, see if we can fold the result.
bool recursivelySimplifyInstruction(Instruction *I, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr)
Recursively attempt to simplify an instruction.
Value * SimplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyCmpInst - Given operands for a CmpInst, see if we can fold the result.
Value * SimplifyGEPInst(ArrayRef< Value * > Ops, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyGEPInst - Given operands for an GetElementPtrInst, see if we can fold the result...
Value * SimplifyInsertValueInst(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyInsertValueInst - Given operands for an InsertValueInst, see if we can fold the result...
Value * SimplifyExtractElementInst(Value *Vec, Value *Idx, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
Given operands for an ExtractElementInst, see if we can fold the result.
Value * SimplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyBinOp - Given operands for a BinaryOperator, see if we can fold the result.
Value * SimplifySubInst(Value *LHS, Value *RHS, bool isNSW, bool isNUW, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifySubInst - Given operands for a Sub, see if we can fold the result.
Value * SimplifyTruncInst(Value *Op, Type *Ty, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyTruncInst - Given operands for an TruncInst, see if we can fold the result.
Value * SimplifyAndInst(Value *LHS, Value *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyAndInst - Given operands for an And, see if we can fold the result.
Value * SimplifyURemInst(Value *LHS, Value *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyURemInst - Given operands for a URem, see if we can fold the result.
Value * SimplifyMulInst(Value *LHS, Value *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyMulInst - Given operands for a Mul, see if we can fold the result.
Value * SimplifyExtractValueInst(Value *Agg, ArrayRef< unsigned > Idxs, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
Given operands for an ExtractValueInst, see if we can fold the result.
Value * SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyLShrInst - Given operands for a LShr, see if we can fold the result.
Value * SimplifyUDivInst(Value *LHS, Value *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyUDivInst - Given operands for a UDiv, see if we can fold the result.
Value * SimplifyXorInst(Value *LHS, Value *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyXorInst - Given operands for a Xor, see if we can fold the result.
Value * SimplifyFRemInst(Value *LHS, Value *RHS, FastMathFlags FMF, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyFRemInst - Given operands for an FRem, see if we can fold the result.
Value * SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyAShrInst - Given operands for a AShr, see if we can fold the result.
Value * SimplifyInstruction(Instruction *I, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr)
SimplifyInstruction - See if we can compute a simplified version of this instruction.
bool replaceAndRecursivelySimplify(Instruction *I, Value *SimpleV, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr)
Replace all uses of 'I' with 'SimpleV' and simplify the uses recursively.
Value * SimplifyFDivInst(Value *LHS, Value *RHS, FastMathFlags FMF, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr)
SimplifyFDivInst - Given operands for an FDiv, see if we can fold the result.