[PATCH] D21291: [SimplifyCFG] Range reduce switches
James Molloy via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 15 05:08:54 PDT 2016
jmolloy updated this revision to Diff 60817.
jmolloy added a comment.
Hi Sanjoy and Eli,
Thanks for your reviews. I agree with all of your comments. This new version has a real density function and will perform the optimization if the switch is not dense to begin with and would be made dense. The density function is adapted from SelectionDAGBuilder, and I'm not too happy on replicating the heuristic here but I couldn't think of a better way.
Similarly the hardcoded bailout for < 4 cases - ideally I'd use TargetLowering here which has a hook, but we only have TTI. It might be worth adding a hook, but perhaps it's not so urgent so I've added a FIXME.
Eli, the reason I'm doing this in SimplifyCFG is because it's an enabler for switch->lookup table lowering (which is also in SimplifyCFG).
The testing has also been improved to cover more negative and unsigned large values and wraparound cases.
Cheers,
James
Repository:
rL LLVM
http://reviews.llvm.org/D21291
Files:
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/rangereduce.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21291.60817.patch
Type: text/x-patch
Size: 10220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160615/ef1ff845/attachment.bin>
More information about the llvm-commits
mailing list