[PATCH] D21940: Add support to optionally limit the size of jump tables

Evandro Menezes via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 22 09:24:42 PDT 2016


evandro marked 3 inline comments as done.

================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:8352
@@ +8351,3 @@
+  unsigned JumpTableSize = (Clusters[N - 1].High->getValue() -
+                            Clusters[0].Low->getValue()).getLimitedValue() + 1;
+  if (JumpTableSize <= MaxJumpTableSize &&
----------------
evandro wrote:
> hans wrote:
> > What do you think about introducing a helper function that we could call like 'jumpTableSize(Clusters, 0, N-1)'? I think that would make this a little easier to read here and below, and in the function we could take care not to let the value overflow for example.
> The operation seemed too short for a function, but saturating its return might make sense wrapping this in a function.
It turns out that `CaseClusterVector` is a private type of `SelectionDAGBuilder`.  In order to minimize the changes by this patch, I'll repeat the code as needed.


Repository:
  rL LLVM

https://reviews.llvm.org/D21940





More information about the llvm-commits mailing list