aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils/LoopSimplify.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-07-15 01:25:43 +0000
committerDan Gohman <gohman@apple.com>2009-07-15 01:25:43 +0000
commitbdc017edacb713119b24ab269d250a82d62fffeb (patch)
tree7cf92dc3dd53533075ad262c08ec0d23e0dd7e1d /lib/Transforms/Utils/LoopSimplify.cpp
parent2e2ad51ffd1e0822c7dc128d96113874017ad079 (diff)
downloadexternal_llvm-bdc017edacb713119b24ab269d250a82d62fffeb.zip
external_llvm-bdc017edacb713119b24ab269d250a82d62fffeb.tar.gz
external_llvm-bdc017edacb713119b24ab269d250a82d62fffeb.tar.bz2
Make makeLoopInvariant report whether it made any changes or not,
and use this to simplify more code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75722 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r--lib/Transforms/Utils/LoopSimplify.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp
index cfdfcb0..81fa4f9 100644
--- a/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/lib/Transforms/Utils/LoopSimplify.cpp
@@ -93,7 +93,7 @@ namespace {
BasicBlock *RewriteLoopExitBlock(Loop *L, BasicBlock *Exit);
BasicBlock *InsertPreheaderForLoop(Loop *L);
Loop *SeparateNestedLoop(Loop *L);
- void InsertUniqueBackedgeBlock(Loop *L);
+ void InsertUniqueBackedgeBlock(Loop *L, BasicBlock *Preheader);
void PlaceSplitBlockCarefully(BasicBlock *NewBB,
SmallVectorImpl<BasicBlock*> &SplitPreds,
Loop *L);
@@ -244,7 +244,7 @@ ReprocessLoop:
// If we either couldn't, or didn't want to, identify nesting of the loops,
// insert a new block that all backedges target, then make it jump to the
// loop header.
- InsertUniqueBackedgeBlock(L);
+ InsertUniqueBackedgeBlock(L, Preheader);
NumInserted++;
Changed = true;
}
@@ -288,9 +288,8 @@ ReprocessLoop:
Instruction *Inst = I++;
if (Inst == CI)
continue;
- if (!L->makeLoopInvariant(Inst, Preheader->getTerminator())) {
+ if (!L->makeLoopInvariant(Inst, Changed, Preheader->getTerminator())) {
AllInvariant = false;
- Changed = true;
break;
}
}
@@ -574,11 +573,10 @@ Loop *LoopSimplify::SeparateNestedLoop(Loop *L) {
/// backedges to target a new basic block and have that block branch to the loop
/// header. This ensures that loops have exactly one backedge.
///
-void LoopSimplify::InsertUniqueBackedgeBlock(Loop *L) {
+void LoopSimplify::InsertUniqueBackedgeBlock(Loop *L, BasicBlock *Preheader) {
assert(L->getNumBackEdges() > 1 && "Must have > 1 backedge!");
// Get information about the loop
- BasicBlock *Preheader = L->getLoopPreheader();
BasicBlock *Header = L->getHeader();
Function *F = Header->getParent();