[PATCH] D94355: [SimplifyCFG] Add relative switch lookup tables

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 01:56:47 PST 2021


hans added a comment.

Great stuff, thanks for working on this!



================
Comment at: llvm/include/llvm/Transforms/Utils/SimplifyCFGOptions.h:27
   bool ConvertSwitchToLookupTable = false;
+  bool RelativeSwitchLookupTable = false;
   bool NeedCanonicalLoop = true;
----------------
Is it necessary to have an option for this? Can't SwitchToLookupTable just decide itself whether to do this, based on whether it's generating PIC code or not?

(In any case, I think this only makes sense for PIC code, right?)


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:5517
+  // Determines if a relative lookup table generated.
+  bool IsRelative = false;
 };
----------------
As far as I understand the flag only applies for ArrayKind, and for that it changes the behaviour quite a bit. Should this be another Kind enumerator instead?


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:5535
 
+  /// If relative lookup table is enabled, generate a relative lookup table
+  /// Relative lookup table consists of offsets between the lookup table and
----------------
nit: Please put a period at the end of sentences, here and in other comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94355



More information about the llvm-commits mailing list