[PATCH] D109103: [ISEL][BitTestBlock] omit additional bit test when default destination is unreachable

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 3 05:43:38 PDT 2021


hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

Nice, lgtm. Only some nits about names from my side now.



================
Comment at: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp:3022
       MachineBasicBlock *NextMBB;
-      if (BTB.ContiguousRange && j + 2 == ej) {
+      if ((BTB.ContiguousRange || BTB.OmitRangeCheck) && j + 2 == ej) {
         // Second-to-last bit-test with contiguous range: fall through to the
----------------
I think UnreachableDefault (or UnreachableFallthrough) would be a better name now, since it doesn't just omit the range check, it also omits the last bit test.

Also some day we should unify all the switch lowering implementations in LLVM, I think there are four or so now :-)


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:10870
 
-        if (FallthroughUnreachable) {
-          // Skip the range check if the fallthrough block is unreachable.
+        // Skip the range check if the fallthrough block is unreachable.
+        if (FallthroughUnreachable)
----------------
The behaviour is really "skip the range check and last bit test", so the comment could either reflect that -- or if we rename the variable then maybe the comment becomes redundant and we can drop it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109103



More information about the llvm-commits mailing list