summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-02-26 16:53:19 +0000
committerReid Kleckner <rnk@google.com>2016-02-26 16:53:19 +0000
commit70c9bc71d4f1a5cceea67ce6724da9080d5e05fa (patch)
tree2feb27c63b7e48dfe51de89981cabdb6df9d4270 /llvm/lib/CodeGen
parent68e15559b8c331a74f7b5a2a9b69b7b1d0d5bd48 (diff)
downloadbcm5719-llvm-70c9bc71d4f1a5cceea67ce6724da9080d5e05fa.tar.gz
bcm5719-llvm-70c9bc71d4f1a5cceea67ce6724da9080d5e05fa.zip
[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. llvm-svn: 262035
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index e64652dedfd..c2426a69c8c 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -241,9 +241,13 @@ void LiveIntervals::computeRegMasks() {
}
}
- // Some block ends, such as funclet returns, create masks.
+ // Some block ends, such as funclet returns, create masks. Put the mask on
+ // the last instruction of the block, because MBB slot index intervals are
+ // half-open.
if (const uint32_t *Mask = MBB.getEndClobberMask(TRI)) {
- RegMaskSlots.push_back(Indexes->getMBBEndIdx(&MBB));
+ assert(!MBB.empty() && "empty return block?");
+ RegMaskSlots.push_back(
+ Indexes->getInstructionIndex(&MBB.back()).getRegSlot());
RegMaskBits.push_back(Mask);
}
OpenPOWER on IntegriCloud