[llvm-commits] [Patch] Use TargetTransformInfo to control switch-to-lookup table transform

Hans Wennborg hans at chromium.org
Mon Oct 29 08:02:29 PDT 2012


Hi all,

When the switch-to-lookup tables transform landed in SimplifyCFG, it
was pointed out [1] that this could be inappropriate for some targets.
Since there was no way at the time for the pass to know anything about
the target, an awkward reverse-transform was added in CodeGenPrepare
that turned lookup tables back into switches for some targets.

The attached patch uses the new TargetTransformInfo to determine if a
switch should be transformed, and removes
CodeGenPrepare::ConvertLoadToSwitch. Please take a look!

Thanks,
Hans

[1]. http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120903/150131.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: switch_table_use_tti.patch
Type: application/octet-stream
Size: 18216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121029/da857acc/attachment.obj>


More information about the llvm-commits mailing list