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

via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 00:17:59 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: 袁銓嶽 (circYuan)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/77889.diff


1 Files Affected:

- (modified) clang/include/clang/Basic/riscv_vector.td (+5-3) 


``````````diff
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 {

``````````

</details>


https://github.com/llvm/llvm-project/pull/77889


More information about the cfe-commits mailing list