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)
commit08de833c1cc559eb21a7ffd62224c78c5fc77e4f
treefee6db4ad1daf5054d809eb1139ee277f043c1d6
parent33df7cd345e926f63c02c29bcaa5826dea84f265
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

llvm-svn: 223566
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/X86/2013-10-14-FastISel-incorrect-vreg.ll
llvm/test/CodeGen/X86/asm-label.ll
llvm/test/CodeGen/X86/switch-jump-table.ll [new file with mode: 0644]