On Mon, Nov 28, 2011 at 12:16:45PM -0700, Jeff Law wrote: > > On the following testcase the volatile load/store are optimized > > away. IMHO this is a bug in forwprop, which replaces tmp_Y = > > &nonvolvar[arg_X]; MEM[(volatile ...*)tmp_Y] ={v} ...; with > > MEM[(volatile ...*)&nonvolvar][tmp_Y] ={v} ...; where the LHS is no > > longer TREE_THIS_VOLATILE like before, TREE_THIS_VOLATILE is newly > > only the MEM_REF operand of the non-volatile ARRAY_REF. This patch > > copies the TREE_THIS_VOLATILE bit to the ARRAY_REF. > > > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for > > trunk? > > > > 2011-11-28 Jakub Jelinek <ja...@redhat.com> > > > > PR tree-optimization/50078 * tree-ssa-forwprop.c > > (forward_propagate_addr_expr_1): Copy over TREE_THIS_VOLATILE also > > from the old to new lhs resp. rhs. > > > > * gcc.dg/pr50078.c: New test. > Do we need to copy NOTRAP or any of the other flags? > > OK, assuming we don't need to copy NOTRAP, etc. If those need to be > copied too, preapproved with those changes.
I had there TREE_THIS_NOTRAP as well in the first iteration, but it ICEd, as TREE_THIS_NOTRAP is not valid e.g. on COMPONENT_REF. Jakub