summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2017-03-26 16:46:53 +0000
committerSerge Pavlov <sepavloff@gmail.com>2017-03-26 16:46:53 +0000
commitb71bb80c2debeab7128ce9be440d6601260910cd (patch)
treeb8c03609eb21529e81346653b2231085c645e6c2 /llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
parent12801f1e0f2f505ecf0a172341a6eccb2f930b28 (diff)
downloadbcm5719-llvm-b71bb80c2debeab7128ce9be440d6601260910cd.tar.gz
bcm5719-llvm-b71bb80c2debeab7128ce9be440d6601260910cd.zip
[LoopUnroll] Remap references in peeled iteration
References in cloned blocks must be remapped prior to dominator calculation. Differential Revision: https://reviews.llvm.org/D31281 llvm-svn: 298811
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
index ea3e37d9c59..73c14f5606b 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
@@ -415,6 +415,11 @@ bool llvm::peelLoop(Loop *L, unsigned PeelCount, LoopInfo *LI,
cloneLoopBlocks(L, Iter, InsertTop, InsertBot, Exit,
NewBlocks, LoopBlocks, VMap, LVMap, DT, LI);
+
+ // Remap to use values from the current iteration instead of the
+ // previous one.
+ remapInstructionsInBlocks(NewBlocks, VMap);
+
if (DT) {
// Latches of the cloned loops dominate over the loop exit, so idom of the
// latter is the first cloned loop body, as original PreHeader dominates
@@ -437,10 +442,6 @@ bool llvm::peelLoop(Loop *L, unsigned PeelCount, LoopInfo *LI,
F->getBasicBlockList().splice(InsertTop->getIterator(),
F->getBasicBlockList(),
NewBlocks[0]->getIterator(), F->end());
-
- // Remap to use values from the current iteration instead of the
- // previous one.
- remapInstructionsInBlocks(NewBlocks, VMap);
}
// Now adjust the phi nodes in the loop header to get their initial values
OpenPOWER on IntegriCloud