]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Forwprop: boolify forward_propagate_into_comparison
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Sun, 24 Aug 2025 20:45:00 +0000 (13:45 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Mon, 25 Aug 2025 15:29:25 +0000 (08:29 -0700)
After changing the return type of remove_prop_source_from_use,
forward_propagate_into_comparison will never return 2. So boolify
forward_propagate_into_comparison.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-forwprop.cc (forward_propagate_into_comparison): Boolify.
(pass_forwprop::execute): Don't handle return of 2 from
forward_propagate_into_comparison.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/tree-ssa-forwprop.cc

index aa096f7e0122b06d985ad99d269523bfc6c6147c..9f91cf6ed3a4435e805cebaea0e6dab55d0d1048 100644 (file)
@@ -500,10 +500,9 @@ forward_propagate_into_comparison_1 (gimple *stmt,
 
 /* Propagate from the ssa name definition statements of the assignment
    from a comparison at *GSI into the conditional if that simplifies it.
-   Returns 1 if the stmt was modified and 2 if the CFG needs cleanup,
-   otherwise returns 0.  */
+   Returns true if the stmt was modified.  */
 
-static int
+static bool
 forward_propagate_into_comparison (gimple_stmt_iterator *gsi)
 {
   gimple *stmt = gsi_stmt (*gsi);
@@ -534,10 +533,10 @@ forward_propagate_into_comparison (gimple_stmt_iterator *gsi)
        remove_prop_source_from_use (rhs1);
       if (TREE_CODE (rhs2) == SSA_NAME)
        remove_prop_source_from_use (rhs2);
-      return 1;
+      return true;
     }
 
-  return 0;
+  return false;
 }
 
 /* Propagate from the ssa name definition statements of COND_EXPR
@@ -5020,13 +5019,7 @@ pass_forwprop::execute (function *fun)
                      }
 
                    if (TREE_CODE_CLASS (code) == tcc_comparison)
-                     {
-                       int did_something;
-                       did_something = forward_propagate_into_comparison (&gsi);
-                       if (did_something == 2)
-                         cfg_changed = true;
-                       changed |= did_something != 0;
-                     }
+                     changed |= forward_propagate_into_comparison (&gsi);
                    else if ((code == PLUS_EXPR
                              || code == BIT_IOR_EXPR
                              || code == BIT_XOR_EXPR)