https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113070
--- Comment #5 from Alex Coplan <acoplan at gcc dot gnu.org> ---
(In reply to Alex Coplan from comment #4)
> So debugging the PGO/LTO failure of cactuBSSN (from SPEC CPU 2017) shows
> that we can miss updating uses immediately following an stp insn in the case
> that we insert a new stp insn (as opposed to updating an existing one).
> That can then lead to wrong code as alias analysis goes wrong as a result.
>
> I'm planning on fixing that and hopefully this will turn out to be the same
> issue.
Further to this it turns out that when I added support to rtl-ssa for inserting
new insns I missed that changes.cc:apply_changes_to_insn does:
// Add all clobbers. Sets and call clobbers never move relative to
// other definitions, so are OK as-is.
for (def_info *def : change.new_defs)
if (is_a<clobber_info *> (def) && !def->is_call_clobber ())
add_def (def);
so it won't insert new user-created defs into the def chain (which again causes
alias analysis to skip over the stps when looking at future load pair
candidates). Fixing that (together with a fix for the use issue mentioned
above) fixes the wrong code in cactuBSSN_r.
It seems likely that the same issue is causing the wrong code during LTO
profiledbootstrap, I'll test that shortly.