https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128637
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #3) > So I think there's two issues. One is r12-3918-g5b8b1522e04adc recording a > load expression value at the original memory state, not capturing TBAA > skipped stores > (and framing the use of last_vuse as optimization). The other is that when > we depend on last_vuse for correctness we cannot at the same time use it for > the memory state of the full expression but collect its value from multiple > definitions where that process might skip further defs - those are not > reflected as last_vuse is that of the first partial def visited. > > When r12-3918 is reverted the earlier last_vuse then re-validates skipped > defs but for the partial def skipped defs we'd have to track all defs > used and walk defs from last_vuse till the last def used to see if there > are additional defs. That tracking requires more than a single memory > state (but it would be opt-in for expressions with partial-def combined > values). > The cheaper alternative would be to disable TBAA after hitting the first > partial-def. Hmm, so yes, the partial-def issue is real, the other not, r12-3918 should be OK as it only affects loads value-numbered VARYING where it doesn't really make sense to record a the earlier memory state (what we'd record there would depend on exactly where --param sccvn-max-alias-queries-per-access would end walking). So the partial-def case via vn_walk_cb_data::finish performs the problematical hash-table insertion. Disabling TBAA isn't trivial, the alias walk has it's tbaa flag set upfront and the ao_ref is not in the vn_walk_cb_data data. That still looks like the most promising fix.
