https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106075
--- Comment #12 from rguenther at suse dot de <rguenther at suse dot de> --- On Mon, 8 May 2023, ebotcazou at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106075 > > --- Comment #11 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > > Eric, maybe you can help with RTL DSE here? > > The problem is that add_non_frame_wild_read is exclusive, i.e. the read is > turned into a read from *only* non-frame memory, but can_throw_external > is conservative and may return true for a read from frame memory: > > (insn 15 13 16 4 (set (reg:QI 87 [ _20 ]) > (mem:QI (plus:DI (reg/f:DI 100) > (reg:DI 92 [ ivtmp.23 ])) [8 MEM <character> > [(interfaces__unsigned_32 *)&value.4 + ivtmp.23_39 * 1]+0 S1 A8])) > "opt47.adb":22:13 91 {*movqi_internal} > > value.4 is a local variable but can_throw_external return true on the read. Ah - interesting. I wonder how the CALL handling is correct in using add_non_frame_wild_read then for the case we pass the address of a frame variable to it. So I suppose add_wild_read () would do the trick. > So you would need to implement an inclusive version of add_non_frame_wild_read > but the change is going to pessimize Ada and Go if the condition to invoke it > is not made more precise. So better would be to include the original effects of the insn _plus_ the non-frame wild read effect. I'm defering this for now, the problem went unnoticed for long, so ...