SelectionDAG switch lowering: Replace unreachable default with most popular case.
authorHans Wennborg <hans@hanshq.net>
Sat, 6 Dec 2014 01:28:50 +0000 (01:28 +0000)
committerHans Wennborg <hans@hanshq.net>
Sat, 6 Dec 2014 01:28:50 +0000 (01:28 +0000)
commita421ac689f50cee8f7258c9110b69de00bd3ddba
tree4027bf7a4659e6fcb72a0a5fbba269d6e6dc0b57
parent30596886ed64e29e726ac18b77120581e7b354d5
SelectionDAG switch lowering: Replace unreachable default with most popular case.

This can significantly reduce the size of the switch, allowing for more
efficient lowering.

I also worked with the idea of exploiting unreachable defaults by
omitting the range check for jump tables, but always ended up with a
non-neglible binary size increase. It might be worth looking into some more.

SimplifyCFG currently does this transformation, but I'm working towards changing
that so we can optimize harder based on unreachable defaults.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223566 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
test/CodeGen/X86/2013-10-14-FastISel-incorrect-vreg.ll
test/CodeGen/X86/asm-label.ll
test/CodeGen/X86/switch-jump-table.ll [new file with mode: 0644]