[CodeGenPrep] Skip merging empty case blocks
authorJun Bum Lim <junbuml@codeaurora.org>
Mon, 21 Nov 2016 16:47:28 +0000 (16:47 +0000)
committerJun Bum Lim <junbuml@codeaurora.org>
Mon, 21 Nov 2016 16:47:28 +0000 (16:47 +0000)
commit82f55c54460a6e6df5bc9d217190c25b23018664
tree0c869574ce2b4257f1592858ce6629604ddf02d9
parent96fe1aa38072660a7bce3da23d6c6fedace4af74
[CodeGenPrep] Skip merging empty case blocks

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, davidxl

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

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

llvm-svn: 287553
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]