Lines Matching refs:Loop
1 //===-- LoopReroll.cpp - Loop rerolling pass ------------------------------===//
10 // This pass implements a simple loop reroller.
40 #define DEBUG_TYPE "loop-reroll"
46 cl::desc("The maximum increment for loop rerolling"));
54 // This loop re-rolling transformation aims to transform loops like this:
65 // into a loop like this:
76 // other induction-variable increments). In other words, we're looking for loop
93 // only of i (and other loop-invariant values).
134 /// The bitvector index used by loop induction variables and other
147 bool runOnLoop(Loop *L, LPPassManager &LPM) override;
175 // loop.
177 SimpleLoopReduction(Instruction *P, Loop *L)
230 void add(Loop *L);
234 // during loop instruction processing.
271 // The functions below are used while processing the loop instructions.
305 // instructions in the loop, and we know which reductions were selected.
320 // loop. For example,
342 // The loop will be rerolled by adding a new loop induction variable,
355 DAGRootTracker(LoopReroll *Parent, Loop *L, Instruction *IV,
403 Loop *L;
411 // The loop induction variable.
413 // Loop step amount.
415 // Loop reroll count; if Inc == 1, this records the scaling applied
423 // Map of all instructions in the loop (in order) to the iterations
425 // used in the loop increment mechanism).
431 void collectPossibleIVs(Loop *L, SmallInstructionVector &PossibleIVs);
432 void collectPossibleReductions(Loop *L,
434 bool reroll(Instruction *IV, Loop *L, BasicBlock *Header, const SCEV *IterCount,
440 INITIALIZE_PASS_BEGIN(LoopReroll, "loop-reroll", "Reroll loops", false, false)
446 INITIALIZE_PASS_END(LoopReroll, "loop-reroll", "Reroll loops", false, false)
452 // Returns true if the provided instruction is used outside the given loop.
454 // non-loop blocks to be outside the loop.
455 static bool hasUsesOutsideLoop(Instruction *I, Loop *L) {
463 // Collect the list of loop induction variables with respect to which it might
464 // be possible to reroll the loop.
465 Loop *L,
498 void LoopReroll::SimpleLoopReduction::add(Loop *L) {
503 // and also outside the loop).
529 // The only in-loop user can be the initial PHI.
540 void LoopReroll::collectPossibleReductions(Loop *L,
586 // Ignore "wrap-around" uses to PHIs of this loop's header.
708 // If we found non-loop-inc, non-root users of Base, assume they are
839 // And ensure all loop iterations are consecutive. We rely on std::map
851 // loop iteration J.
853 // Now, For the loop iterations to be consecutive:
923 // Make sure the loop increments are also accounted for.
1034 // Make sure all instructions in the loop are in one and only one
1237 " vs. " << *RootInst << " (uses outside loop)\n");
1406 loop with respect to the provided induction variable.
1407 // Generally, we're looking for a loop like this:
1429 // This gives us f(%iv). Then we iterate over the loop instructions (scale-1)
1439 // f(%iv.(j+1)) for some j > i, and we cannot reroll the loop. Similarly,
1445 // Finally, we make sure that all loop instructions are either loop increment
1448 // have been validated), then we reroll the loop.
1449 bool LoopReroll::reroll(Instruction *IV, Loop *L, BasicBlock *Header,
1474 bool LoopReroll::runOnLoop(Loop *L, LPPassManager &LPM) {
1487 "] Loop %" << Header->getName() << " (" <<