https://gcc.gnu.org/g:11f7d5648c42cd2ef6f0841cde6292b94831e7b6

commit r16-3186-g11f7d5648c42cd2ef6f0841cde6292b94831e7b6
Author: Andrew Pinski <andrew.pin...@oss.qualcomm.com>
Date:   Wed Aug 13 09:19:42 2025 -0700

    forwprop: Move check of limit first [PR121474]
    
    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.pin...@oss.qualcomm.com>

Diff:
---
 gcc/tree-ssa-forwprop.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index 4237a2013bad..2878b45b60d6 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -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));

Reply via email to