Merge commit f800c1f3b207 from llvm-project (by Arthur Eubanks):

[PEI] Don't zero out noreg operands

  A tail call may have $noreg operands.

  Fixes a crash.

  Reviewed By: xgupta

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

This should fix an assertion failure building qemu, specifically those
parts using -fzero-call-used-regs.

Reported by:	Daniel Berrangé <dan-freebsd@berrange.com>
PR:		277474
MFC after:	3 days
This commit is contained in:
Dimitry Andric 2024-03-04 21:30:54 +01:00
parent 327ada0b0e
commit a39b3aa463

View File

@ -1285,6 +1285,8 @@ void PEI::insertZeroCallUsedRegs(MachineFunction &MF) {
continue;
MCRegister Reg = MO.getReg();
if (!Reg)
continue;
// This picks up sibling registers (e.q. %al -> %ah).
for (MCRegUnit Unit : TRI.regunits(Reg))
@ -1308,8 +1310,11 @@ void PEI::insertZeroCallUsedRegs(MachineFunction &MF) {
if (!MO.isReg())
continue;
for (const MCPhysReg &Reg :
TRI.sub_and_superregs_inclusive(MO.getReg()))
MCRegister Reg = MO.getReg();
if (!Reg)
continue;
for (const MCPhysReg Reg : TRI.sub_and_superregs_inclusive(Reg))
RegsToZero.reset(Reg);
}
}