[PATCH] D60673: [SimplifyCFG] Improove and speed up ReduceSwitchRange

Shawn Landden via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 14:34:01 PDT 2019


shawnl abandoned this revision.
shawnl marked 2 inline comments as done.
shawnl added a comment.

I think this patch will make more sense together with the other changes I want to make. I will withdraw it and submit the changes together.



================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:5498
-  uint64_t NumCases = Values.size();
-  // 40% is the default density for building a jump table in optsize/minsize mode.
-  uint64_t MinDensity = 40;
----------------
lebedev.ri wrote:
> So what about `-Os`/`-Oz`?
This is not making the table, that calculation is elsewhere. This optimization is cheap and should always be applied.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:5629-5633
   // The conversion from switch to lookup tables results in difficult-to-analyze
   // code and makes pruning branches much harder. This is a problem if the
   // switch expression itself can still be restricted as a result of inlining or
   // CVP. Therefore, only apply this transformation during late stages of the
   // optimisation pipeline.
----------------
lebedev.ri wrote:
> Did you see this comment?
This change does not change whether a lookup table gets created (although I am working on such patches). It only simplifies the switch.


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

https://reviews.llvm.org/D60673





More information about the llvm-commits mailing list