-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[RISCV] Remove duplicate WriteRes<WriteJalr for MIPSP8700. #123865
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
Conversation
We had two WriteRes for WriteJalr with difference latencies. I don't know which is correct. I chose Latency=2 to match WriteJal.
@llvm/pr-subscribers-tablegen @llvm/pr-subscribers-backend-risc-v Author: Craig Topper (topperc) ChangesWe had two WriteRes for WriteJalr with difference latencies. I don't know which is correct. I chose Latency=2 to match WriteJal. Full diff: https://github.com/llvm/llvm-project/pull/123865.diff 1 Files Affected:
diff --git a/llvm/lib/Target/RISCV/RISCVSchedMIPSP8700.td b/llvm/lib/Target/RISCV/RISCVSchedMIPSP8700.td
index 550f83a59b8b0e..ab6402dc96af10 100644
--- a/llvm/lib/Target/RISCV/RISCVSchedMIPSP8700.td
+++ b/llvm/lib/Target/RISCV/RISCVSchedMIPSP8700.td
@@ -125,7 +125,6 @@ def : WriteRes<WriteCSR, [p8700ALQ]>;
// Handle CTI Pipeline.
def : WriteRes<WriteJmp, [p8700IssueCTI]>;
-def : WriteRes<WriteJalr, [p8700IssueCTI]>;
let Latency = 2 in {
def : WriteRes<WriteJal, [p8700IssueCTI]>;
def : WriteRes<WriteJalr, [p8700IssueCTI]>;
|
(Actually I think the latency of jal/jalr doesn't matter at all, since they are scheduling boundaries anyway.) |
What about llvm-mca? |
llvm-mca assumes the latency is 100 (can be specified via llvm-project/llvm/lib/MCA/InstrBuilder.cpp Lines 222 to 237 in 7c58d63
And I just found that we don't set |
JAL/JALR isn't a "call" if the destination register is X0. So we have to analyze the operands. We have RISCVMCInstrAnalysis in the MC layer for this. Maybe llvm-mca should use that if it isn't? |
Yeah! I have done it in #123882. |
Actually, both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Is this something we should enforce in TableGen -- no duplicates allowed? |
does #123876 enforce this? Specifically when it's adding new WriteRes into the map. |
Yes. It was enforce previously, but #92202 broke it. Without the early exit in the loop we would find two different WriteRes with the same WriteType. #123876 adds back enforcement when we add to the map. |
We had two WriteRes for WriteJalr with difference latencies. Drop the duplicate and change the latency of Jal to 1.