On 9 July 2019 15:37:30 CEST, Richard Biener <rguent...@suse.de> wrote: >On Tue, 9 Jul 2019, Jan Hubicka wrote: > >> Hi, >> this is updated variant I am testing. >> It documents better how function works and streamlines the checks. >> >> OK assuming it passes the tests? >> >> Honza >> >> Index: tree-ssa-alias.c >> =================================================================== >> --- tree-ssa-alias.c (revision 273193) >> +++ tree-ssa-alias.c (working copy) >> @@ -1128,6 +1128,91 @@ aliasing_component_refs_p (tree ref1, >> return false; >> } >> >> +/* FIELD1 and FIELD2 are two fields of component refs. We assume >> + that bases of both component refs are >> + (*) are either equivalent or they point to different objects. > >are either equivalent(*) or not overlapping > >> + We do not assume that FIELD1 and FIELD2 are of same type. > >that the containers of FIELD1 and FIELD2 are of the same type? > >> + >> + Return 0 if FIELD1 and FIELD2 satisfy (*). >> + This is the case when their offsets are the same. > >Hmm, so when the offsets are the same then the bases are equivalent? >I think you want to say > > Return 0 if in case the component refs satisfy (*) we > know FIELD1 and FIELD2 are overlapping exactly. > >> + Return 1 if FIELD1 and FIELD2 are non-overlapping. >> + >> + Return -1 otherwise. >> + >> + Main difference between 0 and -1 is to let >> + nonoverlapping_component_refs_since_match_p discover the >semnatically > >semantically > >otherwise looks good now. > >Thanks, >Richard. > >> + equivalent part of the access path. >> + >> + Note that this function is used even with -fno-strict-aliasing >> + and makes use of no TBAA assumptions. */ >> + >> +static int >> +nonoverlapping_component_refs_p_1 (const_tree field1, const_tree >field2) >> +{ >> + /* If both fields are of the same type, we could save hard work of >> + comparing offsets. */ >> + tree type1 = DECL_CONTEXT (field1); >> + tree type2 = DECL_CONTEXT (field2); >> + >> + if (DECL_BIT_FIELD_REPRESENTATIVE (field1)) >> + field1 = DECL_BIT_FIELD_REPRESENTATIVE (field1); >> + if (DECL_BIT_FIELD_REPRESENTATIVE (field2)) >> + field2 = DECL_BIT_FIELD_REPRESENTATIVE (field1);
Typo: s/field1/field2/ >> + >> + /* ??? Bitfields can overlap at RTL level so punt on them. >> + FIXME: RTL expansion should be fixed by adjusting the access >path >> + when producing MEM_ATTRs for MEMs which are wider than >> + the bitfields similarly as done in set_mem_attrs_minus_bitpos. >*/ >> + if (DECL_BIT_FIELD (field1) && DECL_BIT_FIELD (field2)) >> + return -1; That's a pity. thanks,