9#ifndef LLVM_TRANSFORMS_UTILS_LOOP_CONSTRAINER_H
10#define LLVM_TRANSFORMS_UTILS_LOOP_CONSTRAINER_H
68 Result.Header = cast<BasicBlock>(Map(
Header));
69 Result.Latch = cast<BasicBlock>(Map(
Latch));
70 Result.LatchBr = cast<BranchInst>(Map(
LatchBr));
71 Result.LatchExit = cast<BasicBlock>(Map(
LatchExit));
83 static std::optional<LoopStructure>
113 std::vector<BasicBlock *>
Blocks;
124 struct RewrittenRangeInfo {
127 std::vector<PHINode *> PHIValuesAtPseudoExit;
130 RewrittenRangeInfo() =
default;
137 void cloneLoop(ClonedLoop &CLResult,
const char *
Tag)
const;
141 Loop *createClonedLoopStructure(Loop *Original, Loop *Parent,
166 changeIterationSpaceEnd(
const LoopStructure &LS, BasicBlock *Preheader,
168 BasicBlock *ContinuationBlock)
const;
172 BasicBlock *createPreheader(
const LoopStructure &LS, BasicBlock *OldPreheader,
173 const char *
Tag)
const;
179 void rewriteIncomingValuesForPHIs(
180 LoopStructure &LS, BasicBlock *ContinuationBlockAndPreheader,
181 const LoopConstrainer::RewrittenRangeInfo &RRI)
const;
187 void addToParentLoopIfNeeded(ArrayRef<BasicBlock *> BBs);
195 function_ref<void(Loop *,
bool)> LPMAddNewLoop;
200 BasicBlock *OriginalPreheader =
nullptr;
204 BasicBlock *MainLoopPreheader =
nullptr;
211 LoopStructure MainLoopStructure;
216 LoopConstrainer(Loop &L, LoopInfo &LI,
217 function_ref<
void(Loop *,
bool)> LPMAddNewLoop,
218 const LoopStructure &LS, ScalarEvolution &SE,
219 DominatorTree &DT, Type *
T, SubRanges SR);
DenseMap< Block *, BlockRelaxAux > Blocks
LLVM Basic Block Representation.
Conditional or Unconditional Branch instruction.
Class to represent integer types.
This class is used to constrain loops to run within a given iteration space.
Represents a single loop in the control flow graph.
The main scalar evolution driver.
LLVM Value Representation.
@ BasicBlock
Various leaf nodes.
This is an optimization pass for GlobalISel generic memory operations.
ValueMap< const Value *, WeakTrackingVH > ValueToValueMapTy
std::optional< const SCEV * > LowLimit
std::optional< const SCEV * > HighLimit
LoopStructure map(M Map) const
IntegerType * ExitCountTy
static std::optional< LoopStructure > parseLoopStructure(ScalarEvolution &, Loop &, bool, const char *&)