https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65391
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization CC| |rguenth at gcc dot gnu.org Component|middle-end |tree-optimization Summary|unnecessary load of |missed store motion for |conditionally updated |conditionally updated |pointer in loop |pointer in loop --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- The issue is that invariant/store motion doesn't see the unconditional store to *o_ptr before the loop and thus thinks that the conditional one may trap. LIM doesn't consider stores/loads in blocks that are post-dominated by the loop header to alter that loops "effectively accessed" set of references. I think considering only the loop preheader is good enough - but we also do not analyze memory references in non-loop areas (loop preheaders would need to be added here as well).