diff options
author | Devang Patel <dpatel@apple.com> | 2007-08-20 20:49:01 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-08-20 20:49:01 +0000 |
commit | c166b954e06fa2253d982149a57393748e8a68ec (patch) | |
tree | bdf544fa1fda38753e2acd0a2c12e924547693b2 /lib/Transforms | |
parent | 49fbf5ad140c66ba6bd5a78a1e82d50c90b5cd35 (diff) | |
download | external_llvm-c166b954e06fa2253d982149a57393748e8a68ec.zip external_llvm-c166b954e06fa2253d982149a57393748e8a68ec.tar.gz external_llvm-c166b954e06fa2253d982149a57393748e8a68ec.tar.bz2 |
Replace indunction variable with split value in loop body.
This fixes art miscompile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41195 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LoopIndexSplit.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index 4a5c1c8..598ed77 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -418,7 +418,11 @@ bool LoopIndexSplit::processOneIterationLoop(SplitInfo &SD) { // 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()); |