]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
forwprop: Move check of limit first [PR121474]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Wed, 13 Aug 2025 16:19:42 +0000 (09:19 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Wed, 13 Aug 2025 16:29:46 +0000 (09:29 -0700)
This is the first step in handling the review part of:
https://gcc.gnu.org/pipermail/gcc-patches/2025-August/692091.html
'''
Oh, as we now do alias walks in forwprop maybe we should make this
conditional and do
this not for all pass instances, since it makes forwprop possibly a lot slower?
'''

The check of the limit was after the alias check which could slow down things.
This moves the check of the limit to begining of the if.

Bootstrapped and tested on x86_64-linux-gnu.

Pushed as obvious.

PR tree-optimization/121474
gcc/ChangeLog:

* tree-ssa-forwprop.cc (optimize_aggr_zeroprop): Move the check
for limit before the alias check.

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

index 4237a2013badec6f9c7fbe81fcadc5ee0bcfa526..2878b45b60d6be1251ea2037eaf446d89dc2cac4 100644 (file)
@@ -1401,10 +1401,10 @@ optimize_aggr_zeroprop (gimple_stmt_iterator *gsip)
 
          /* If this statement does not clobber add the vdef stmt to the
             worklist.  */
-         if (gimple_vdef (use_stmt)
+         if (limit != 0
+             && gimple_vdef (use_stmt)
              && !stmt_may_clobber_ref_p_1 (use_stmt, &read,
-                                          /* tbaa_p = */ can_use_tbba)
-             && limit != 0)
+                                          /* tbaa_p = */ can_use_tbba))
            worklist.safe_push (std::make_pair (gimple_vdef (use_stmt),
                                                limit - 1));