https://github.com/circYuan created 
https://github.com/llvm/llvm-project/pull/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.

From 8562ac9ab907c3b99b3890792c0f288c0e61588d Mon Sep 17 00:00:00 2001
From: Tony Chuan-Yue Yuan <yuan...@andestech.com>
Date: Fri, 12 Jan 2024 15:31:45 +0800
Subject: [PATCH] [Clang][RISCV][RVV Intrinsic] Fix codegen redundant intrinsic
 names

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.
---
 clang/include/clang/Basic/riscv_vector.td | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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 {

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to