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][GISel] Emit G_CONSTANT 0 as a copy from X0. #67202

Closed
wants to merge 2 commits into from

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Sep 22, 2023

We need to use a COPY so the register coalescer can replace reads of the register we copy to with X0. This is needed so that we use X0 on instructions that don't have an immediate form.

I've added a roundtrip test for negate to show this. I had to disable the late copy propagation pass that could see through the ADDI.

@michaelmaitland
Copy link
Contributor

Can you please add description?

Copy link
Contributor

@michaelmaitland michaelmaitland left a comment

Choose a reason for hiding this comment

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

LGTM.

…LHS of sub for negate.

I had to disable the late copy propagation pass that can see through
the ADDI we were previously emitting. We really want to get this
in the register coalescer if not even earlier.
We need to use a COPY so the register coalescer can replace reads
of the register we copy to with X0. This is needed so that we use
X0 on instructions that don't have an immediate form.
Copy link
Contributor

@michaelmaitland michaelmaitland left a comment

Choose a reason for hiding this comment

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

LGTM with the precommit. I understand the copyprop was disabled to show the diff on the pre-commit. Thanks for adding that.

topperc added a commit that referenced this pull request Sep 23, 2023
We need to use a COPY so the register coalescer can replace reads
of the register we copy to with X0. This is needed so that we use
X0 on instructions that don't have an immediate form.

This was reviewed as #67202.
@topperc topperc closed this Sep 23, 2023
@topperc topperc deleted the pr/gisel-zero branch September 23, 2023 00:09
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