https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39612
--- Comment #39 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:f9e1ea10e657af9fb02fafecf1a600740fd34409 commit r11-39-gf9e1ea10e657af9fb02fafecf1a600740fd34409 Author: Richard Biener <rguent...@suse.de> Date: Thu Apr 30 10:47:15 2020 +0200 tree-optimization/39612 - avoid issueing loads in SM when possible Currently store-motion emits a load of the value in the loop preheader even when the original loop does not contain any read of the reference. This avoids doing this. In the conditional store-motion case we need to mark the sunk stores with no-warning since the control dependence is too tricky to figure out for the uninit warning. 2020-05-04 Richard Biener <rguent...@suse.de> PR tree-optimization/39612 * tree-ssa-loop-im.c (im_mem_ref::loaded): New member. (set_ref_loaded_in_loop): New. (mark_ref_loaded): Likewise. (gather_mem_refs_stmt): Call mark_ref_loaded for loads. (execute_sm): Avoid issueing a load when it was not there. (execute_sm_if_changed): Avoid issueing warnings for the conditional store. * gcc.dg/tree-ssa/pr39612.c: New testcase.