[PATCH] LowerSwitch: replace unreachable default with popular case destination

Marcello Maggioni hayarms at gmail.com
Tue Dec 23 10:05:31 PST 2014


Sorry for the delay! I didn't catch this conversation :-)

The idea itself of this optimization is good and ideally sounds promising for the case where there are many different, non-contiguous switch cases all pointing to the same block, but I'm not sure this is worth it overall.

The main problem is that the presence of a default block confuses the UpperBound and LowerBound computations , that cannot rely on skipping gaps between ranges of switch values anymore, which is a good optimization if the default block is absent.

Your test case is an example of code that gets worse in this case with the patch that without.

I guess is a matter of deciding if the case of non-contiguous switch cases pointing to the same block is a common case or not.


http://reviews.llvm.org/D6697

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






More information about the llvm-commits mailing list