[PATCH] D60295: [SelectionDAG] Change the jump table size unit from entry to target

Evandro Menezes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 19 10:38:02 PDT 2019


evandro marked 3 inline comments as done.
evandro added a comment.

In D60295#1462585 <https://reviews.llvm.org/D60295#1462585>, @hans wrote:

> I still think looking at the number of cases isn't that much better than looking at the size of the range though. As you said, the point is to limit the load on the branch target predictor, and IIUC that's limited on the number of *different branch targets*, which is really orthogonal to the number of cases. I realize that we don't have that information as readily available, but do you agree that limiting the jump table to a certain number of different targets would be a better approach?


For each case there is a target in the table, that may potentially be reached or not at run time, but would prevent stressing the predictor.  So, cases and targets are not orthogonal, but the same.



================
Comment at: llvm/include/llvm/CodeGen/TargetLowering.h:962
+    // the range is dense enough for a jump table.
+    if (NumCases + (NumCases < Range) <= MaxJumpTableCases &&
+        NumCases * 100 >= Range * MinDensity) {
----------------
hans wrote:
> What's the `(NumCases < Range)` part for? Based on the description, I'd expect this to just check "NumCases <= MaxJumpTableCases"
It's how I infer that there may be a default case.  Or am I missing a better way to do so?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60295





More information about the llvm-commits mailing list