[PATCH] Switch lowering: extract jump tables and bit tests before building binary tree (PR22262)

Daniel Jasper djasper at google.com
Thu Apr 2 09:14:27 PDT 2015


Is it possible to get some idea of which bit tests LLVM is not finding with your bit tests? From your comments and IRC discussion, it feels like it should be finding more bit tests.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:7275-7277
@@ +7274,5 @@
+    APInt Lo = Clusters[i].Low->getValue();
+    TotalCases[i] = (Hi - Lo).getLimitedValue() + 1;
+    if (i != 0)
+      TotalCases[i] += TotalCases[i - 1];
+  }
----------------
Do I understand this correctly in that you would could something like:

  case 1:
  case 2:
  case 3:
  case 4:
  ...
  case 10:
    f();
    break;

as 100% dense? I don't think this would be a good idea. Essentially, the density of a jump table should be a measure for the amount of redundancy in it.

Probably not worth addressing in this patch as it is pre-existing, but we should look into that.

http://reviews.llvm.org/D8649

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list