summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff options
context:
space:
mode:
authorMichael Zolotukhin <mzolotukhin@apple.com>2016-08-05 21:52:58 +0000
committerMichael Zolotukhin <mzolotukhin@apple.com>2016-08-05 21:52:58 +0000
commit4c65c3596a6339ef075c9edea2827562ef0cba9d (patch)
tree8702558d6c67052383fc5b485e07c016cc7a217e /llvm/lib/Transforms/Utils/LoopSimplify.cpp
parent5e35eaac83f1fe150273c45a001024a8cf9b4064 (diff)
downloadbcm5719-llvm-4c65c3596a6339ef075c9edea2827562ef0cba9d.tar.gz
bcm5719-llvm-4c65c3596a6339ef075c9edea2827562ef0cba9d.zip
[LoopSimplify] Fix updating LCSSA after separating nested loops.
This fixes PR28825. The problem was that we only checked if a value from a created inner loop is used in the outer loop, and fixed LCSSA for them. But we missed to fixup LCSSA for values used in exits of the outer loop. llvm-svn: 277877
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopSimplify.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index 2846e8f235b..fc5781fdf30 100644
--- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -376,6 +376,21 @@ static Loop *separateNestedLoop(Loop *L, BasicBlock *Preheader,
}
}
}
+ // We also need to check exit blocks of the outer loop - it might be using
+ // values from what now became an inner loop.
+ SmallVector<BasicBlock*, 8> ExitBlocks;
+ NewOuter->getExitBlocks(ExitBlocks);
+ for (BasicBlock *ExitBB: ExitBlocks) {
+ for (Instruction &I : *ExitBB) {
+ for (Value *Op : I.operands()) {
+ Instruction *OpI = dyn_cast<Instruction>(Op);
+ if (!OpI || !L->contains(OpI))
+ continue;
+ WorklistSet.insert(OpI);
+ }
+ }
+ }
+
SmallVector<Instruction *, 8> Worklist(WorklistSet.begin(),
WorklistSet.end());
formLCSSAForInstructions(Worklist, *DT, *LI);
OpenPOWER on IntegriCloud