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] Eliminate dead li after emitting VSETVLIs #65934

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

dtcxzyw
Copy link
Member

@dtcxzyw dtcxzyw commented Sep 11, 2023

As discussed in D158759, RISCVInsertVSETVLI introduces dead li instructions. These instructions were exceptionally rewritten by the following peephole pass RISCVDeadRegisterDefinitions.

This patch tracks li instructions that set AVL operands and does DCE after emitting VSETVLIs.

@dtcxzyw dtcxzyw requested a review from a team as a code owner September 11, 2023 08:18
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp Outdated Show resolved Hide resolved
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp Outdated Show resolved Hide resolved
@dtcxzyw
Copy link
Member Author

dtcxzyw commented Sep 24, 2023

Ping.

@dtcxzyw
Copy link
Member Author

dtcxzyw commented Oct 3, 2023

Ping.

@dtcxzyw
Copy link
Member Author

dtcxzyw commented Oct 11, 2023

Gentle ping.

@dtcxzyw
Copy link
Member Author

dtcxzyw commented Oct 16, 2023

Ping.

@dtcxzyw
Copy link
Member Author

dtcxzyw commented Oct 30, 2023

Ping.

@topperc
Copy link
Collaborator

topperc commented Oct 30, 2023

@preames do you have concerns with this patch?

@dtcxzyw dtcxzyw requested a review from lukel97 November 8, 2023 16:43
@lukel97
Copy link
Contributor

lukel97 commented Nov 8, 2023

Oh nice, I'm running into something similar in #71657. Are all these dead ADDIs coming from the backwards local postpass?

@dtcxzyw
Copy link
Member Author

dtcxzyw commented Nov 11, 2023

Oh nice, I'm running into something similar in #71657. Are all these dead ADDIs coming from the backwards local postpass?

Yes. I believe this PR can address the issue.

@lukel97
Copy link
Contributor

lukel97 commented Nov 13, 2023

Oh nice, I'm running into something similar in #71657. Are all these dead ADDIs coming from the backwards local postpass?

Yes. I believe this PR can address the issue.

My suspicion is that these LIs only become dead because the backwards local postpass deletes a vsetvli that had an ADDI AVL. Would it be easier then to just check if they are dead in doLocalPostpass rather than keeping around a vector of instructions? I.e. something similar to 8ae868b

@dtcxzyw dtcxzyw force-pushed the rv-vsetvli-post-dce branch 2 times, most recently from eddadd5 to f38258e Compare November 13, 2023 12:38
llvm/lib/Target/RISCV/RISCVInstrInfo.h Outdated Show resolved Hide resolved
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp Outdated Show resolved Hide resolved
@dtcxzyw
Copy link
Member Author

dtcxzyw commented Nov 20, 2023

Ping.

1 similar comment
@dtcxzyw
Copy link
Member Author

dtcxzyw commented Dec 13, 2023

Ping.

Copy link
Contributor

@lukel97 lukel97 left a comment

Choose a reason for hiding this comment

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

LGTM

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp Outdated Show resolved Hide resolved
@dtcxzyw dtcxzyw merged commit 3564c85 into llvm:main Dec 13, 2023
3 of 4 checks passed
@dtcxzyw dtcxzyw deleted the rv-vsetvli-post-dce branch December 13, 2023 15:18
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

7 participants