Skip to content

[CodeGen] Add assertion to MachineBasicBlock::addLiveIn and friends #140527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jayfoad
Copy link
Contributor

@jayfoad jayfoad commented May 19, 2025

Assert that the MCRegister passed into addLiveIn, removeLiveIn, isLiveIn
and computeRegisterLiveness is physical.

Assert that the MCRegister passed into addLiveIn, removeLiveIn, isLiveIn
and computeRegisterLiveness is physical.
@jayfoad jayfoad requested review from RKSimon, topperc and vg0204 May 19, 2025 10:49
Comment on lines 506 to 507
if (Op.isReg() && Op.getReg() != MCRegister::NoRegister &&
MBB->isLiveIn(Op.getReg()))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not convinced this is the right place to do this. It avoids failures in a couple of MIR tests which have $noreg in the input:

Failed Tests (2):
  LLVM :: CodeGen/X86/callbr-asm-outputs-regallocfast.mir
  LLVM :: CodeGen/X86/regallocfast-callbr-asm-spills-after-reload.mir

@@ -503,7 +503,8 @@ bool RegAllocFastImpl::mayBeSpillFromInlineAsmBr(const MachineInstr &MI) const {
if (MBB->isInlineAsmBrIndirectTarget() && TII->isStoreToStackSlot(MI, FI) &&
MFI->isSpillSlotObjectIndex(FI))
for (const auto &Op : MI.operands())
if (Op.isReg() && MBB->isLiveIn(Op.getReg()))
if (Op.isReg() && Op.getReg() != MCRegister::NoRegister &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Op.getReg() or Op.getReg().isValid()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants