summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorMichael Zolotukhin <mzolotukhin@apple.com>2016-02-22 21:21:45 +0000
committerMichael Zolotukhin <mzolotukhin@apple.com>2016-02-22 21:21:45 +0000
commitd734bea8ba5291a2f421b2472246f87b86b6d61c (patch)
tree0067ae2d16249f8bd23665fd9e34495a80ab0b99 /llvm/lib/Transforms
parent922bef4f380c015ed370776a33a92b50c41ac04d (diff)
downloadbcm5719-llvm-d734bea8ba5291a2f421b2472246f87b86b6d61c.tar.gz
bcm5719-llvm-d734bea8ba5291a2f421b2472246f87b86b6d61c.zip
[LoopUnrolling] Fix a bug introduced in r259869 (PR26688).
The issue was that we only required LCSSA rebuilding if the immediate parent-loop had values used outside of it. The fix is to enaable the same logic for all outer loops, not only immediate parent. llvm-svn: 261575
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUnroll.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
index 5c83cef573b..5152220e626 100644
--- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
@@ -142,9 +142,13 @@ static bool needToInsertPhisForLCSSA(Loop *L, std::vector<BasicBlock *> Blocks,
continue;
for (Instruction &I : *BB) {
for (Use &U : I.operands()) {
- if (auto Def = dyn_cast<Instruction>(U))
- if (LI->getLoopFor(Def->getParent()) == L)
+ if (auto Def = dyn_cast<Instruction>(U)) {
+ Loop *DefLoop = LI->getLoopFor(Def->getParent());
+ if (!DefLoop)
+ continue;
+ if (DefLoop->contains(L))
return true;
+ }
}
}
}
OpenPOWER on IntegriCloud