From babbe27007b6b418706d4fe1de3092c8a88fd314 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 19 Sep 2007 00:28:47 +0000 Subject: [PATCH] Relax loop ExitCondition predicate restriction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42122 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopIndexSplit.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index cb5060a6765..d30f18d91b6 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -356,11 +356,7 @@ void LoopIndexSplit::findLoopConditionals() { return; // FIXME - 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 + if (CI->getPredicate() == ICmpInst::ICMP_EQ || CI->getPredicate() == ICmpInst::ICMP_NE) return; @@ -1015,6 +1011,12 @@ void LoopIndexSplit::calculateLoopBounds(SplitInfo &SD) { Value *AEV = SD.SplitValue; Value *BSV = SD.SplitValue; + if (ExitCondition->getPredicate() == ICmpInst::ICMP_SGT + || ExitCondition->getPredicate() == ICmpInst::ICMP_UGT + || ExitCondition->getPredicate() == ICmpInst::ICMP_SGE + || ExitCondition->getPredicate() == ICmpInst::ICMP_UGE) + ExitCondition->swapOperands(); + switch (ExitCondition->getPredicate()) { case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_UGT: