This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Wed, Dec 23, 2015 at 7:30 PM, Richard Biener <richard.guenther@gmail.com> wrote: > On December 23, 2015 5:58:07 PM GMT+01:00, Uros Bizjak <ubizjak@gmail.com> wrote: >>On Wed, Dec 23, 2015 at 2:39 PM, Richard Biener >><richard.guenther@gmail.com> wrote: >>> On December 23, 2015 10:39:17 AM GMT+01:00, Uros Bizjak >><ubizjak@gmail.com> wrote: >>>>Hello! >>>> >>>>There is a logic error in Honza's patch "Transparent alias suport >>part >>>>10" [1]. The part in memrefs_conflict_p should be changed to: >>>> >>>>- /* If decls are different or we know by offsets that there is >>no >>>>overlap, >>>>- we win. */ >>>>- if (!cmp || !offset_overlap_p (c, xsize, ysize)) >>>>+ /* If decls are different and we know by offsets that >>>>+ there is no overlap, we win. */ >>>>+ if (!cmp && !offset_overlap_p (c, xsize, ysize)) >>>> return 0; >>>>- /* Decls may or may not be different and offsets overlap....*/ >>>>+ /* Decls are different and offsets overlap....*/ >>>> >>>>Even if decls are different, their offsets shouldn't overlap! >>> >>> Comparing offsets of different decls does not make sense. >> >>Uh, yes, some more eyeballing was needed, but you are right. >> >>Is there a way to detect aliasing in case AND addresses are involved? >> >>Probably we need something like in base_alias_check, where: > > Yeah, and in that case just give up. As mentioned in [1], in attached v2 patch, we return "unknown" from memrefs_conflict_p when realigned decls are processed: @@ -2339,6 +2337,12 @@ memrefs_conflict_p (int xsize, rtx x, int ysize, r /* If both decls are the same, decide by offsets. */ if (cmp == 1) return offset_overlap_p (c, xsize, ysize); + /* Assume a potential overlap for symbolic addresses that went + through alignment adjustments (i.e., that have negative + sizes), because we can't know how far they are from each + other. */ + if (xsize < 0 || ysize < 0) + return -1; /* If decls are different or we know by offsets that there is no overlap, we win. */ if (!cmp || !offset_overlap_p (c, xsize, ysize)) This is the same approach as it is done at the end of memrefs_conflict_p. We still need early return for AND addresses in base_alias_check, though. 2015-12-29 Uros Bizjak <ubizjak@gmail.com> PR middle-end/68999 * symtab.c (symtab_node::equal_address_to): Return -1 instead of 2 if we can't determine address equivalence. * alias.c (compare_base_decl): Update for changed return value of symtab_node::equal_address_to. (memrefs_conflict_p): Return -1 for different decls that went through alignment adjustments. (base_alias_check): Move check for addresses with alignment ANDs before the call for compare_base_decls. Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32} and alpha-linux-gnu native [2]. OK for mainline? [1] https://gcc.gnu.org/ml/gcc-patches/2015-12/msg02174.html [2] https://gcc.gnu.org/ml/gcc-testresults/2015-12/msg02766.html Uros.
Attachment:
p.diff.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |