https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48885
vries at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org, | |vries at gcc dot gnu.org --- Comment #10 from vries at gcc dot gnu.org --- The current implementation of restrict is based on clique/base pairs. For the example ... void test (int *a, int *b, int * restrict v) { *a = *v; *b = *v; } ... we get *v annotated with clique/base 1/1. I wonder if we can reserve a base in each clique as non-restrict base, and annotate like this: - *a : 1/non-restrict - *b : 1/non-restrict - *v : 1/1 This way: - *a and *b would still potentially alias - *a and *v would be disambiguated, and - not annotated memory references would not be impacted This would only work with top-level restrict though. We would have to take care in an example like this: ... void f (int *__restrict__ &__restrict__ p, int *p2) { *p = 1; *p2 = 2; } void g (int *__restrict__ gp) { f (gp, gp); } ... Currently we annotate this as: ... void f(int* __restrict__&, int*) (intD.9 * restrict & restrict pD.2252, intD.9 * p2D.2253) { intD.9 * _3; # VUSE <.MEM_1(D)> # PT = { D.2265 } (nonlocal) _3 = MEM[(intD.9 * restrict &)p_2(D) clique 1 base 1]; # .MEM_4 = VDEF <.MEM_1(D)> MEM[(intD.9 *)_3 clique 1 base 2] = 1; # .MEM_6 = VDEF <.MEM_4> *p2_5(D) = 2; ... In this case, p2 cannot alias with clique 1/base 1, since it's a toplevel restrict. But p2 can alias with clique 1/base 2, because it's not a toplevel restrict. So, if we f.i. register MR_DEPENDENCE_TOPLEVEL (in addition to MR_DEPENDENCE_CLIQUE and MR_DEPENDENCE_BASE), we can disambiguate: - normal bases within the same clique if they're different, and - a non-restrict base vs a toplevel base.