[CodeGenPrep] Skip merging empty case blocks
authorJun Bum Lim <junbuml@codeaurora.org>
Fri, 16 Dec 2016 16:03:31 +0000 (16:03 +0000)
committerJun Bum Lim <junbuml@codeaurora.org>
Fri, 16 Dec 2016 16:03:31 +0000 (16:03 +0000)
commit85347dde27db69941622f0302cad5bda66d7a208
treeaefd932404cac5a83a1d73b26af9cc6ef594a741
parent4b73c3de50b9a000edd2bc1db8491ca923bfbc3c
[CodeGenPrep] Skip merging empty case blocks

This is recommit of r287553 after fixing the invalid loop info after eliminating an empty block:

Summary: Merging an empty case block into the header block of switch could cause ISel to add COPY instructions in the header of switch, instead of the case block, if the case block is used as an incoming block of a PHI. This could potentially increase dynamic instructions, especially when the switch is in a loop. I added a test case which was reduced from the benchmark I was targetting.

Reviewers: t.p.northover, mcrosier, manmanren, wmi, joerg, davidxl

Subscribers: joerg, qcolombet, danielcdh, hfinkel, mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D22696

llvm-svn: 289951
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/test/CodeGen/X86/phi-immediate-factoring.ll
llvm/test/CodeGen/X86/ragreedy-hoist-spill.ll
llvm/test/Transforms/CodeGenPrepare/AArch64/widen_switch.ll
llvm/test/Transforms/CodeGenPrepare/X86/widen_switch.ll
llvm/test/Transforms/CodeGenPrepare/skip-merging-case-block.ll [new file with mode: 0644]