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:
parent
b098408d2a
commit
96f7f32d3a
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user