]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
phiprop: Move the check on vuse before the dominator tests
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 27 Mar 2026 22:42:16 +0000 (15:42 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Tue, 28 Apr 2026 18:02:08 +0000 (11:02 -0700)
This again is some small optimization of the order of checks here.
The dom tests don't say if the prop can happen any more so putting
them after tests that will cause the prop not to happen is a good thing.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-phiprop.cc (propagate_with_phi): Move vuse checks
before the dominator tests.

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

index 2ee67d6130be634720aff38db7986ceca24567b5..873cff1c15efe668b8e55e57a511c74a6314c764 100644 (file)
@@ -385,6 +385,10 @@ propagate_with_phi (basic_block bb, gphi *vphi, gphi *phi,
            && !gimple_has_volatile_ops (use_stmt)))
        continue;
 
+      tree vuse = gimple_vuse (use_stmt);
+      if (!can_handle_load (use_stmt, bb, vphi, up_vuse))
+       continue;
+
       bool aggregate = false;
       if (!is_gimple_reg_type (TREE_TYPE (gimple_assign_lhs (use_stmt))))
        aggregate = true;
@@ -412,10 +416,6 @@ propagate_with_phi (basic_block bb, gphi *vphi, gphi *phi,
                                           gimple_bb (use_stmt)->loop_father)))))
        delay = true;
 
-      tree vuse = gimple_vuse (use_stmt);
-      if (!can_handle_load (use_stmt, bb, vphi, up_vuse))
-       goto next;
-
       /* Found a proper dereference with an aggregate copy.  Just
          insert aggregate copies on the edges instead.  */
       if (aggregate)