[llvm-commits] [llvm] r41195 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
Devang Patel
dpatel at apple.com
Mon Aug 20 13:49:01 PDT 2007
Author: dpatel
Date: Mon Aug 20 15:49:01 2007
New Revision: 41195
URL: http://llvm.org/viewvc/llvm-project?rev=41195&view=rev
Log:
Replace indunction variable with split value in loop body.
This fixes art miscompile.
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=41195&r1=41194&r2=41195&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Aug 20 15:49:01 2007
@@ -418,7 +418,11 @@
// Update CFG.
- // As a first step to break this loop, remove Latch to Header edge.
+ // Replace index variable with split value in loop body. Loop body is executed
+ // only when index variable is equal to split value.
+ IndVar->replaceAllUsesWith(SD.SplitValue);
+
+ // Remove Latch to Header edge.
BasicBlock *Latch = L->getLoopLatch();
BasicBlock *LatchSucc = NULL;
BranchInst *BR = dyn_cast<BranchInst>(Latch->getTerminator());
More information about the llvm-commits
mailing list