https://gcc.gnu.org/g:45a56f42b4909e2ae0d1ad35dab05c5c092a14bc

commit r16-3130-g45a56f42b4909e2ae0d1ad35dab05c5c092a14bc
Author: Richard Biener <rguent...@suse.de>
Date:   Mon Aug 11 10:46:12 2025 +0200

    tree-optimization/121362 - fixup thinko in earlier change
    
    The following fixes the index guards on the component stripping
    loops, I swapped them it seems.
    
            PR tree-optimization/121362
            * tree-ssa-sccvn.cc (vn_reference_lookup_3): Swap index
            guards on component stripping loops.

Diff:
---
 gcc/tree-ssa-sccvn.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index ccd80806263b..866d49c15a10 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -3573,7 +3573,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void 
*data_,
             try finding a match in one of the outer components and continue
             stripping there.  This happens when addresses of components get
             forwarded into dereferences.  */
-         if (j > 0)
+         if (i > 0)
            {
              int temi = i - 1;
              extra_off = vr->operands[i].off;
@@ -3598,7 +3598,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void 
*data_,
                  temi--;
                }
            }
-         if (!found && i > 0)
+         if (!found && j > 0)
            {
              int temj = j - 1;
              extra_off = -lhs_ops[j].off;

Reply via email to