[clang] d9dd5f0 - [Clang][RISCV][RVV Intrinsic] Fix codegen redundant intrinsic names (#77889)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 25 23:23:39 PST 2024


Author: 袁銓嶽
Date: 2024-01-25T23:23:34-08:00
New Revision: d9dd5f049f16a866dcfa74d0207dd376543c1ec4

URL: https://github.com/llvm/llvm-project/commit/d9dd5f049f16a866dcfa74d0207dd376543c1ec4
DIFF: https://github.com/llvm/llvm-project/commit/d9dd5f049f16a866dcfa74d0207dd376543c1ec4.diff

LOG: [Clang][RISCV][RVV Intrinsic] Fix codegen redundant intrinsic names (#77889)

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.

Added: 
    

Modified: 
    clang/include/clang/Basic/riscv_vector.td

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/riscv_vector.td b/clang/include/clang/Basic/riscv_vector.td
index 8bde081052505d..a00ca353588ed5 100644
--- a/clang/include/clang/Basic/riscv_vector.td
+++ b/clang/include/clang/Basic/riscv_vector.td
@@ -2479,9 +2479,13 @@ let HasMasked = false, HasVL = false, IRName = "" in {
       }
       }] in {
 
-    defm : RVVNonTupleVCreateBuiltin<1, [0]>;
-    defm : RVVNonTupleVCreateBuiltin<2, [0, 1]>;
-    defm : RVVNonTupleVCreateBuiltin<3, [0, 1, 2]>;
+    // Since the vcreate_v uses LFixedLog2LMUL, setting the Log2LMUL to [-3] can
+    // avoid creating the intrinsics which contain the same name and prototype.
+    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 {


        


More information about the cfe-commits mailing list