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

Hans Wennborg hans at chromium.org
Fri Jan 16 22:46:19 PST 2015


> If we instead , before running your algorithm, we collect the ranges that are true unreachable gaps and use this information in the lowering algorithm to make the best assumptions between upper and lower bounds I think we can reach the optimum.


That sounds like a good idea. I've uploaded a patch that does this. It might need some polish, but please take a look and let me know if you think it's on the right track.


http://reviews.llvm.org/D6697

Files:
  lib/Transforms/Utils/LowerSwitch.cpp
  test/Transforms/LowerSwitch/2014-06-11-SwitchDefaultUnreachableOpt.ll
  test/Transforms/LowerSwitch/fold-popular-case-to-unreachable-default.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6697.18334.patch
Type: text/x-patch
Size: 13929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150117/9b6eab39/attachment.bin>


More information about the llvm-commits mailing list