From d0ce981372eb2518091f14a9f71150ad2c69bb29 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 10 Nov 2008 19:48:34 +0000 Subject: If the sign of exit condition and split condition does not match then do not split loop index. llvm-svn: 58995 --- llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp') diff --git a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp b/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp index 9a5920c8b97..8c54ce372ee 100644 --- a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -1437,7 +1437,12 @@ bool LoopIndexSplit::splitLoop(SplitInfo &SD) { if (ICMP->getPredicate() == ICmpInst::ICMP_EQ) return false; } - + + // If the predicate sign does not match then skip. + ICmpInst *CI = dyn_cast(SD.SplitCondition); + if (CI && (ExitCondition->isSignedPredicate() != CI->isSignedPredicate())) + return false; + BasicBlock *SplitCondBlock = SD.SplitCondition->getParent(); // Unable to handle triangle loops at the moment. -- cgit v1.2.3