From: Devang Patel Date: Mon, 20 Aug 2007 20:49:01 +0000 (+0000) Subject: Replace indunction variable with split value in loop body. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ebc5fea6956273b9df5df71abe9dd3242bc313aa;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index 4a5c1c8cc0b..598ed772a55 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(Latch->getTerminator());