]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
match: Remove valueize_condition argument from gimple_extra template
authorAndrew Pinski <quic_apinski@quicinc.com>
Sun, 18 May 2025 07:06:38 +0000 (00:06 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Tue, 20 May 2025 19:30:07 +0000 (12:30 -0700)
After r15-4791-gb60031e8f9f8fe, the valueize_condition argument becomes
unused. I didn't notice that as there was -Wno-unused option being added
while compiling gimple-match-exports.cc. This removes that too as there are
no unused warnings.

gcc/ChangeLog:

* Makefile.in (gimple-match-exports.o-warn): Remove.
* gimple-match-exports.cc (gimple_extract): Remove valueize_condition
argument.
(gimple_extract_op): Update call to gimple_extract.
(gimple_simplify): Likewise. Also remove valueize_condition lambda.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/Makefile.in
gcc/gimple-match-exports.cc

index 72d132207c0d8ef5c2168094c4fc66761b73bd9c..366364a23deab251b1bdbb420f7d155c9d181a0f 100644 (file)
@@ -253,7 +253,6 @@ gengtype-lex.o-warn = -Wno-error
 libgcov-util.o-warn = -Wno-error
 libgcov-driver-tool.o-warn = -Wno-error
 libgcov-merge-tool.o-warn = -Wno-error
-gimple-match-exports.o-warn = -Wno-unused
 dfp.o-warn = -Wno-strict-aliasing
 
 # All warnings have to be shut off in stage1 if the compiler used then
index ccba046a1d4f6fc575ba5e3e263023f28092305e..555e8a967a0d54d97945ebfd73cad9465a6f2c71 100644 (file)
@@ -720,16 +720,14 @@ gimple_simplify (combined_fn fn, tree type,
    describe STMT in RES_OP, returning true on success.  Before recording
    an operand, call:
 
-   - VALUEIZE_CONDITION for a COND_EXPR condition
-   - VALUEIZE_OP for every other top-level operand
+   - VALUEIZE_OP for all top-level operand
 
-   Both routines take a tree argument and returns a tree.  */
+   This routine takes a tree argument and returns a tree.  */
 
-template<typename ValueizeOp, typename ValueizeCondition>
+template<typename ValueizeOp>
 inline bool
 gimple_extract (gimple *stmt, gimple_match_op *res_op,
-               ValueizeOp valueize_op,
-               ValueizeCondition valueize_condition)
+               ValueizeOp valueize_op)
 {
   switch (gimple_code (stmt))
     {
@@ -858,7 +856,7 @@ bool
 gimple_extract_op (gimple *stmt, gimple_match_op *res_op)
 {
   auto nop = [](tree op) { return op; };
-  return gimple_extract (stmt, res_op, nop, nop);
+  return gimple_extract (stmt, res_op, nop);
 }
 
 /* The main STMT based simplification entry.  It is used by the fold_stmt
@@ -873,38 +871,8 @@ gimple_simplify (gimple *stmt, gimple_match_op *res_op, gimple_seq *seq,
     {
       return do_valueize (op, top_valueize, valueized);
     };
-  auto valueize_condition = [&](tree op) -> tree
-    {
-      bool cond_valueized = false;
-      tree lhs = do_valueize (TREE_OPERAND (op, 0), top_valueize,
-                             cond_valueized);
-      tree rhs = do_valueize (TREE_OPERAND (op, 1), top_valueize,
-                             cond_valueized);
-      gimple_match_op res_op2 (res_op->cond, TREE_CODE (op),
-                              TREE_TYPE (op), lhs, rhs);
-      if ((gimple_resimplify2 (seq, &res_op2, valueize)
-          || cond_valueized)
-         && res_op2.code.is_tree_code ())
-       {
-         auto code = tree_code (res_op2.code);
-         if (TREE_CODE_CLASS (code) == tcc_comparison)
-           {
-             valueized = true;
-             return build2 (code, TREE_TYPE (op),
-                            res_op2.ops[0], res_op2.ops[1]);
-           }
-         else if (code == SSA_NAME
-                  || code == INTEGER_CST
-                  || code == VECTOR_CST)
-           {
-             valueized = true;
-             return res_op2.ops[0];
-           }
-       }
-      return valueize_op (op);
-    };
 
-  if (!gimple_extract (stmt, res_op, valueize_op, valueize_condition))
+  if (!gimple_extract (stmt, res_op, valueize_op))
     return false;
 
   if (res_op->code.is_internal_fn ())