[PATCH] D64404: [SimpleLoopUnswitch] Don't consider unswitching `switch` insructions with one unique successor
Daniil Suchkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 23:17:50 PDT 2019
DaniilSuchkov updated this revision to Diff 208881.
DaniilSuchkov added a comment.
Addressed Serguei's comment. Serguei, could you please submit this patch? I don't have permissions to submit patches yet.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64404/new/
https://reviews.llvm.org/D64404
Files:
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll
Index: llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll
===================================================================
--- llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll
+++ 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
Index: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -2552,7 +2552,7 @@
// 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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64404.208881.patch
Type: text/x-patch
Size: 1196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190710/ff5d6021/attachment.bin>
More information about the llvm-commits
mailing list