[PATCH] D64404: [SimpleLoopUnswitch] Don't consider unswitching `switch` insructions with one unique successor

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 03:25:08 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL365611: [SimpleLoopUnswitch] Don't consider unswitching `switch` insructions with oneā€¦ (authored by skatkov, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D64404?vs=208881&id=208909#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64404/new/

https://reviews.llvm.org/D64404

Files:
  llvm/trunk/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
  llvm/trunk/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll


Index: llvm/trunk/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll
===================================================================
--- llvm/trunk/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll
+++ llvm/trunk/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/trunk/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ llvm/trunk/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.208909.patch
Type: text/x-patch
Size: 1232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190710/a94b22f7/attachment.bin>


More information about the llvm-commits mailing list