diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2011-05-02 19:34:44 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2011-05-02 19:34:44 +0000 | 
| commit | 6b943ff3a3f8617113ecbf611cf0f8957e4e19d2 (patch) | |
| tree | fc5f365fb9035b2d0c622bbf06c9bbe8627d7279 /lib/Transforms/Scalar/LoopRotation.cpp | |
| parent | d0e4e96dc17a6c1c6de3340842c80f0e187ba349 (diff) | |
Notes
Diffstat (limited to 'lib/Transforms/Scalar/LoopRotation.cpp')
| -rw-r--r-- | lib/Transforms/Scalar/LoopRotation.cpp | 9 | 
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index 95e15784df2c..47dced37c3a4 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/lib/Transforms/Scalar/LoopRotation.cpp @@ -184,7 +184,11 @@ bool LoopRotate::rotateLoop(Loop *L) {    // Now, this loop is suitable for rotation.    BasicBlock *OrigPreheader = L->getLoopPreheader();    BasicBlock *OrigLatch = L->getLoopLatch(); -  assert(OrigPreheader && OrigLatch && "Loop not in canonical form?"); +   +  // If the loop could not be converted to canonical form, it must have an +  // indirectbr in it, just give up. +  if (OrigPreheader == 0 || OrigLatch == 0) +    return false;    // Anything ScalarEvolution may know about this loop or the PHI nodes    // in its header will soon be invalidated. @@ -322,7 +326,8 @@ bool LoopRotate::rotateLoop(Loop *L) {      // We can fold the conditional branch in the preheader, this makes things      // simpler. The first step is to remove the extra edge to the Exit block.      Exit->removePredecessor(OrigPreheader, true /*preserve LCSSA*/); -    BranchInst::Create(NewHeader, PHBI); +    BranchInst *NewBI = BranchInst::Create(NewHeader, PHBI); +    NewBI->setDebugLoc(PHBI->getDebugLoc());      PHBI->eraseFromParent();      // With our CFG finalized, update DomTree if it is available.  | 
