https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115388

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's DSE5 deleting

  Deleted dead store: a[b.19_216] = 1;

there's a big irreducible region following the loop with this store, but
I fail to see how we can reach the load without going through the other
redundant store.

Ah, wait - it's the same as with loops in irreducible regions and triggering
a latent issue.  We do

                      /* If we visit this PHI by following a backedge then we
                         have to make sure ref->ref only refers to SSA names
                         that are invariant with respect to the loop
                         represented by this PHI node.  */
                      if (dominated_by_p (CDI_DOMINATORS, gimple_bb (stmt),
                                          gimple_bb (use_stmt))
                          && !for_each_index (ref->ref ? &ref->ref :
&ref->base,
                                              check_name, gimple_bb
(use_stmt)))
                        return DSE_STORE_LIVE;

but we identify backedges by using dominators which only works for natural
loops and not irreducible regions.  We have to either disregard all refs in
irreducible regions or check for invariantness in the irreducible (sub-)region
spanned by the PHI and the backedge source.

I'm going to check the latter.

Reply via email to