From: Richard Biener Date: Mon, 11 Aug 2025 12:43:58 +0000 (+0200) Subject: Restrict aggregate copy VN generalization X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6d9c1aad2c46092ac0e5adcaad2ea5af57fad180;p=thirdparty%2Fgcc.git Restrict aggregate copy VN generalization 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. --- diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index 61d794d8407..cdd7c0542ad 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -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;