OSDN Git Service

[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)
commitb68036c70c2ca3bc32e6d681bb6d9fbd2a78e7aa
treeb7d49837795c27cf004e2c0f61ac956f5729a369
parentbbc769fbf042f3ce90bbf4fa86b3a275ffc6759d
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287553 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CodeGenPrepare.cpp
test/CodeGen/X86/phi-immediate-factoring.ll
test/CodeGen/X86/ragreedy-hoist-spill.ll
test/Transforms/CodeGenPrepare/AArch64/widen_switch.ll
test/Transforms/CodeGenPrepare/X86/widen_switch.ll
test/Transforms/CodeGenPrepare/skip-merging-case-block.ll [new file with mode: 0644]