https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118873
--- Comment #3 from Konstantinos Eleftheriou <konstantinos.eleftheriou at vrull dot eu> --- This is no longer reproducible since 04f33a278557c09d3aba978fe205cc2a6caa8efb, which rejects the ASF transformation for this testcase. The rejection comes from the first store partially overlapping the load without being contained in it. Here's the precise trace. Byte ranges (p is int *, so p+4 = +16 bytes, p+8 = +32 bytes): *(v8si *)p = a; // STORE1: 32B at offset 0 -> [0, 32) *(v4si *)(p+8) = b; // STORE2: 16B at offset 32 -> [32, 48) a = *(v8si *)(p+4); // LOAD: 32B at offset 16 -> [16, 48) Pass walk (avoid_store_forwarding, FOR_EACH_VEC_ELT_REVERSE - nearest store to the load first): 1. STORE2 [32,48) -> is_store_forwarding calls known_subrange_p(32, 16, 16, 32): is [32,48) subset of [16,48)? yes. Pushed to forwardings. 2. STORE1 [0,32) -> known_subrange_p(0, 32, 16, 32): is [0,32) subset of [16,48)? no -> is_store_forwarding returns false. It then hits the true_dependence arm: STORE1 aliases the load (overlap [16,32)), so: it->remove = true; remove_rest = true; forwardings.truncate (0); // ← discards the valid STORE2 candidate too After that, the loop forwardings are empty, so process_store_forwarding is never called.
