diff options
| author | Shih-wei Liao <sliao@google.com> | 2012-03-24 04:18:09 -0700 |
|---|---|---|
| committer | Shih-wei Liao <sliao@google.com> | 2012-03-24 04:18:09 -0700 |
| commit | c59a7995d22e2889706810c90a20a51ecfec278b (patch) | |
| tree | ef37472f01d4b6258755680b4561a667bc337dd6 /lib/Transforms/Utils/LoopSimplify.cpp | |
| parent | d1acd051dd8446a013b6c35b4bfe64ec68417206 (diff) | |
| parent | 98a92d199ce9993dca1b65927009013ad3e5297f (diff) | |
| download | external_llvm-c59a7995d22e2889706810c90a20a51ecfec278b.zip external_llvm-c59a7995d22e2889706810c90a20a51ecfec278b.tar.gz external_llvm-c59a7995d22e2889706810c90a20a51ecfec278b.tar.bz2 | |
Merge branch 'upstream' into sliao_d
Diffstat (limited to 'lib/Transforms/Utils/LoopSimplify.cpp')
| -rw-r--r-- | lib/Transforms/Utils/LoopSimplify.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp index 4376265..0bc185d 100644 --- a/lib/Transforms/Utils/LoopSimplify.cpp +++ b/lib/Transforms/Utils/LoopSimplify.cpp @@ -386,7 +386,7 @@ BasicBlock *LoopSimplify::InsertPreheaderForLoop(Loop *L) { this); } else { SmallVector<BasicBlock*, 2> NewBBs; - SplitLandingPadPredecessors(Header, OutsideBlocks, ".preheader", + SplitLandingPadPredecessors(Header, OutsideBlocks, ".preheader", ".split-lp", this, NewBBs); PreheaderBB = NewBBs[0]; } @@ -538,8 +538,7 @@ void LoopSimplify::PlaceSplitBlockCarefully(BasicBlock *NewBB, /// Loop *LoopSimplify::SeparateNestedLoop(Loop *L, LPPassManager &LPM, BasicBlock *Preheader) { - // Don't try to separate loops without a preheader (this excludes - // loop headers which are targeted by an indirectbr). + // Don't try to separate loops without a preheader. if (!Preheader) return 0; @@ -554,11 +553,15 @@ Loop *LoopSimplify::SeparateNestedLoop(Loop *L, LPPassManager &LPM, // handles the case when a PHI node has multiple instances of itself as // arguments. SmallVector<BasicBlock*, 8> OuterLoopPreds; - for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { if (PN->getIncomingValue(i) != PN || - !L->contains(PN->getIncomingBlock(i))) + !L->contains(PN->getIncomingBlock(i))) { + // We can't split indirectbr edges. + if (isa<IndirectBrInst>(PN->getIncomingBlock(i)->getTerminator())) + return 0; OuterLoopPreds.push_back(PN->getIncomingBlock(i)); - + } + } DEBUG(dbgs() << "LoopSimplify: Splitting out a new outer loop\n"); // If ScalarEvolution is around and knows anything about values in |
