]> granicus.if.org Git - llvm/commit
LowerSwitch: replace unreachable default with popular case destination
authorHans Wennborg <hans@hanshq.net>
Fri, 23 Jan 2015 20:43:51 +0000 (20:43 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 23 Jan 2015 20:43:51 +0000 (20:43 +0000)
commit01e223e92e62d284c46299b34d7b30a0b1bb8aae
treeb732a2f83a07f08477b303c8d42e683324b1dff3
parent88fa664c1bc7aec4e717d5bdbfd2ad334d36423b
LowerSwitch: replace unreachable default with popular case destination

SimplifyCFG currently does this transformation, but I'm planning to remove that
to allow other passes, such as this one, to exploit the unreachable default.

This patch takes care to keep track of what case values are unreachable even
after the transformation, allowing for more efficient lowering.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226934 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/LowerSwitch.cpp
test/Transforms/LowerSwitch/2014-06-11-SwitchDefaultUnreachableOpt.ll
test/Transforms/LowerSwitch/fold-popular-case-to-unreachable-default.ll [new file with mode: 0644]