LLVM  9.0.0svn
LoopUtils.h
Go to the documentation of this file.
1 //===- llvm/Transforms/Utils/LoopUtils.h - Loop utilities -------*- 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 some loop transformation utilities.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
14 #define LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
15 
16 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/ADT/Optional.h"
18 #include "llvm/ADT/SetVector.h"
19 #include "llvm/ADT/SmallPtrSet.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/StringRef.h"
28 #include "llvm/IR/Dominators.h"
29 #include "llvm/IR/IRBuilder.h"
30 #include "llvm/IR/InstrTypes.h"
31 #include "llvm/IR/Operator.h"
32 #include "llvm/IR/ValueHandle.h"
33 #include "llvm/Support/Casting.h"
34 
35 namespace llvm {
36 
37 class AliasSet;
38 class AliasSetTracker;
39 class BasicBlock;
40 class DataLayout;
41 class Loop;
42 class LoopInfo;
43 class MemoryAccess;
44 class MemorySSAUpdater;
45 class OptimizationRemarkEmitter;
46 class PredicatedScalarEvolution;
47 class PredIteratorCache;
48 class ScalarEvolution;
49 class SCEV;
50 class TargetLibraryInfo;
51 class TargetTransformInfo;
52 
53 BasicBlock *InsertPreheaderForLoop(Loop *L, DominatorTree *DT, LoopInfo *LI,
54  bool PreserveLCSSA);
55 
56 /// Ensure that all exit blocks of the loop are dedicated exits.
57 ///
58 /// For any loop exit block with non-loop predecessors, we split the loop
59 /// predecessors to use a dedicated loop exit block. We update the dominator
60 /// tree and loop info if provided, and will preserve LCSSA if requested.
61 bool formDedicatedExitBlocks(Loop *L, DominatorTree *DT, LoopInfo *LI,
62  bool PreserveLCSSA);
63 
64 /// Ensures LCSSA form for every instruction from the Worklist in the scope of
65 /// innermost containing loop.
66 ///
67 /// For the given instruction which have uses outside of the loop, an LCSSA PHI
68 /// node is inserted and the uses outside the loop are rewritten to use this
69 /// node.
70 ///
71 /// LoopInfo and DominatorTree are required and, since the routine makes no
72 /// changes to CFG, preserved.
73 ///
74 /// Returns true if any modifications are made.
75 bool formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
76  DominatorTree &DT, LoopInfo &LI);
77 
78 /// Put loop into LCSSA form.
79 ///
80 /// Looks at all instructions in the loop which have uses outside of the
81 /// current loop. For each, an LCSSA PHI node is inserted and the uses outside
82 /// the loop are rewritten to use this node. Sub-loops must be in LCSSA form
83 /// already.
84 ///
85 /// LoopInfo and DominatorTree are required and preserved.
86 ///
87 /// If ScalarEvolution is passed in, it will be preserved.
88 ///
89 /// Returns true if any modifications are made to the loop.
90 bool formLCSSA(Loop &L, DominatorTree &DT, LoopInfo *LI, ScalarEvolution *SE);
91 
92 /// Put a loop nest into LCSSA form.
93 ///
94 /// This recursively forms LCSSA for a loop nest.
95 ///
96 /// LoopInfo and DominatorTree are required and preserved.
97 ///
98 /// If ScalarEvolution is passed in, it will be preserved.
99 ///
100 /// Returns true if any modifications are made to the loop.
101 bool formLCSSARecursively(Loop &L, DominatorTree &DT, LoopInfo *LI,
102  ScalarEvolution *SE);
103 
104 /// Walk the specified region of the CFG (defined by all blocks
105 /// dominated by the specified block, and that are in the current loop) in
106 /// reverse depth first order w.r.t the DominatorTree. This allows us to visit
107 /// uses before definitions, allowing us to sink a loop body in one pass without
108 /// iteration. Takes DomTreeNode, AliasAnalysis, LoopInfo, DominatorTree,
109 /// DataLayout, TargetLibraryInfo, Loop, AliasSet information for all
110 /// instructions of the loop and loop safety information as
111 /// arguments. Diagnostics is emitted via \p ORE. It returns changed status.
112 bool sinkRegion(DomTreeNode *, AliasAnalysis *, LoopInfo *, DominatorTree *,
113  TargetLibraryInfo *, TargetTransformInfo *, Loop *,
114  AliasSetTracker *, MemorySSAUpdater *, ICFLoopSafetyInfo *,
115  bool, int &, OptimizationRemarkEmitter *);
116 
117 /// Walk the specified region of the CFG (defined by all blocks
118 /// dominated by the specified block, and that are in the current loop) in depth
119 /// first order w.r.t the DominatorTree. This allows us to visit definitions
120 /// before uses, allowing us to hoist a loop body in one pass without iteration.
121 /// Takes DomTreeNode, AliasAnalysis, LoopInfo, DominatorTree, DataLayout,
122 /// TargetLibraryInfo, Loop, AliasSet information for all instructions of the
123 /// loop and loop safety information as arguments. Diagnostics is emitted via \p
124 /// ORE. It returns changed status.
125 bool hoistRegion(DomTreeNode *, AliasAnalysis *, LoopInfo *, DominatorTree *,
126  TargetLibraryInfo *, Loop *, AliasSetTracker *,
127  MemorySSAUpdater *, ICFLoopSafetyInfo *, bool, int &,
128  OptimizationRemarkEmitter *);
129 
130 /// This function deletes dead loops. The caller of this function needs to
131 /// guarantee that the loop is infact dead.
132 /// The function requires a bunch or prerequisites to be present:
133 /// - The loop needs to be in LCSSA form
134 /// - The loop needs to have a Preheader
135 /// - A unique dedicated exit block must exist
136 ///
137 /// This also updates the relevant analysis information in \p DT, \p SE, and \p
138 /// LI if pointers to those are provided.
139 /// It also updates the loop PM if an updater struct is provided.
140 
141 void deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE,
142  LoopInfo *LI);
143 
144 /// Try to promote memory values to scalars by sinking stores out of
145 /// the loop and moving loads to before the loop. We do this by looping over
146 /// the stores in the loop, looking for stores to Must pointers which are
147 /// loop invariant. It takes a set of must-alias values, Loop exit blocks
148 /// vector, loop exit blocks insertion point vector, PredIteratorCache,
149 /// LoopInfo, DominatorTree, Loop, AliasSet information for all instructions
150 /// of the loop and loop safety information as arguments.
151 /// Diagnostics is emitted via \p ORE. It returns changed status.
153  const SmallSetVector<Value *, 8> &, SmallVectorImpl<BasicBlock *> &,
154  SmallVectorImpl<Instruction *> &, SmallVectorImpl<MemoryAccess *> &,
155  PredIteratorCache &, LoopInfo *, DominatorTree *, const TargetLibraryInfo *,
156  Loop *, AliasSetTracker *, MemorySSAUpdater *, ICFLoopSafetyInfo *,
157  OptimizationRemarkEmitter *);
158 
159 /// Does a BFS from a given node to all of its children inside a given loop.
160 /// The returned vector of nodes includes the starting point.
161 SmallVector<DomTreeNode *, 16> collectChildrenInLoop(DomTreeNode *N,
162  const Loop *CurLoop);
163 
164 /// Returns the instructions that use values defined in the loop.
165 SmallVector<Instruction *, 8> findDefsUsedOutsideOfLoop(Loop *L);
166 
167 /// Find string metadata for loop
168 ///
169 /// If it has a value (e.g. {"llvm.distribute", 1} return the value as an
170 /// operand or null otherwise. If the string metadata is not found return
171 /// Optional's not-a-value.
172 Optional<const MDOperand *> findStringMetadataForLoop(const Loop *TheLoop,
173  StringRef Name);
174 
175 /// Find named metadata for a loop with an integer value.
176 llvm::Optional<int> getOptionalIntLoopAttribute(Loop *TheLoop, StringRef Name);
177 
178 /// Create a new loop identifier for a loop created from a loop transformation.
179 ///
180 /// @param OrigLoopID The loop ID of the loop before the transformation.
181 /// @param FollowupAttrs List of attribute names that contain attributes to be
182 /// added to the new loop ID.
183 /// @param InheritOptionsAttrsPrefix Selects which attributes should be inherited
184 /// from the original loop. The following values
185 /// are considered:
186 /// nullptr : Inherit all attributes from @p OrigLoopID.
187 /// "" : Do not inherit any attribute from @p OrigLoopID; only use
188 /// those specified by a followup attribute.
189 /// "<prefix>": Inherit all attributes except those which start with
190 /// <prefix>; commonly used to remove metadata for the
191 /// applied transformation.
192 /// @param AlwaysNew If true, do not try to reuse OrigLoopID and never return
193 /// None.
194 ///
195 /// @return The loop ID for the after-transformation loop. The following values
196 /// can be returned:
197 /// None : No followup attribute was found; it is up to the
198 /// transformation to choose attributes that make sense.
199 /// @p OrigLoopID: The original identifier can be reused.
200 /// nullptr : The new loop has no attributes.
201 /// MDNode* : A new unique loop identifier.
202 Optional<MDNode *>
203 makeFollowupLoopID(MDNode *OrigLoopID, ArrayRef<StringRef> FollowupAttrs,
204  const char *InheritOptionsAttrsPrefix = "",
205  bool AlwaysNew = false);
206 
207 /// Look for the loop attribute that disables all transformation heuristic.
208 bool hasDisableAllTransformsHint(const Loop *L);
209 
210 /// The mode sets how eager a transformation should be applied.
212  /// The pass can use heuristics to determine whether a transformation should
213  /// be applied.
215 
216  /// The transformation should be applied without considering a cost model.
218 
219  /// The transformation should not be applied.
221 
222  /// Force is a flag and should not be used alone.
223  TM_Force = 0x04,
224 
225  /// The transformation was directed by the user, e.g. by a #pragma in
226  /// the source code. If the transformation could not be applied, a
227  /// warning should be emitted.
229 
230  /// The transformation must not be applied. For instance, `#pragma clang loop
231  /// unroll(disable)` explicitly forbids any unrolling to take place. Unlike
232  /// general loop metadata, it must not be dropped. Most passes should not
233  /// behave differently under TM_Disable and TM_SuppressedByUser.
235 };
236 
237 /// @{
238 /// Get the mode for LLVM's supported loop transformations.
244 /// @}
245 
246 /// Set input string into loop metadata by keeping other values intact.
247 void addStringMetadataToLoop(Loop *TheLoop, const char *MDString,
248  unsigned V = 0);
249 
250 /// Get a loop's estimated trip count based on branch weight metadata.
251 /// Returns 0 when the count is estimated to be 0, or None when a meaningful
252 /// estimate can not be made.
254 
255 /// Check inner loop (L) backedge count is known to be invariant on all
256 /// iterations of its outer loop. If the loop has no parent, this is trivially
257 /// true.
259 
260 /// Helper to consistently add the set of standard passes to a loop pass's \c
261 /// AnalysisUsage.
262 ///
263 /// All loop passes should call this as part of implementing their \c
264 /// getAnalysisUsage.
266 
267 /// Returns true if is legal to hoist or sink this instruction disregarding the
268 /// possible introduction of faults. Reasoning about potential faulting
269 /// instructions is the responsibility of the caller since it is challenging to
270 /// do efficiently from within this routine.
271 /// \p TargetExecutesOncePerLoop is true only when it is guaranteed that the
272 /// target executes at most once per execution of the loop body. This is used
273 /// to assess the legality of duplicating atomic loads. Generally, this is
274 /// true when moving out of loop and not true when moving into loops.
275 /// If \p ORE is set use it to emit optimization remarks.
277  Loop *CurLoop, AliasSetTracker *CurAST,
278  MemorySSAUpdater *MSSAU, bool TargetExecutesOncePerLoop,
279  bool NoOfMemAccessesTooLarge,
280  int *LicmMssaOptCap = nullptr,
281  OptimizationRemarkEmitter *ORE = nullptr);
282 
283 /// Returns a Min/Max operation corresponding to MinMaxRecurrenceKind.
286  Value *Left, Value *Right);
287 
288 /// Generates an ordered vector reduction using extracts to reduce the value.
289 Value *
290 getOrderedReduction(IRBuilder<> &Builder, Value *Acc, Value *Src, unsigned Op,
293  ArrayRef<Value *> RedOps = None);
294 
295 /// Generates a vector reduction using shufflevectors to reduce the value.
296 Value *getShuffleReduction(IRBuilder<> &Builder, Value *Src, unsigned Op,
299  ArrayRef<Value *> RedOps = None);
300 
301 /// Create a target reduction of the given vector. The reduction operation
302 /// is described by the \p Opcode parameter. min/max reductions require
303 /// additional information supplied in \p Flags.
304 /// The target is queried to determine if intrinsics or shuffle sequences are
305 /// required to implement the reduction.
307  const TargetTransformInfo *TTI,
308  unsigned Opcode, Value *Src,
311  ArrayRef<Value *> RedOps = None);
312 
313 /// Create a generic target reduction using a recurrence descriptor \p Desc
314 /// The target is queried to determine if intrinsics or shuffle sequences are
315 /// required to implement the reduction.
317  RecurrenceDescriptor &Desc, Value *Src,
318  bool NoNaN = false);
319 
320 /// Get the intersection (logical and) of all of the potential IR flags
321 /// of each scalar operation (VL) that will be converted into a vector (I).
322 /// If OpValue is non-null, we only consider operations similar to OpValue
323 /// when intersecting.
324 /// Flag set: NSW, NUW, exact, and all of fast-math.
325 void propagateIRFlags(Value *I, ArrayRef<Value *> VL, Value *OpValue = nullptr);
326 
327 /// Returns true if we can prove that \p S is defined and always negative in
328 /// loop \p L.
329 bool isKnownNegativeInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE);
330 
331 /// Returns true if we can prove that \p S is defined and always non-negative in
332 /// loop \p L.
333 bool isKnownNonNegativeInLoop(const SCEV *S, const Loop *L,
334  ScalarEvolution &SE);
335 
336 /// Returns true if \p S is defined and never is equal to signed/unsigned max.
337 bool cannotBeMaxInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE,
338  bool Signed);
339 
340 /// Returns true if \p S is defined and never is equal to signed/unsigned min.
341 bool cannotBeMinInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE,
342  bool Signed);
343 
344 } // end namespace llvm
345 
346 #endif // LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
const NoneType None
Definition: None.h:23
bool promoteLoopAccessesToScalars(const SmallSetVector< Value *, 8 > &, SmallVectorImpl< BasicBlock *> &, SmallVectorImpl< Instruction *> &, SmallVectorImpl< MemoryAccess *> &, PredIteratorCache &, LoopInfo *, DominatorTree *, const TargetLibraryInfo *, Loop *, AliasSetTracker *, MemorySSAUpdater *, ICFLoopSafetyInfo *, OptimizationRemarkEmitter *)
Try to promote memory values to scalars by sinking stores out of the loop and moving loads to before ...
Definition: LICM.cpp:1819
This class represents lattice values for constants.
Definition: AllocatorList.h:23
Various leaf nodes.
Definition: ISDOpcodes.h:59
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
bool cannotBeMinInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE, bool Signed)
Returns true if S is defined and never is equal to signed/unsigned min.
Definition: LoopUtils.cpp:951
The main scalar evolution driver.
bool isKnownNonNegativeInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE)
Returns true if we can prove that S is defined and always non-negative in loop L. ...
Definition: LoopUtils.cpp:944
BasicBlock * InsertPreheaderForLoop(Loop *L, DominatorTree *DT, LoopInfo *LI, bool PreserveLCSSA)
InsertPreheaderForLoop - Once we discover that a loop doesn&#39;t have a preheader, this method is called...
bool sinkRegion(DomTreeNode *, AliasAnalysis *, LoopInfo *, DominatorTree *, TargetLibraryInfo *, TargetTransformInfo *, Loop *, AliasSetTracker *, MemorySSAUpdater *, ICFLoopSafetyInfo *, bool, int &, OptimizationRemarkEmitter *)
Walk the specified region of the CFG (defined by all blocks dominated by the specified block...
Definition: LICM.cpp:463
Value * createSimpleTargetReduction(IRBuilder<> &B, const TargetTransformInfo *TTI, unsigned Opcode, Value *Src, TargetTransformInfo::ReductionFlags Flags=TargetTransformInfo::ReductionFlags(), ArrayRef< Value *> RedOps=None)
Create a target reduction of the given vector.
Definition: LoopUtils.cpp:803
bool hasIterationCountInvariantInParent(Loop *L, ScalarEvolution &SE)
Check inner loop (L) backedge count is known to be invariant on all iterations of its outer loop...
Definition: LoopUtils.cpp:651
Value * getShuffleReduction(IRBuilder<> &Builder, Value *Src, unsigned Op, RecurrenceDescriptor::MinMaxRecurrenceKind MinMaxKind=RecurrenceDescriptor::MRK_Invalid, ArrayRef< Value *> RedOps=None)
Generates a vector reduction using shufflevectors to reduce the value.
Definition: LoopUtils.cpp:761
bool isKnownNegativeInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE)
Returns true if we can prove that S is defined and always negative in loop L.
Definition: LoopUtils.cpp:937
bool formLCSSARecursively(Loop &L, DominatorTree &DT, LoopInfo *LI, ScalarEvolution *SE)
Put a loop nest into LCSSA form.
Definition: LCSSA.cpp:383
TransformationMode hasUnrollAndJamTransformation(Loop *L)
Definition: LoopUtils.cpp:354
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition: IRBuilder.h:742
Contains a collection of routines for determining if a given instruction is guaranteed to execute if ...
SmallVector< Instruction *, 8 > findDefsUsedOutsideOfLoop(Loop *L)
Returns the instructions that use values defined in the loop.
Definition: LoopUtils.cpp:116
The transformation should be applied without considering a cost model.
Definition: LoopUtils.h:217
void deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE, LoopInfo *LI)
This function deletes dead loops.
Definition: LoopUtils.cpp:448
Value * getOrderedReduction(IRBuilder<> &Builder, Value *Acc, Value *Src, unsigned Op, RecurrenceDescriptor::MinMaxRecurrenceKind MinMaxKind=RecurrenceDescriptor::MRK_Invalid, ArrayRef< Value *> RedOps=None)
Generates an ordered vector reduction using extracts to reduce the value.
Definition: LoopUtils.cpp:730
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
void addStringMetadataToLoop(Loop *TheLoop, const char *MDString, unsigned V=0)
Set input string into loop metadata by keeping other values intact.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Definition: Dominators.h:144
The transformation must not be applied.
Definition: LoopUtils.h:234
bool formLCSSAForInstructions(SmallVectorImpl< Instruction *> &Worklist, DominatorTree &DT, LoopInfo &LI)
Ensures LCSSA form for every instruction from the Worklist in the scope of innermost containing loop...
Definition: LCSSA.cpp:74
AAResults AliasAnalysis
Temporary typedef for legacy code that uses a generic AliasAnalysis pointer or reference.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::Optional< int > getOptionalIntLoopAttribute(Loop *TheLoop, StringRef Name)
Find named metadata for a loop with an integer value.
Definition: LoopUtils.cpp:234
Flags describing the kind of vector reduction.
Value * createMinMaxOp(IRBuilder<> &Builder, RecurrenceDescriptor::MinMaxRecurrenceKind RK, Value *Left, Value *Right)
Returns a Min/Max operation corresponding to MinMaxRecurrenceKind.
Definition: LoopUtils.cpp:683
Represent the analysis usage information of a pass.
TransformationMode hasDistributeTransformation(Loop *L)
Definition: LoopUtils.cpp:407
TransformationMode hasVectorizeTransformation(Loop *L)
Definition: LoopUtils.cpp:372
Optional< unsigned > getLoopEstimatedTripCount(Loop *L)
Get a loop&#39;s estimated trip count based on branch weight metadata.
Definition: LoopUtils.cpp:618
void propagateIRFlags(Value *I, ArrayRef< Value *> VL, Value *OpValue=nullptr)
Get the intersection (logical and) of all of the potential IR flags of each scalar operation (VL) tha...
Definition: LoopUtils.cpp:918
The transformation should not be applied.
Definition: LoopUtils.h:220
The RecurrenceDescriptor is used to identify recurrences variables in a loop.
Definition: IVDescriptors.h:62
bool formLCSSA(Loop &L, DominatorTree &DT, LoopInfo *LI, ScalarEvolution *SE)
Put loop into LCSSA form.
Definition: LCSSA.cpp:318
The pass can use heuristics to determine whether a transformation should be applied.
Definition: LoopUtils.h:214
The transformation was directed by the user, e.g.
Definition: LoopUtils.h:228
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Force is a flag and should not be used alone.
Definition: LoopUtils.h:223
Value * createTargetReduction(IRBuilder<> &B, const TargetTransformInfo *TTI, RecurrenceDescriptor &Desc, Value *Src, bool NoNaN=false)
Create a generic target reduction using a recurrence descriptor Desc The target is queried to determi...
Definition: LoopUtils.cpp:879
Optional< MDNode * > makeFollowupLoopID(MDNode *OrigLoopID, ArrayRef< StringRef > FollowupAttrs, const char *InheritOptionsAttrsPrefix="", bool AlwaysNew=false)
Create a new loop identifier for a loop created from a loop transformation.
Definition: LoopUtils.cpp:248
bool hoistRegion(DomTreeNode *, AliasAnalysis *, LoopInfo *, DominatorTree *, TargetLibraryInfo *, Loop *, AliasSetTracker *, MemorySSAUpdater *, ICFLoopSafetyInfo *, bool, int &, OptimizationRemarkEmitter *)
Walk the specified region of the CFG (defined by all blocks dominated by the specified block...
Definition: LICM.cpp:763
static cl::opt< int > LicmMssaOptCap("licm-mssa-optimization-cap", cl::init(100), cl::Hidden, cl::desc("Enable imprecision in LICM in pathological cases, in exchange " "for faster compile. Caps the MemorySSA clobbering calls."))
This class represents an analyzed expression in the program.
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:464
#define I(x, y, z)
Definition: MD5.cpp:58
#define N
Optional< const MDOperand * > findStringMetadataForLoop(const Loop *TheLoop, StringRef Name)
Find string metadata for loop.
Definition: LoopUtils.cpp:197
TransformationMode hasUnrollTransformation(Loop *L)
Definition: LoopUtils.cpp:333
void getLoopAnalysisUsage(AnalysisUsage &AU)
Helper to consistently add the set of standard passes to a loop pass&#39;s AnalysisUsage.
Definition: LoopUtils.cpp:134
TransformationMode
The mode sets how eager a transformation should be applied.
Definition: LoopUtils.h:211
SmallVector< DomTreeNode *, 16 > collectChildrenInLoop(DomTreeNode *N, const Loop *CurLoop)
Does a BFS from a given node to all of its children inside a given loop.
Definition: LoopUtils.cpp:430
TransformationMode hasLICMVersioningTransformation(Loop *L)
Definition: LoopUtils.cpp:417
DomTreeNodeBase< BasicBlock > DomTreeNode
Definition: Dominators.h:74
LLVM Value Representation.
Definition: Value.h:72
bool canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT, Loop *CurLoop, AliasSetTracker *CurAST, MemorySSAUpdater *MSSAU, bool TargetExecutesOncePerLoop, bool NoOfMemAccessesTooLarge, int *LicmMssaOptCap=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
Returns true if is legal to hoist or sink this instruction disregarding the possible introduction of ...
Definition: LICM.cpp:1049
bool formDedicatedExitBlocks(Loop *L, DominatorTree *DT, LoopInfo *LI, bool PreserveLCSSA)
Ensure that all exit blocks of the loop are dedicated exits.
Definition: LoopUtils.cpp:48
A single uniqued string.
Definition: Metadata.h:603
bool cannotBeMaxInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE, bool Signed)
Returns true if S is defined and never is equal to signed/unsigned max.
Definition: LoopUtils.cpp:962
This pass exposes codegen information to IR-level passes.
bool hasDisableAllTransformsHint(const Loop *L)
Look for the loop attribute that disables all transformation heuristic.
Definition: LoopUtils.cpp:329
The optimization diagnostic interface.