[PATCH] D60295: [CodeGen] Replace -max-jump-table-size with -max-jump-table-targets

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 00:18:32 PDT 2019


hans added inline comments.


================
Comment at: llvm/lib/CodeGen/SwitchLoweringUtils.cpp:49
+
+static void getJumpTableStats(const CaseClusterVector &Clusters, unsigned First,
+                              unsigned Last, bool HasReachableDefault,
----------------
I think it would be simpler if this just returned a PartitionStats object, instead of "returning" via a reference parameter.


================
Comment at: llvm/lib/CodeGen/SwitchLoweringUtils.cpp:54
+
+  // Accumulated number of cases in each cluster and those prior to it.
+  SmallVector<unsigned, 8> AllCases(Last + 1);
----------------
The point of the AllCases vector was to avoid having to iterate from First to Last each time to compute the number of cases.

Now that we're iterating from First to Last anyway to count the number of targets, there's no point to this optimization really, and we might as well count the number of cases while counting the number of targets. That would make the code simpler.


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

https://reviews.llvm.org/D60295





More information about the llvm-commits mailing list