[llvm-commits] [llvm] r50563 - /llvm/branches/Apple/Tak/lib/Transforms/Scalar/LoopIndexSplit.cpp
Bill Wendling
isanbard at gmail.com
Thu May 1 17:41:13 PDT 2008
Author: void
Date: Thu May 1 19:41:12 2008
New Revision: 50563
URL: http://llvm.org/viewvc/llvm-project?rev=50563&view=rev
Log:
Don't split the loop index if it's not "diamond" shaped. The result could be
code that's much less efficient and have bugs.
Modified:
llvm/branches/Apple/Tak/lib/Transforms/Scalar/LoopIndexSplit.cpp
Modified: llvm/branches/Apple/Tak/lib/Transforms/Scalar/LoopIndexSplit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=50563&r1=50562&r2=50563&view=diff
==============================================================================
--- llvm/branches/Apple/Tak/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/branches/Apple/Tak/lib/Transforms/Scalar/LoopIndexSplit.cpp Thu May 1 19:41:12 2008
@@ -1124,6 +1124,11 @@
BasicBlock *Succ0 = SplitTerminator->getSuccessor(0);
BasicBlock *Succ1 = SplitTerminator->getSuccessor(1);
+ // If split block does not dominate the latch then this is not a diamond.
+ // Such loop may not benefit from index split.
+ if (!DT->dominates(SplitCondBlock, Latch))
+ return false;
+
// Finally this split condition is safe only if merge point for
// split condition branch is loop latch. This check along with previous
// check, to ensure that exit condition is in either loop latch or header,
More information about the llvm-commits
mailing list