summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2019-07-10 10:25:22 +0000
committerSerguei Katkov <serguei.katkov@azul.com>2019-07-10 10:25:22 +0000
commitd000f8b69f721c8d9bfcf90dd8df9a25bbf3b2e5 (patch)
tree00f7a9cea4ec8aa9fe3d454a2a13e2abff5acfaa /llvm/lib/Transforms/Scalar
parent71cac61d01888769c910b0f5f06b6337e9523199 (diff)
downloadbcm5719-llvm-d000f8b69f721c8d9bfcf90dd8df9a25bbf3b2e5.tar.gz
bcm5719-llvm-d000f8b69f721c8d9bfcf90dd8df9a25bbf3b2e5.zip
[SimpleLoopUnswitch] Don't consider unswitching `switch` insructions with one unique successor
Only instructions with two or more unique successors should be considered for unswitching. Patch Author: Daniil Suchkov. Reviewers: reames, asbirlea, skatkov Reviewed By: skatkov Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D64404 llvm-svn: 365611
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
index 82e98ec1877..97153292238 100644
--- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -2552,7 +2552,7 @@ unswitchBestCondition(Loop &L, DominatorTree &DT, LoopInfo &LI,
// We can only consider fully loop-invariant switch conditions as we need
// to completely eliminate the switch after unswitching.
if (!isa<Constant>(SI->getCondition()) &&
- L.isLoopInvariant(SI->getCondition()))
+ L.isLoopInvariant(SI->getCondition()) && !BB->getUniqueSuccessor())
UnswitchCandidates.push_back({SI, {SI->getCondition()}});
continue;
}
OpenPOWER on IntegriCloud