From e2b838dd913200702f2eee29100a788c0573bc50 Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Mon, 4 Oct 2021 23:01:28 +0100 Subject: [DebugInfo][InstrRef] Accept landingpad block arguments This patch makes instruction-referencing accepts an additional scenario where values can be read from physical registers at the start of blocks. As far as I was aware, this only happened: * With arguments in the entry block, * With constant physical registers, To which this patch adds a third case: * With exception-handling landing-pad blocks In the attached test: the operand of the dbg.value traces back to the "landingpad" instruction, which becomes some copies from physregs. Right now, that's deemed unacceptable, and the assertion fires. The fix is to just accept this scenario; this is a case where the value in question is defined by a register and a position, not by an instruction that defines it. Reading it with a DBG_PHI is the correct behaviour, there isn't a non-copy instruction that we can refer to. Differential Revision: https://reviews.llvm.org/D109005 --- llvm/lib/CodeGen/MachineFunction.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/CodeGen/MachineFunction.cpp') diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index 7da58fd..bd13c28 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -1148,11 +1148,11 @@ auto MachineFunction::salvageCopySSA(MachineInstr &MI) // locations. ; } else { - // Assert that this is the entry block. If it isn't, then there is some - // code construct we don't recognise that deals with physregs across - // blocks. + // Assert that this is the entry block, or an EH pad. If it isn't, then + // there is some code construct we don't recognise that deals with physregs + // across blocks. assert(!State.first.isVirtual()); - assert(&*InsertBB.getParent()->begin() == &InsertBB); + assert(&*InsertBB.getParent()->begin() == &InsertBB || InsertBB.isEHPad()); } // Create DBG_PHI for specified physreg. -- cgit v1.1