OSDN Git Service

[WinEH] Fix funclet return block clobber mask placement
authorReid Kleckner <rnk@google.com>
Fri, 26 Feb 2016 16:53:19 +0000 (16:53 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 26 Feb 2016 16:53:19 +0000 (16:53 +0000)
commit0e6b04c2c0376b226f2e598c708607fc234d855d
tree8c74926ec012b0243fbf09704e8bdc7b777fbeb1
parent7b1b31d2b78e8a6b79f2da7242e3e7068f03b6fd
[WinEH] Fix funclet return block clobber mask placement

MBB slot index intervals are half open, not closed. getMBBEndIndex()
returns the slot index of the start of the next block in layout order.
Placing a register mask there is incorrect if the successor of the
funclet return is not laid out after the return. Clang generates IR for
catch bodies before generating the following normal code, so we never
noticed this issue until the D frontend authors filed a bug about it.

Instead, we can put the clobber mask on the last instruction of the
funclet return block. We still aren't using a register mask operand on
the CATCHRET instruction because it would cause PEI to spill all CSRs,
including XMM regs, in the prologue.

Fixes PR26679.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262035 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/LiveIntervalAnalysis.cpp
test/CodeGen/X86/catchret-regmask.ll [new file with mode: 0644]