LLVM 17.0.0git
InstructionSimplify.h
Go to the documentation of this file.
1//===-- InstructionSimplify.h - Fold instrs into simpler forms --*- 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 declares routines for folding instructions into simpler forms
10// that do not require creating new instructions. This does constant folding
11// ("add i32 1, 1" -> "2") but can also handle non-constant operands, either
12// returning a constant ("and i32 %x, 0" -> "0") or an already existing value
13// ("and i32 %x, %x" -> "%x"). If the simplification is also an instruction
14// then it dominates the original instruction.
15//
16// These routines implicitly resolve undef uses. The easiest way to be safe when
17// using these routines to obtain simplified values for existing instructions is
18// to always replace all uses of the instructions with the resulting simplified
19// values. This will prevent other code from seeing the same undef uses and
20// resolving them to different values.
21//
22// These routines are designed to tolerate moderately incomplete IR, such as
23// instructions that are not connected to basic blocks yet. However, they do
24// require that all the IR that they encounter be valid. In particular, they
25// require that all non-constant values be defined in the same function, and the
26// same call context of that function (and not split between caller and callee
27// contexts of a directly recursive call, for example).
28//
29// Additionally, these routines can't simplify to the instructions that are not
30// def-reachable, meaning we can't just scan the basic block for instructions
31// to simplify to.
32//
33//===----------------------------------------------------------------------===//
34
35#ifndef LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
36#define LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
37
39
40namespace llvm {
41
42template <typename T, typename... TArgs> class AnalysisManager;
43template <class T> class ArrayRef;
44class AssumptionCache;
45class BinaryOperator;
46class CallBase;
47class DataLayout;
48class DominatorTree;
49class Function;
50class Instruction;
51struct LoopStandardAnalysisResults;
52class MDNode;
53class OptimizationRemarkEmitter;
54class Pass;
55template <class T, unsigned n> class SmallSetVector;
56class TargetLibraryInfo;
57class Type;
58class Value;
59
60/// InstrInfoQuery provides an interface to query additional information for
61/// instructions like metadata or keywords like nsw, which provides conservative
62/// results if the users specified it is safe to use.
64 InstrInfoQuery(bool UMD) : UseInstrInfo(UMD) {}
65 InstrInfoQuery() = default;
66 bool UseInstrInfo = true;
67
68 MDNode *getMetadata(const Instruction *I, unsigned KindID) const {
69 if (UseInstrInfo)
70 return I->getMetadata(KindID);
71 return nullptr;
72 }
73
74 template <class InstT> bool hasNoUnsignedWrap(const InstT *Op) const {
75 if (UseInstrInfo)
76 return Op->hasNoUnsignedWrap();
77 return false;
78 }
79
80 template <class InstT> bool hasNoSignedWrap(const InstT *Op) const {
81 if (UseInstrInfo)
82 return Op->hasNoSignedWrap();
83 return false;
84 }
85
86 bool isExact(const BinaryOperator *Op) const {
87 if (UseInstrInfo && isa<PossiblyExactOperator>(Op))
88 return cast<PossiblyExactOperator>(Op)->isExact();
89 return false;
90 }
91};
92
94 const DataLayout &DL;
95 const TargetLibraryInfo *TLI = nullptr;
96 const DominatorTree *DT = nullptr;
97 AssumptionCache *AC = nullptr;
98 const Instruction *CxtI = nullptr;
99
100 // Wrapper to query additional information for instructions like metadata or
101 // keywords like nsw, which provides conservative results if those cannot
102 // be safely used.
104
105 /// Controls whether simplifications are allowed to constrain the range of
106 /// possible values for uses of undef. If it is false, simplifications are not
107 /// allowed to assume a particular value for a use of undef for example.
108 bool CanUseUndef = true;
109
110 SimplifyQuery(const DataLayout &DL, const Instruction *CXTI = nullptr)
111 : DL(DL), CxtI(CXTI) {}
112
114 const DominatorTree *DT = nullptr,
115 AssumptionCache *AC = nullptr,
116 const Instruction *CXTI = nullptr, bool UseInstrInfo = true,
117 bool CanUseUndef = true)
118 : DL(DL), TLI(TLI), DT(DT), AC(AC), CxtI(CXTI), IIQ(UseInstrInfo),
121 SimplifyQuery Copy(*this);
122 Copy.CxtI = I;
123 return Copy;
124 }
126 SimplifyQuery Copy(*this);
127 Copy.CanUseUndef = false;
128 return Copy;
129 }
130
131 /// If CanUseUndef is true, returns whether \p V is undef.
132 /// Otherwise always return false.
133 bool isUndefValue(Value *V) const {
134 if (!CanUseUndef)
135 return false;
136
137 using namespace PatternMatch;
138 return match(V, m_Undef());
139 }
140};
141
142// NOTE: the explicit multiple argument versions of these functions are
143// deprecated.
144// Please use the SimplifyQuery versions in new code.
145
146/// Given operands for an Add, fold the result or return null.
147Value *simplifyAddInst(Value *LHS, Value *RHS, bool IsNSW, bool IsNUW,
148 const SimplifyQuery &Q);
149
150/// Given operands for a Sub, fold the result or return null.
151Value *simplifySubInst(Value *LHS, Value *RHS, bool IsNSW, bool IsNUW,
152 const SimplifyQuery &Q);
153
154/// Given operands for a Mul, fold the result or return null.
155Value *simplifyMulInst(Value *LHS, Value *RHS, bool IsNSW, bool IsNUW,
156 const SimplifyQuery &Q);
157
158/// Given operands for an SDiv, fold the result or return null.
159Value *simplifySDivInst(Value *LHS, Value *RHS, bool IsExact,
160 const SimplifyQuery &Q);
161
162/// Given operands for a UDiv, fold the result or return null.
163Value *simplifyUDivInst(Value *LHS, Value *RHS, bool IsExact,
164 const SimplifyQuery &Q);
165
166/// Given operands for an SRem, fold the result or return null.
167Value *simplifySRemInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
168
169/// Given operands for a URem, fold the result or return null.
170Value *simplifyURemInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
171
172/// Given operand for an FNeg, fold the result or return null.
173Value *simplifyFNegInst(Value *Op, FastMathFlags FMF, const SimplifyQuery &Q);
174
175
176/// Given operands for an FAdd, fold the result or return null.
177Value *
178simplifyFAddInst(Value *LHS, Value *RHS, FastMathFlags FMF,
179 const SimplifyQuery &Q,
182
183/// Given operands for an FSub, fold the result or return null.
184Value *
185simplifyFSubInst(Value *LHS, Value *RHS, FastMathFlags FMF,
186 const SimplifyQuery &Q,
189
190/// Given operands for an FMul, fold the result or return null.
191Value *
192simplifyFMulInst(Value *LHS, Value *RHS, FastMathFlags FMF,
193 const SimplifyQuery &Q,
196
197/// Given operands for the multiplication of a FMA, fold the result or return
198/// null. In contrast to simplifyFMulInst, this function will not perform
199/// simplifications whose unrounded results differ when rounded to the argument
200/// type.
201Value *simplifyFMAFMul(Value *LHS, Value *RHS, FastMathFlags FMF,
202 const SimplifyQuery &Q,
205
206/// Given operands for an FDiv, fold the result or return null.
207Value *
208simplifyFDivInst(Value *LHS, Value *RHS, FastMathFlags FMF,
209 const SimplifyQuery &Q,
212
213/// Given operands for an FRem, fold the result or return null.
214Value *
215simplifyFRemInst(Value *LHS, Value *RHS, FastMathFlags FMF,
216 const SimplifyQuery &Q,
219
220/// Given operands for a Shl, fold the result or return null.
221Value *simplifyShlInst(Value *Op0, Value *Op1, bool IsNSW, bool IsNUW,
222 const SimplifyQuery &Q);
223
224/// Given operands for a LShr, fold the result or return null.
225Value *simplifyLShrInst(Value *Op0, Value *Op1, bool IsExact,
226 const SimplifyQuery &Q);
227
228/// Given operands for a AShr, fold the result or return nulll.
229Value *simplifyAShrInst(Value *Op0, Value *Op1, bool IsExact,
230 const SimplifyQuery &Q);
231
232/// Given operands for an And, fold the result or return null.
233Value *simplifyAndInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
234
235/// Given operands for an Or, fold the result or return null.
236Value *simplifyOrInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
237
238/// Given operands for an Xor, fold the result or return null.
239Value *simplifyXorInst(Value *LHS, Value *RHS, const SimplifyQuery &Q);
240
241/// Given operands for an ICmpInst, fold the result or return null.
242Value *simplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
243 const SimplifyQuery &Q);
244
245/// Given operands for an FCmpInst, fold the result or return null.
246Value *simplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
247 FastMathFlags FMF, const SimplifyQuery &Q);
248
249/// Given operands for a SelectInst, fold the result or return null.
250Value *simplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal,
251 const SimplifyQuery &Q);
252
253/// Given operands for a GetElementPtrInst, fold the result or return null.
254Value *simplifyGEPInst(Type *SrcTy, Value *Ptr, ArrayRef<Value *> Indices,
255 bool InBounds, const SimplifyQuery &Q);
256
257/// Given operands for an InsertValueInst, fold the result or return null.
258Value *simplifyInsertValueInst(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
259 const SimplifyQuery &Q);
260
261/// Given operands for an InsertElement, fold the result or return null.
262Value *simplifyInsertElementInst(Value *Vec, Value *Elt, Value *Idx,
263 const SimplifyQuery &Q);
264
265/// Given operands for an ExtractValueInst, fold the result or return null.
266Value *simplifyExtractValueInst(Value *Agg, ArrayRef<unsigned> Idxs,
267 const SimplifyQuery &Q);
268
269/// Given operands for an ExtractElementInst, fold the result or return null.
270Value *simplifyExtractElementInst(Value *Vec, Value *Idx,
271 const SimplifyQuery &Q);
272
273/// Given operands for a CastInst, fold the result or return null.
274Value *simplifyCastInst(unsigned CastOpc, Value *Op, Type *Ty,
275 const SimplifyQuery &Q);
276
277/// Given operands for a ShuffleVectorInst, fold the result or return null.
278/// See class ShuffleVectorInst for a description of the mask representation.
279Value *simplifyShuffleVectorInst(Value *Op0, Value *Op1, ArrayRef<int> Mask,
280 Type *RetTy, const SimplifyQuery &Q);
281
282//=== Helper functions for higher up the class hierarchy.
283
284/// Given operands for a CmpInst, fold the result or return null.
285Value *simplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
286 const SimplifyQuery &Q);
287
288/// Given operand for a UnaryOperator, fold the result or return null.
289Value *simplifyUnOp(unsigned Opcode, Value *Op, const SimplifyQuery &Q);
290
291/// Given operand for a UnaryOperator, fold the result or return null.
292/// Try to use FastMathFlags when folding the result.
293Value *simplifyUnOp(unsigned Opcode, Value *Op, FastMathFlags FMF,
294 const SimplifyQuery &Q);
295
296/// Given operands for a BinaryOperator, fold the result or return null.
297Value *simplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS,
298 const SimplifyQuery &Q);
299
300/// Given operands for a BinaryOperator, fold the result or return null.
301/// Try to use FastMathFlags when folding the result.
302Value *simplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS, FastMathFlags FMF,
303 const SimplifyQuery &Q);
304
305/// Given a callsite, fold the result or return null.
306Value *simplifyCall(CallBase *Call, const SimplifyQuery &Q);
307
308/// Given a constrained FP intrinsic call, tries to compute its simplified
309/// version. Returns a simplified result or null.
310///
311/// This function provides an additional contract: it guarantees that if
312/// simplification succeeds that the intrinsic is side effect free. As a result,
313/// successful simplification can be used to delete the intrinsic not just
314/// replace its result.
315Value *simplifyConstrainedFPCall(CallBase *Call, const SimplifyQuery &Q);
316
317/// Given an operand for a Freeze, see if we can fold the result.
318/// If not, this returns null.
319Value *simplifyFreezeInst(Value *Op, const SimplifyQuery &Q);
320
321/// See if we can compute a simplified version of this instruction. If not,
322/// return null.
323Value *simplifyInstruction(Instruction *I, const SimplifyQuery &Q,
324 OptimizationRemarkEmitter *ORE = nullptr);
325
326/// Like \p simplifyInstruction but the operands of \p I are replaced with
327/// \p NewOps. Returns a simplified value, or null if none was found.
328Value *
329simplifyInstructionWithOperands(Instruction *I, ArrayRef<Value *> NewOps,
330 const SimplifyQuery &Q,
331 OptimizationRemarkEmitter *ORE = nullptr);
332
333/// See if V simplifies when its operand Op is replaced with RepOp. If not,
334/// return null.
335/// AllowRefinement specifies whether the simplification can be a refinement
336/// (e.g. 0 instead of poison), or whether it needs to be strictly identical.
337Value *simplifyWithOpReplaced(Value *V, Value *Op, Value *RepOp,
338 const SimplifyQuery &Q, bool AllowRefinement);
339
340/// Replace all uses of 'I' with 'SimpleV' and simplify the uses recursively.
341///
342/// This first performs a normal RAUW of I with SimpleV. It then recursively
343/// attempts to simplify those users updated by the operation. The 'I'
344/// instruction must not be equal to the simplified value 'SimpleV'.
345/// If UnsimplifiedUsers is provided, instructions that could not be simplified
346/// are added to it.
347///
348/// The function returns true if any simplifications were performed.
350 Instruction *I, Value *SimpleV, const TargetLibraryInfo *TLI = nullptr,
351 const DominatorTree *DT = nullptr, AssumptionCache *AC = nullptr,
352 SmallSetVector<Instruction *, 8> *UnsimplifiedUsers = nullptr);
353
354// These helper functions return a SimplifyQuery structure that contains as
355// many of the optional analysis we use as are currently valid. This is the
356// strongly preferred way of constructing SimplifyQuery in passes.
357const SimplifyQuery getBestSimplifyQuery(Pass &, Function &);
358template <class T, class... TArgs>
359const SimplifyQuery getBestSimplifyQuery(AnalysisManager<T, TArgs...> &,
360 Function &);
361const SimplifyQuery getBestSimplifyQuery(LoopStandardAnalysisResults &,
362 const DataLayout &);
363} // end namespace llvm
364
365#endif
SmallVector< MachineOperand, 4 > Cond
RelocType Type
Definition: COFFYAML.cpp:390
return RetTy
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
print lazy value Lazy Value Info Printer Pass
#define I(x, y, z)
Definition: MD5.cpp:58
#define T
Value * RHS
Value * LHS
A cache of @llvm.assume calls within a function.
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:114
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:166
Metadata node.
Definition: Metadata.h:943
Provides information about what library functions are available for the current target.
LLVM Value Representation.
Definition: Value.h:74
bool match(Val *V, const Pattern &P)
Definition: PatternMatch.h:49
auto m_Undef()
Match an arbitrary undef constant.
Definition: PatternMatch.h:136
ExceptionBehavior
Exception behavior used for floating point operations.
Definition: FPEnv.h:38
@ ebIgnore
This corresponds to "fpexcept.ignore".
Definition: FPEnv.h:39
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Value * simplifyAShrInst(Value *Op0, Value *Op1, bool IsExact, const SimplifyQuery &Q)
Given operands for a AShr, fold the result or return nulll.
Value * simplifyFMulInst(Value *LHS, Value *RHS, FastMathFlags FMF, const SimplifyQuery &Q, fp::ExceptionBehavior ExBehavior=fp::ebIgnore, RoundingMode Rounding=RoundingMode::NearestTiesToEven)
Given operands for an FMul, fold the result or return null.
Value * simplifyFreezeInst(Value *Op, const SimplifyQuery &Q)
Given an operand for a Freeze, see if we can fold the result.
Value * simplifySDivInst(Value *LHS, Value *RHS, bool IsExact, const SimplifyQuery &Q)
Given operands for an SDiv, fold the result or return null.
Value * simplifyUnOp(unsigned Opcode, Value *Op, const SimplifyQuery &Q)
Given operand for a UnaryOperator, fold the result or return null.
Value * simplifyCall(CallBase *Call, const SimplifyQuery &Q)
Given a callsite, fold the result or return null.
Value * simplifyInstructionWithOperands(Instruction *I, ArrayRef< Value * > NewOps, const SimplifyQuery &Q, OptimizationRemarkEmitter *ORE=nullptr)
Like simplifyInstruction but the operands of I are replaced with NewOps.
Value * simplifyMulInst(Value *LHS, Value *RHS, bool IsNSW, bool IsNUW, const SimplifyQuery &Q)
Given operands for a Mul, fold the result or return null.
Value * simplifyShuffleVectorInst(Value *Op0, Value *Op1, ArrayRef< int > Mask, Type *RetTy, const SimplifyQuery &Q)
Given operands for a ShuffleVectorInst, fold the result or return null.
Value * simplifyOrInst(Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for an Or, fold the result or return null.
Value * simplifyXorInst(Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for an Xor, fold the result or return null.
Value * simplifyCastInst(unsigned CastOpc, Value *Op, Type *Ty, const SimplifyQuery &Q)
Given operands for a CastInst, fold the result or return null.
Value * simplifySubInst(Value *LHS, Value *RHS, bool IsNSW, bool IsNUW, const SimplifyQuery &Q)
Given operands for a Sub, fold the result or return null.
Value * simplifyAddInst(Value *LHS, Value *RHS, bool IsNSW, bool IsNUW, const SimplifyQuery &Q)
Given operands for an Add, fold the result or return null.
bool replaceAndRecursivelySimplify(Instruction *I, Value *SimpleV, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, SmallSetVector< Instruction *, 8 > *UnsimplifiedUsers=nullptr)
Replace all uses of 'I' with 'SimpleV' and simplify the uses recursively.
Value * simplifyShlInst(Value *Op0, Value *Op1, bool IsNSW, bool IsNUW, const SimplifyQuery &Q)
Given operands for a Shl, fold the result or return null.
Value * simplifyFNegInst(Value *Op, FastMathFlags FMF, const SimplifyQuery &Q)
Given operand for an FNeg, fold the result or return null.
Value * simplifyFSubInst(Value *LHS, Value *RHS, FastMathFlags FMF, const SimplifyQuery &Q, fp::ExceptionBehavior ExBehavior=fp::ebIgnore, RoundingMode Rounding=RoundingMode::NearestTiesToEven)
Given operands for an FSub, fold the result or return null.
Value * simplifyFRemInst(Value *LHS, Value *RHS, FastMathFlags FMF, const SimplifyQuery &Q, fp::ExceptionBehavior ExBehavior=fp::ebIgnore, RoundingMode Rounding=RoundingMode::NearestTiesToEven)
Given operands for an FRem, fold the result or return null.
Value * simplifyFAddInst(Value *LHS, Value *RHS, FastMathFlags FMF, const SimplifyQuery &Q, fp::ExceptionBehavior ExBehavior=fp::ebIgnore, RoundingMode Rounding=RoundingMode::NearestTiesToEven)
Given operands for an FAdd, fold the result or return null.
Value * simplifyLShrInst(Value *Op0, Value *Op1, bool IsExact, const SimplifyQuery &Q)
Given operands for a LShr, fold the result or return null.
Value * simplifyAndInst(Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for an And, fold the result or return null.
Value * simplifyExtractValueInst(Value *Agg, ArrayRef< unsigned > Idxs, const SimplifyQuery &Q)
Given operands for an ExtractValueInst, fold the result or return null.
Value * simplifyInsertValueInst(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, const SimplifyQuery &Q)
Given operands for an InsertValueInst, fold the result or return null.
Value * simplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for an ICmpInst, fold the result or return null.
Value * simplifyFDivInst(Value *LHS, Value *RHS, FastMathFlags FMF, const SimplifyQuery &Q, fp::ExceptionBehavior ExBehavior=fp::ebIgnore, RoundingMode Rounding=RoundingMode::NearestTiesToEven)
Given operands for an FDiv, fold the result or return null.
Value * simplifyFMAFMul(Value *LHS, Value *RHS, FastMathFlags FMF, const SimplifyQuery &Q, fp::ExceptionBehavior ExBehavior=fp::ebIgnore, RoundingMode Rounding=RoundingMode::NearestTiesToEven)
Given operands for the multiplication of a FMA, fold the result or return null.
Value * simplifyConstrainedFPCall(CallBase *Call, const SimplifyQuery &Q)
Given a constrained FP intrinsic call, tries to compute its simplified version.
Value * simplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for a BinaryOperator, fold the result or return null.
Value * simplifyInstruction(Instruction *I, const SimplifyQuery &Q, OptimizationRemarkEmitter *ORE=nullptr)
See if we can compute a simplified version of this instruction.
Value * simplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for a CmpInst, fold the result or return null.
Value * simplifyUDivInst(Value *LHS, Value *RHS, bool IsExact, const SimplifyQuery &Q)
Given operands for a UDiv, fold the result or return null.
RoundingMode
Rounding mode.
@ NearestTiesToEven
roundTiesToEven.
ArrayRef(const T &OneElt) -> ArrayRef< T >
Value * simplifyInsertElementInst(Value *Vec, Value *Elt, Value *Idx, const SimplifyQuery &Q)
Given operands for an InsertElement, fold the result or return null.
Value * simplifySRemInst(Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for an SRem, fold the result or return null.
const SimplifyQuery getBestSimplifyQuery(Pass &, Function &)
Value * simplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS, FastMathFlags FMF, const SimplifyQuery &Q)
Given operands for an FCmpInst, fold the result or return null.
Value * simplifyGEPInst(Type *SrcTy, Value *Ptr, ArrayRef< Value * > Indices, bool InBounds, const SimplifyQuery &Q)
Given operands for a GetElementPtrInst, fold the result or return null.
Value * simplifyWithOpReplaced(Value *V, Value *Op, Value *RepOp, const SimplifyQuery &Q, bool AllowRefinement)
See if V simplifies when its operand Op is replaced with RepOp.
Value * simplifyURemInst(Value *LHS, Value *RHS, const SimplifyQuery &Q)
Given operands for a URem, fold the result or return null.
Value * simplifyExtractElementInst(Value *Vec, Value *Idx, const SimplifyQuery &Q)
Given operands for an ExtractElementInst, fold the result or return null.
Value * simplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal, const SimplifyQuery &Q)
Given operands for a SelectInst, fold the result or return null.
InstrInfoQuery provides an interface to query additional information for instructions like metadata o...
bool isExact(const BinaryOperator *Op) const
MDNode * getMetadata(const Instruction *I, unsigned KindID) const
bool hasNoSignedWrap(const InstT *Op) const
InstrInfoQuery()=default
bool hasNoUnsignedWrap(const InstT *Op) const
const DataLayout & DL
const Instruction * CxtI
SimplifyQuery(const DataLayout &DL, const Instruction *CXTI=nullptr)
bool CanUseUndef
Controls whether simplifications are allowed to constrain the range of possible values for uses of un...
const DominatorTree * DT
bool isUndefValue(Value *V) const
If CanUseUndef is true, returns whether V is undef.
AssumptionCache * AC
SimplifyQuery getWithInstruction(Instruction *I) const
const TargetLibraryInfo * TLI
SimplifyQuery(const DataLayout &DL, const TargetLibraryInfo *TLI, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr, const Instruction *CXTI=nullptr, bool UseInstrInfo=true, bool CanUseUndef=true)
SimplifyQuery getWithoutUndef() const
const InstrInfoQuery IIQ