Skip to content
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

[RISCV] Extend InstSeq (used in constant mat) to support multiple live regs #67159

Closed

Conversation

preames
Copy link
Collaborator

@preames preames commented Sep 22, 2023

Posted mostly for discussion. This turned out to be more invasive and fiddly than I'd expected when I first started. My guess is that we probably won't land this, but I wanted to show what the option looked like.

This moves the logic for constant materialization with an additional vreg into common code. It does so by extending the InstSeq construct to support multiple live values in the sequence. This converts an InstSeq from being a linear chain of instructions to being a DAG of instructions.

Note that the emergency-slot.mir test change is in principle a bug fix; we're setting kill flags on a register which has later usage. Its probably an uninteresting bug in practice since it only happens on X0 which is a constant physreg and thus the kill flag is fairly meaningless.

…e regs

This moves the logic for constant materialization with an additional vreg into common code.  It does so by extending the InstSeq construct to support multiple live values in the sequence.  This converts an InstSeq from being a linear chain of instructions to being a DAG of instructions.

Note that the emergency-slot.mir test change is in principle a bug fix; we're setting kill flags on a register which has later usage.  Its probably an uninteresting bug in practice since it only happens on X0 which is a constant physreg and thus the kill flag is fairly meaningless.
case RISCVMatInt::RegReg:
BuildMI(MBB, MBBI, DL, get(Inst.getOpcode()), DstReg)
.addReg(SrcReg, RegState::Kill)
.addReg(SrcReg, RegState::Kill)
.addReg(SrcReg0, getKillRegState(SrcReg0 != RISCV::X0))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mind if I extract this part of the patch and commit it regardless of the rest?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, go ahead.

topperc added a commit that referenced this pull request Sep 25, 2023
@preames preames closed this Oct 26, 2023
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.

None yet

3 participants