-
Notifications
You must be signed in to change notification settings - Fork 14.1k
[RISCV] Remove redundant SDNode creation for same reg class value #114348
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
@llvm/pr-subscribers-backend-risc-v Author: Brandon Wu (4vtomat) ChangesFull diff: https://github.com/llvm/llvm-project/pull/114348.diff 1 Files Affected:
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index af7a39b2580a37..43de3d65de986c 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -21345,6 +21345,7 @@ bool RISCVTargetLowering::splitValueIntoRegisterParts(
}
if (ValueVT.isRISCVVectorTuple() && PartVT.isRISCVVectorTuple()) {
+#ifndef NDEBUG
unsigned ValNF = ValueVT.getRISCVVectorTupleNumFields();
[[maybe_unused]] unsigned ValLMUL =
divideCeil(ValueVT.getSizeInBits(), ValNF * RISCV::RVVBitsPerBlock);
@@ -21352,11 +21353,9 @@ bool RISCVTargetLowering::splitValueIntoRegisterParts(
[[maybe_unused]] unsigned PartLMUL =
divideCeil(PartVT.getSizeInBits(), PartNF * RISCV::RVVBitsPerBlock);
assert(ValNF == PartNF && ValLMUL == PartLMUL &&
- "RISC-V vector tuple type only accepts same register class type "
- "TUPLE_INSERT");
+ "RISC-V vector tuple type only accepts same register class copy");
+#endif
- Val = DAG.getNode(RISCVISD::TUPLE_INSERT, DL, PartVT, DAG.getUNDEF(PartVT),
- Val, DAG.getVectorIdxConstant(0, DL));
Parts[0] = Val;
return true;
}
|
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.
(Please add a description that this patch fixes comment)
@@ -21345,18 +21345,17 @@ bool RISCVTargetLowering::splitValueIntoRegisterParts( | |||
} | |||
|
|||
if (ValueVT.isRISCVVectorTuple() && PartVT.isRISCVVectorTuple()) { | |||
#ifndef NDEBUG |
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.
Is there ever case where PartVT isn't exactly equal to ValueVT? Why do we need all the math? If they aren't equal you would need at least a bitcast.
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.
It's because of fractional LMUL, I think LMUL = 1 and fractional LMUL use the same register class, do we still need a bitcast?
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.
If the types don't match then I think we need some operation to represent the type change. So I guess the original code is correct.
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.
I see, let me close this PR.
We still need this "TUPLE_INSERT" since it's possible that |
This fixes #114329 (comment)