https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69891
--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > But the memset could be also SIBLING_CALL_P. > Wouldn't it be better to change the else if to if, and add > if (const_call) return; > plus return to the end of mems_found == 1 then block? Then it would fall > through to arbitrary other call handling. That would unnecessarily add a wild read. So what about: Index: dse.c =================================================================== --- dse.c (revision 233545) +++ dse.c (working copy) @@ -2528,6 +2528,10 @@ scan_insn (bb_info_t bb_info, rtx_insn * i_ptr = i_ptr->next_local_store; } + /* But a call to memset clobbers memory so invalidates stores. It's + not only an optimization issue (the previous stores may be dead) + but also a correctness issue since the previous stores cannot be + seen as the source of the current value of the locations. */ if (memset_call) { rtx args[3]; @@ -2556,6 +2560,8 @@ scan_insn (bb_info_t bb_info, rtx_insn * active_local_stores = insn_info; } } + else if (!SIBLING_CALL_P (insn)) + reset_active_stores (); } } else if (SIBLING_CALL_P (insn) && reload_completed)