[PATCH] D109428: [SImplifyCFG] SwitchInst processing redirecting the UB edges from the BB with the phiNode, that contains the UB, to the new BB.

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 8 04:14:22 PDT 2021


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6626
+            if (Case.getCaseSuccessor() == BB)
+              Case.setSuccessor(Unreachable);
+
----------------
Interesting follow-up can be done here. Imagine that after this is done, only one edge that doesn't go to `unreachable` remains. In this case, we can remove this switch and insert `assume(switched_value == remained_case_value)`.

Totally fine if it's a separate patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109428



More information about the llvm-commits mailing list