mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 17:24:48 +00:00
If ExitValue operand is also defined in Loop header then
insert new ExitValue after this operand definition. This fixes PR1828. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1330,6 +1330,23 @@ void LoopIndexSplit::calculateLoopBounds(SplitInfo &SD) {
|
||||
// A_ExitValue = min(SplitValue, OrignalLoopExitValue)
|
||||
// B_StartValue = max(SplitValue, OriginalLoopStartValue)
|
||||
Instruction *InsertPt = L->getHeader()->getFirstNonPHI();
|
||||
|
||||
// If ExitValue operand is also defined in Loop header then
|
||||
// insert new ExitValue after this operand definition.
|
||||
if (Instruction *EVN =
|
||||
dyn_cast<Instruction>(ExitCondition->getOperand(ExitValueNum))) {
|
||||
if (!isa<PHINode>(EVN))
|
||||
if (InsertPt->getParent() == EVN->getParent()) {
|
||||
BasicBlock::iterator LHBI = L->getHeader()->begin();
|
||||
BasicBlock::iterator LHBE = L->getHeader()->end();
|
||||
for(;LHBI != LHBE; ++LHBI) {
|
||||
Instruction *I = LHBI;
|
||||
if (I == EVN)
|
||||
break;
|
||||
}
|
||||
InsertPt = ++LHBI;
|
||||
}
|
||||
}
|
||||
Value *C1 = new ICmpInst(Sign ?
|
||||
ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
|
||||
AEV,
|
||||
|
Reference in New Issue
Block a user