diff options
-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 |