Skip to content

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Oct 3, 2025

It's nonsensical to call this function on a physical register.

arsenm added 5 commits October 3, 2025 15:27
This constrainRegClass check would never pass for a physical
register.
This is trying to constrain the register class of a physical register,
which makes no sense.
It's nonsensical to call constrainRegClass on a physical register,
and we should not see virtual registers here.
We do not need to reconstrain physical registers. Enables an
additional fold for constant physregs.
It's nonsensical to call this function on a physical register.
@arsenm arsenm marked this pull request as ready for review October 3, 2025 06:31

const TargetRegisterClass *MachineRegisterInfo::constrainRegClass(
Register Reg, const TargetRegisterClass *RC, unsigned MinNumRegs) {
if (Reg.isPhysical())
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if someone unkonwingly uses this function post-RA?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will assert

Base automatically changed from users/arsenm/amdgpu/fix-attempt-constrain-constant-physreg to main October 3, 2025 12:20
@arsenm arsenm merged commit 2ff635d into main Oct 3, 2025
13 checks passed
@arsenm arsenm deleted the users/arsenm/codegen/stop-checking-physreg-constrainRegClass branch October 3, 2025 12:21
MixedMatched pushed a commit to MixedMatched/llvm-project that referenced this pull request Oct 3, 2025
It's nonsensical to call this function on a physical register.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants