llvm.org GIT mirror llvm / b0cd2ae
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365611 91177308-0d34-0410-b5e6-96231b3b80d8 Serguei Katkov 2 months ago
2 changed file(s) with 1 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
25512551 // We can only consider fully loop-invariant switch conditions as we need
25522552 // to completely eliminate the switch after unswitching.
25532553 if (!isa(SI->getCondition()) &&
2554 L.isLoopInvariant(SI->getCondition()))
2554 L.isLoopInvariant(SI->getCondition()) && !BB->getUniqueSuccessor())
25552555 UnswitchCandidates.push_back({SI, {SI->getCondition()}});
25562556 continue;
25572557 }
0 ; REQUIRES: asserts
1 ; XFAIL: *
21 ; RUN: opt -passes='unswitch' -disable-output -S < %s
32 ; RUN: opt -simple-loop-unswitch -enable-nontrivial-unswitch -disable-output -S < %s
43