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

Sean Silva chisophugis at gmail.com
Fri Mar 27 17:53:40 PDT 2015


Could you give a pseudocode description of the switch lowering process as you've implemented it? Just a little something so that everyone can be on the same page about the high-level organization.

Also, any initial performance numbers to report?


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:7182-7187
@@ +7181,8 @@
+
+  // Split Clusters into minimum number of dense partitions. The algorithm uses
+  // the same idea as Kannan & Proebsting "Correction to 'Producing Good Code
+  // for the Case Statement'" (1994), but builds the MinPartitions array in
+  // reverse order to make it easier to reconstruct the partitions in ascending
+  // order. In the choice between two optimal partitionings, it picks the one
+  // which yields more jump tables.
+
----------------
Out of curiosity, does this correctly handle jump tables that cross the "overflow discontinuity" for the switched-on integer type? (not sure if we should bother with handling that case)

http://reviews.llvm.org/D8649

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






More information about the llvm-commits mailing list