SimplifyCFG: don't remove unreachable default switch destinations
authorHans Wennborg <hans@hanshq.net>
Mon, 26 Jan 2015 19:52:32 +0000 (19:52 +0000)
committerHans Wennborg <hans@hanshq.net>
Mon, 26 Jan 2015 19:52:32 +0000 (19:52 +0000)
commitd5c2318adc7bde590d9f9369ef97fe7adde3f1a4
tree7863f1e210087dadc80b80bc475fc2966366b3b2
parent1f0c6faee9b02c0307e4994bc2bebfb1f7eec00e
SimplifyCFG: don't remove unreachable default switch destinations

An unreachable default destination can be exploited by other optimizations and
allows for more efficient lowering. Both the SDag switch lowering and
LowerSwitch can exploit unreachable defaults.

Also make TurnSwitchRangeICmp handle switches with unreachable default.
This is kind of separate change, but it cannot be tested without the change
above, and I don't want to land the change above without this since that would
regress other tests.

Differential Revision: http://reviews.llvm.org/D6471

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227125 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/UnreachableEliminate.ll
test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll
test/Transforms/SimplifyCFG/switch-range-to-icmp.ll
test/Transforms/SimplifyCFG/switch-to-select-two-case.ll