diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-01-10 07:13:04 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-01-10 07:13:04 +0000 |
commit | d9833ea57983a2688dca4f34dcaad742fcc33f8c (patch) | |
tree | f110cbac7eaafcd34a4af2bad292ee619be23a9a /llvm/lib/Transforms/Scalar/JumpThreading.cpp | |
parent | c375450e3f9abcb04ec804c1e6d7bd5df616b314 (diff) | |
download | bcm5719-llvm-d9833ea57983a2688dca4f34dcaad742fcc33f8c.tar.gz bcm5719-llvm-d9833ea57983a2688dca4f34dcaad742fcc33f8c.zip |
[JumpThreading] Don't forget to report that the IR changed
JumpThreading's runOnFunction is supposed to return true if it made any
changes. JumpThreading has a call to removeUnreachableBlocks which may
result in changes to the IR but runOnFunction didn't appropriate account
for this possibility, leading to badness.
While we are here, make sure to call LazyValueInfo::eraseBlock in
removeUnreachableBlocks; JumpThreading preserves LVI.
This fixes PR26096.
llvm-svn: 257279
Diffstat (limited to 'llvm/lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/JumpThreading.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index 35a10db3292..dcdcfed66e6 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -211,11 +211,12 @@ bool JumpThreading::runOnFunction(Function &F) { // we will loop forever. We take care of this issue by not jump threading for // back edges. This works for normal cases but not for unreachable blocks as // they may have cycle with no back edge. - removeUnreachableBlocks(F); + bool EverChanged = false; + EverChanged |= removeUnreachableBlocks(F, LVI); FindLoopHeaders(F); - bool Changed, EverChanged = false; + bool Changed; do { Changed = false; for (Function::iterator I = F.begin(), E = F.end(); I != E;) { |