[PATCH] D12497: [SimplifyCFG] Use known bits to eliminate dead switch defaults
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 31 11:14:55 PDT 2015
reames created this revision.
reames added reviewers: hans, sanjoy.
reames added a subscriber: llvm-commits.
This is a follow up to http://reviews.llvm.org/D11995 implementing the suggestion by Hans.
If we know some of the bits of the value being switched on, we know that the maximum number of unique cases covers the unknown bits. This allows to eliminate switch defaults for large integers (i32) when most bits in the value are known.
Note that I had to make the transform contingent on not having any dead cases. This is conservatively correct with the old code, but required for the new code since we might have a dead case which varies one of the known bits. Counting that towards our number of covering cases would be bad.
http://reviews.llvm.org/D12497
Files:
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/switch-dead-default.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12497.33601.patch
Type: text/x-patch
Size: 4444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150831/6dc7b8b5/attachment.bin>
More information about the llvm-commits
mailing list