diff options
| author | Serguei Katkov <serguei.katkov@azul.com> | 2019-07-10 10:25:22 +0000 | 
|---|---|---|
| committer | Serguei Katkov <serguei.katkov@azul.com> | 2019-07-10 10:25:22 +0000 | 
| commit | d000f8b69f721c8d9bfcf90dd8df9a25bbf3b2e5 (patch) | |
| tree | 00f7a9cea4ec8aa9fe3d454a2a13e2abff5acfaa | |
| parent | 71cac61d01888769c910b0f5f06b6337e9523199 (diff) | |
| download | bcm5719-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
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll | 1 | 
2 files changed, 1 insertions, 2 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;      } diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll b/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll index 3624f5b9de6..8f743cac50c 100644 --- a/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll +++ b/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll @@ -1,5 +1,4 @@  ; REQUIRES: asserts -; XFAIL: *  ; RUN: opt -passes='unswitch<nontrivial>' -disable-output -S < %s  ; RUN: opt -simple-loop-unswitch -enable-nontrivial-unswitch -disable-output -S < %s  | 

