]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Restrict aggregate copy VN generalization
authorRichard Biener <rguenther@suse.de>
Mon, 11 Aug 2025 12:43:58 +0000 (14:43 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 12 Aug 2025 06:36:55 +0000 (08:36 +0200)
The following avoids ending up with a MEM_REF as component to apply.

* tree-ssa-sccvn.cc (vn_reference_lookup_3): When we fail to
match up the two base MEM_REFs, fail.

gcc/tree-ssa-sccvn.cc

index 61d794d84072b8668896840d856ecfdd875ea376..cdd7c0542add444d10e9845f6c825ed6d22041c2 100644 (file)
@@ -3631,7 +3631,12 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
            {
              extra_off = vr->operands[i].off - lhs_ops[j].off;
              i--, j--;
+             found = true;
            }
+         /* If we did find a match we'd eventually append a MEM_REF
+            as component.  Don't.  */
+         if (!found)
+           return (void *)-1;
        }
       else
        return (void *)-1;