SimplifyCFG: don't remove unreachable default switch destinations
authorHans Wennborg <hans@hanshq.net>
Mon, 1 Dec 2014 17:08:35 +0000 (17:08 +0000)
committerHans Wennborg <hans@hanshq.net>
Mon, 1 Dec 2014 17:08:35 +0000 (17:08 +0000)
commitb2fd9443780e499499a23970981a8c6d62cc6857
tree44674604d87b744f7db715c25f8964abfbb9d927
parente6f4d335d72a0af4f907d565eaade62e34d77fd3
SimplifyCFG: don't remove unreachable default switch destinations

An unreachable default destination can be exploited by other optimizations, and
SDag lowering is now prepared to handle them efficiently.

For example, branches to the unreachable destination will be optimized away,
such as in the case of range checks for switch lookup tables.

On 64-bit Linux, this reduces the size of a clang bootstrap by 80 kB (and
Chromium by 30 kB).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223050 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/UnreachableEliminate.ll
test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll