On Fri, 15 Apr 2011, Martin Jambor wrote: > Hi, > > in order to speed up astar, I had to persuade the function that > decides whether a statement potentially modifies the dynamic type of > an object by storing a new value to the VMT pointer to consider the > following statement harmless (all types are integers of some sort): > > MEM[(i32 *)b2arp_3(D) + 8B] = 0; > > I'd like to experiment with this routine a bit more once I have some > other IPA-CP infrastructure in place but at the moment I opted for a > simple solution: All scalar non-pointer stores are deemed safe. > > VMT pointer is a compiler generated field which is a pointer so legal > user code is not able to store stuff there through some fancy type > casts and compiler generated code should have no reason whatsoever to > that either. Therefore I believe this change is safe and useful. > > I have bootstrapped and tested the patch on x886_64-linux. OK for > trunk?
I think this should be only done for -fstrict-aliasing. Ok with that change. Richard. > Thanks, > > Martin > > > > 2011-04-14 Martin Jambor <mjam...@suse.cz> > > * ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar > non-pointer assignments. > > Index: src/gcc/ipa-prop.c > =================================================================== > --- src.orig/gcc/ipa-prop.c > +++ src/gcc/ipa-prop.c > @@ -405,13 +405,18 @@ stmt_may_be_vtbl_ptr_store (gimple stmt) > { > tree lhs = gimple_assign_lhs (stmt); > > - if (TREE_CODE (lhs) == COMPONENT_REF > - && !DECL_VIRTUAL_P (TREE_OPERAND (lhs, 1)) > - && !AGGREGATE_TYPE_P (TREE_TYPE (lhs))) > + if (!AGGREGATE_TYPE_P (TREE_TYPE (lhs))) > + { > + if (!POINTER_TYPE_P (TREE_TYPE (lhs))) > return false; > - /* In the future we might want to use get_base_ref_and_offset to find > - if there is a field corresponding to the offset and if so, proceed > - almost like if it was a component ref. */ > + > + if (TREE_CODE (lhs) == COMPONENT_REF > + && !DECL_VIRTUAL_P (TREE_OPERAND (lhs, 1))) > + return false; > + /* In the future we might want to use get_base_ref_and_offset to find > + if there is a field corresponding to the offset and if so, proceed > + almost like if it was a component ref. */ > + } > } > return true; > } > > -- Richard Guenther <rguent...@suse.de> Novell / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex