[llvm] 749535b - [RISCV] Use tablegen HasOneUse. NFC (#133974)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 1 15:51:42 PDT 2025
Author: Craig Topper
Date: 2025-04-01T15:51:39-07:00
New Revision: 749535ba2808e133682074f712ac6829335f8875
URL: https://github.com/llvm/llvm-project/commit/749535ba2808e133682074f712ac6829335f8875
DIFF: https://github.com/llvm/llvm-project/commit/749535ba2808e133682074f712ac6829335f8875.diff
LOG: [RISCV] Use tablegen HasOneUse. NFC (#133974)
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfo.td
llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td
index c9386f2307175..89e5ad8067c1b 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td
@@ -1299,9 +1299,9 @@ def ext : PatFrags<(ops node:$A), [(sext node:$A), (zext node:$A)]>;
class binop_oneuse<SDPatternOperator operator>
: PatFrag<(ops node:$A, node:$B),
- (operator node:$A, node:$B), [{
- return N->hasOneUse();
-}]>;
+ (operator node:$A, node:$B)> {
+ let HasOneUse = 1;
+}
def and_oneuse : binop_oneuse<and>;
def mul_oneuse : binop_oneuse<mul>;
@@ -1315,9 +1315,9 @@ def mul_const_oneuse : PatFrag<(ops node:$A, node:$B),
class unop_oneuse<SDPatternOperator operator>
: PatFrag<(ops node:$A),
- (operator node:$A), [{
- return N->hasOneUse();
-}]>;
+ (operator node:$A)> {
+ let HasOneUse = 1;
+}
def sext_oneuse : unop_oneuse<sext>;
def zext_oneuse : unop_oneuse<zext>;
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
index 5d98ffedcbb9a..f80cbc9e2fb5e 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
@@ -492,101 +492,62 @@ def SDTRVVVecReduce : SDTypeProfile<1, 6, [
SDTCisVT<6, XLenVT>
]>;
-def riscv_add_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
- node:$E),
- (riscv_add_vl node:$A, node:$B, node:$C,
- node:$D, node:$E), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_sub_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
- node:$E),
- (riscv_sub_vl node:$A, node:$B, node:$C,
- node:$D, node:$E), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_mul_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
- node:$E),
- (riscv_mul_vl node:$A, node:$B, node:$C,
- node:$D, node:$E), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_vwmul_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
+let HasOneUse = 1 in {
+ def riscv_add_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
node:$E),
- (riscv_vwmul_vl node:$A, node:$B, node:$C,
- node:$D, node:$E), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_vwmulu_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
- node:$E),
- (riscv_vwmulu_vl node:$A, node:$B, node:$C,
- node:$D, node:$E), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_vwmulsu_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
+ (riscv_add_vl node:$A, node:$B, node:$C,
+ node:$D, node:$E)>;
+ def riscv_sub_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
+ node:$E),
+ (riscv_sub_vl node:$A, node:$B, node:$C,
+ node:$D, node:$E)>;
+ def riscv_mul_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
+ node:$E),
+ (riscv_mul_vl node:$A, node:$B, node:$C,
+ node:$D, node:$E)>;
+ def riscv_vwmul_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
node:$E),
- (riscv_vwmulsu_vl node:$A, node:$B, node:$C,
- node:$D, node:$E), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_sext_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C),
- (riscv_sext_vl node:$A, node:$B, node:$C), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_zext_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C),
- (riscv_zext_vl node:$A, node:$B, node:$C), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_ext_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C),
- (riscv_ext_vl node:$A, node:$B, node:$C), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_fpextend_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C),
- (riscv_fpextend_vl node:$A, node:$B, node:$C), [{
- return N->hasOneUse();
-}]>;
+ (riscv_vwmul_vl node:$A, node:$B, node:$C,
+ node:$D, node:$E)>;
+ def riscv_vwmulu_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
+ node:$E),
+ (riscv_vwmulu_vl node:$A, node:$B, node:$C,
+ node:$D, node:$E)>;
+ def riscv_vwmulsu_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
+ node:$E),
+ (riscv_vwmulsu_vl node:$A, node:$B, node:$C,
+ node:$D, node:$E)>;
+ def riscv_sext_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C),
+ (riscv_sext_vl node:$A, node:$B, node:$C)>;
+ def riscv_zext_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C),
+ (riscv_zext_vl node:$A, node:$B, node:$C)>;
+ def riscv_ext_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C),
+ (riscv_ext_vl node:$A, node:$B, node:$C)>;
+ def riscv_fpextend_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C),
+ (riscv_fpextend_vl node:$A, node:$B, node:$C)>;
+ def riscv_vfmadd_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
+ node:$E),
+ (riscv_vfmadd_vl node:$A, node:$B,
+ node:$C, node:$D, node:$E)>;
+ def riscv_vfnmadd_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
+ node:$E),
+ (riscv_vfnmadd_vl node:$A, node:$B,
+ node:$C, node:$D, node:$E)>;
+ def riscv_vfmsub_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
+ node:$E),
+ (riscv_vfmsub_vl node:$A, node:$B,
+ node:$C, node:$D, node:$E)>;
+ def riscv_vfnmsub_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
+ node:$E),
+ (riscv_vfnmsub_vl node:$A, node:$B,
+ node:$C, node:$D, node:$E)>;
+} // HasOneUse = 1
def riscv_fpextend_vl_sameuser : PatFrag<(ops node:$A, node:$B, node:$C),
(riscv_fpextend_vl node:$A, node:$B, node:$C), [{
return !N->use_empty() && all_equal(N->users());
}]>;
-def riscv_vfmadd_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
- node:$E),
- (riscv_vfmadd_vl node:$A, node:$B,
- node:$C, node:$D, node:$E), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_vfnmadd_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
- node:$E),
- (riscv_vfnmadd_vl node:$A, node:$B,
- node:$C, node:$D, node:$E), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_vfmsub_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
- node:$E),
- (riscv_vfmsub_vl node:$A, node:$B,
- node:$C, node:$D, node:$E), [{
- return N->hasOneUse();
-}]>;
-
-def riscv_vfnmsub_vl_oneuse : PatFrag<(ops node:$A, node:$B, node:$C, node:$D,
- node:$E),
- (riscv_vfnmsub_vl node:$A, node:$B,
- node:$C, node:$D, node:$E), [{
- return N->hasOneUse();
-}]>;
-
foreach kind = ["ADD", "UMAX", "SMAX", "UMIN", "SMIN", "AND", "OR", "XOR",
"FADD", "SEQ_FADD", "FMIN", "FMAX"] in
def rvv_vecreduce_#kind#_vl : SDNode<"RISCVISD::VECREDUCE_"#kind#"_VL", SDTRVVVecReduce>;
More information about the llvm-commits
mailing list