[llvm-commits] [llvm] r41817 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
Devang Patel
dpatel at apple.com
Mon Sep 10 16:34:06 PDT 2007
Author: dpatel
Date: Mon Sep 10 18:34:06 2007
New Revision: 41817
URL: http://llvm.org/viewvc/llvm-project?rev=41817&view=rev
Log:
Swap exit condition operands if it works.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=41817&r1=41816&r2=41817&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Sep 10 18:34:06 2007
@@ -328,14 +328,24 @@
if (!CI)
return;
- // FIXME
+ // 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)
- return;
+ || 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;
More information about the llvm-commits
mailing list