Changes in directory llvm/lib/Transforms/Scalar:
LoopUnswitch.cpp updated: 1.25 -> 1.26 --- Log message: Change SplitBlock to increment a BasicBlock::iterator, not an Instruction*. Apparently they do different things :) This fixes a testcase that nate reduced from spass. Also included are a couple minor code changes that don't affect the generated code at all. --- Diffs of the changes: (+27 -23) LoopUnswitch.cpp | 50 +++++++++++++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 23 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.25 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.26 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.25 Wed Feb 15 22:07:37 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Feb 16 13:36:22 2006 @@ -397,9 +397,10 @@ /// the loop info is updated. /// BasicBlock *LoopUnswitch::SplitBlock(BasicBlock *Old, Instruction *SplitPt) { - while (isa<PHINode>(SplitPt)) - ++SplitPt; - BasicBlock *New = Old->splitBasicBlock(SplitPt, Old->getName()+".split"); + BasicBlock::iterator SplitIt = SplitPt; + while (isa<PHINode>(SplitIt)) + ++SplitIt; + BasicBlock *New = Old->splitBasicBlock(SplitIt, Old->getName()+".split"); // The new block lives in whichever loop the old one did. if (Loop *L = LI->getLoopFor(Old)) @@ -703,27 +704,30 @@ // Haha, this loop could be unswitched. Get it? The unswitch pass could // unswitch itself. Amazing. for (unsigned i = 0, e = Users.size(); i != e; ++i) - if (Instruction *U = cast<Instruction>(Users[i])) - if (L->contains(U->getParent())) - if (IsEqual) { - U->replaceUsesOfWith(LIC, Val); - } else if (NotVal) { - U->replaceUsesOfWith(LIC, NotVal); - } else { - // If we know that LIC is not Val, use this info to simplify code. - if (SwitchInst *SI = dyn_cast<SwitchInst>(U)) { - for (unsigned i = 1, e = SI->getNumCases(); i != e; ++i) { - if (SI->getCaseValue(i) == Val) { - // Found a dead case value. Don't remove PHI nodes in the - // successor if they become single-entry, those PHI nodes may - // be in the Users list. - SI->getSuccessor(i)->removePredecessor(SI->getParent(), true); - SI->removeCase(i); - break; - } + if (Instruction *U = cast<Instruction>(Users[i])) { + if (!L->contains(U->getParent())) + continue; + + if (IsEqual) { + U->replaceUsesOfWith(LIC, Val); + } else if (NotVal) { + U->replaceUsesOfWith(LIC, NotVal); + } else { + // If we know that LIC is not Val, use this info to simplify code. + if (SwitchInst *SI = dyn_cast<SwitchInst>(U)) { + for (unsigned i = 1, e = SI->getNumCases(); i != e; ++i) { + if (SI->getCaseValue(i) == Val) { + // Found a dead case value. Don't remove PHI nodes in the + // successor if they become single-entry, those PHI nodes may + // be in the Users list. + SI->getSuccessor(i)->removePredecessor(SI->getParent(), true); + SI->removeCase(i); + break; } } - - // TODO: We could simplify stuff like X == C. } + + // TODO: We could simplify stuff like X == C. + } + } } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits