mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26235 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
77dea9b3c3
commit
10cd9bbde7
@ -397,9 +397,10 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val,Loop *L){
|
||||
/// 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,8 +704,10 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
|
||||
// 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 (Instruction *U = cast<Instruction>(Users[i])) {
|
||||
if (!L->contains(U->getParent()))
|
||||
continue;
|
||||
|
||||
if (IsEqual) {
|
||||
U->replaceUsesOfWith(LIC, Val);
|
||||
} else if (NotVal) {
|
||||
@ -726,4 +729,5 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
|
||||
|
||||
// TODO: We could simplify stuff like X == C.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user