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

Hans Wennborg hans at chromium.org
Tue Dec 16 15:20:05 PST 2014


Hi resistor, kariddi,

SimplifyCFG currently does this transformation, but I'm planning to remove that (see [1]) in order to be able to exploit unreachable defaults in lowering. By moving it here, we make sure that we don't lose functionality for IR going through SImplifyCFG -> LowerSwitch.

It seems LowerSwitch already has some code to exploit unreachable defaults for reducing the number of comparisons, so this will only replace an unreachable default if there is a destination shared by two or more cases.

Please take a look.

1. http://reviews.llvm.org/D6471

http://reviews.llvm.org/D6697

Files:
  lib/Transforms/Utils/LowerSwitch.cpp
  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.17370.patch
Type: text/x-patch
Size: 3078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141216/0a133e99/attachment.bin>


More information about the llvm-commits mailing list