summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2019-05-15 15:15:16 +0000
committerHiroshi Yamauchi <yamauchi@google.com>2019-05-15 15:15:16 +0000
commit7dfd087a9a59443b6dde9cb4e8763c55fbd23edb (patch)
tree05a76718cddcdee4c50a141acee33e92b279e78e /llvm/lib/Transforms/Scalar
parent7f7dd09001301edf328b7e01c30c8bb03bdc8c57 (diff)
downloadbcm5719-llvm-7dfd087a9a59443b6dde9cb4e8763c55fbd23edb.tar.gz
bcm5719-llvm-7dfd087a9a59443b6dde9cb4e8763c55fbd23edb.zip
[JumpThreading] A bug fix for stale loop info after unfold select
Summary: The return value of a TryToUnfoldSelect call was not checked, which led to an incorrectly preserved loop info and some crash. The original crash was reported on https://reviews.llvm.org/D59514. Reviewers: davidxl, amehsan Reviewed By: davidxl Subscribers: fhahn, brzycki, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61920 llvm-svn: 360780
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 123c8b9630c..7cb955d03ff 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -1174,7 +1174,8 @@ bool JumpThreadingPass::ProcessBlock(BasicBlock *BB) {
}
if (SwitchInst *SI = dyn_cast<SwitchInst>(BB->getTerminator()))
- TryToUnfoldSelect(SI, BB);
+ if (TryToUnfoldSelect(SI, BB))
+ return true;
// Check for some cases that are worth simplifying. Right now we want to look
// for loads that are used by a switch or by the condition for the branch. If
OpenPOWER on IntegriCloud