1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[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
This commit is contained in:
Serguei Katkov 2019-07-10 10:25:22 +00:00
parent b098408d2a
commit 96f7f32d3a
2 changed files with 1 additions and 2 deletions

View File

@ -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;
}

View File

@ -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