This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/84747] New: alias analysis reports may-conflict for references to disjoint address spaces
- From: "stefan at reservoir dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 07 Mar 2018 11:26:20 +0000
- Subject: [Bug c/84747] New: alias analysis reports may-conflict for references to disjoint address spaces
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84747
Bug ID: 84747
Summary: alias analysis reports may-conflict for references to
disjoint address spaces
Product: gcc
Version: 7.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: stefan at reservoir dot com
Target Milestone: ---
Created attachment 43584
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43584&action=edit
patch to improve alias analysis for disjoint address spaces
For an out-of-tree target that supports address spaces the aliaser does not
report that references to distinct non-overlapping address spaces don’t
conflict. The following program shows this failure when compiled with gcc 7.3
and ‘–O’:
typedef int v4si __attribute__((__vector_size__(16)));
v4si
foo (__seg_gs v4si* ap, v4si* gp)
{
*gp += (v4si){1,1,1,1};
*ap = (v4si){1,2,3,4};
return *gp;
}
To wit, the store ‘*ap =’ should not kill the available value of ‘*gp +=’ of
the preceding line, hence no reload of ‘*gp’ should be needed for the return.
The attached patch eliminates the load for the return, both in tree-ssa-alias.c
(ME) and alias.c (BE). The latter is included for completeness.
This target also supports some references to a special address space with some
side effects that cannot be described by the IR. We use intrinsics to perform
these operations. These intrinsics should not kill references to the generic
address space. To accomplish this, the attached patch also provides target
hooks to leave it to the target specific code to decide whether these
intrinsics conflict with other references. These hooks are not yet documented
since I wasn’t sure in which section they should be documented.
Finally, the patch includes a warning for conversions between pointers to
non-overlapping address spaces that are not known to be null pointers, as such
conversions are ill defined.