mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-20 11:29:24 +00:00
Swap exit condition operands if it works.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41817 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
569f7371d6
commit
0c0f7c935b
@ -329,13 +329,23 @@ void LoopIndexSplit::findLoopConditionals() {
|
||||
return;
|
||||
|
||||
// FIXME
|
||||
if (CI->getPredicate() == ICmpInst::ICMP_EQ
|
||||
|| CI->getPredicate() == ICmpInst::ICMP_NE)
|
||||
return;
|
||||
|
||||
if (CI->getPredicate() == ICmpInst::ICMP_SGT
|
||||
|| CI->getPredicate() == ICmpInst::ICMP_UGT
|
||||
|| CI->getPredicate() == ICmpInst::ICMP_SGE
|
||||
|| CI->getPredicate() == ICmpInst::ICMP_UGE
|
||||
|| CI->getPredicate() == ICmpInst::ICMP_EQ
|
||||
|| CI->getPredicate() == ICmpInst::ICMP_NE)
|
||||
|| CI->getPredicate() == ICmpInst::ICMP_UGE) {
|
||||
|
||||
BasicBlock *FirstSuccessor = BR->getSuccessor(0);
|
||||
// splitLoop() is expecting LT/LE as exit condition predicate.
|
||||
// Swap operands here if possible to meet this requirement.
|
||||
if (!L->contains(FirstSuccessor))
|
||||
CI->swapOperands();
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
ExitCondition = CI;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user