-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[Clang][RISCV][RVV Intrinsic] Fix codegen redundant intrinsic names #77889
Conversation
Since vcreate_v uses the FixLog2LMUL, we can simply set the Log2LMUL to the smallest one to avoid creating redundant vcreate_v which contains the same intrinsic name and the same prototype.
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-clang Author: 袁銓嶽 (circYuan) ChangesThis patch avoids adding redundant vcreate_v intrinsics to the RISCV IntrinsicList. Full diff: https://github.com/llvm/llvm-project/pull/77889.diff 1 Files Affected:
diff --git a/clang/include/clang/Basic/riscv_vector.td b/clang/include/clang/Basic/riscv_vector.td
index e7d78b03511fe9..1411d5375bdadd 100644
--- a/clang/include/clang/Basic/riscv_vector.td
+++ b/clang/include/clang/Basic/riscv_vector.td
@@ -2479,9 +2479,11 @@ let HasMasked = false, HasVL = false, IRName = "" in {
}
}] in {
- defm : RVVNonTupleVCreateBuiltin<1, [0]>;
- defm : RVVNonTupleVCreateBuiltin<2, [0, 1]>;
- defm : RVVNonTupleVCreateBuiltin<3, [0, 1, 2]>;
+ let Log2LMUL = [-3] in {
+ defm : RVVNonTupleVCreateBuiltin<1, [0]>;
+ defm : RVVNonTupleVCreateBuiltin<2, [0, 1]>;
+ defm : RVVNonTupleVCreateBuiltin<3, [0, 1, 2]>;
+ }
foreach nf = NFList in {
let NF = nf in {
|
@llvm/pr-subscribers-backend-risc-v Author: 袁銓嶽 (circYuan) ChangesThis patch avoids adding redundant vcreate_v intrinsics to the RISCV IntrinsicList. Full diff: https://github.com/llvm/llvm-project/pull/77889.diff 1 Files Affected:
diff --git a/clang/include/clang/Basic/riscv_vector.td b/clang/include/clang/Basic/riscv_vector.td
index e7d78b03511fe9..1411d5375bdadd 100644
--- a/clang/include/clang/Basic/riscv_vector.td
+++ b/clang/include/clang/Basic/riscv_vector.td
@@ -2479,9 +2479,11 @@ let HasMasked = false, HasVL = false, IRName = "" in {
}
}] in {
- defm : RVVNonTupleVCreateBuiltin<1, [0]>;
- defm : RVVNonTupleVCreateBuiltin<2, [0, 1]>;
- defm : RVVNonTupleVCreateBuiltin<3, [0, 1, 2]>;
+ let Log2LMUL = [-3] in {
+ defm : RVVNonTupleVCreateBuiltin<1, [0]>;
+ defm : RVVNonTupleVCreateBuiltin<2, [0, 1]>;
+ defm : RVVNonTupleVCreateBuiltin<3, [0, 1, 2]>;
+ }
foreach nf = NFList in {
let NF = nf in {
|
Since it only reduces about 160 of 54100 intrinsics generated, I have no opinion on this, just left the final decision to others~ |
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
@circYuan do you need me to commit this for you? |
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.
Thanks, LGTM~
This patch avoids adding redundant vcreate_v intrinsics to the RISCV IntrinsicList.
Since vcreate_v uses LFixedLog2LMUL, I believe we can simply set Log2LMUL to the smallest value (-3) to prevent the creation of redundant vcreate_v instances with the same intrinsic name and prototype in the IntrinsicList when clang creates it.