[PATCH] D9375: An llvm.noalias intrinsic
Jeroen Dobbelaere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 26 10:42:17 PDT 2018
jeroen.dobbelaere added a comment.
Hi Hal,
I have a question about this: as an 'llvm.noalias' intrinsic is introduced for every 'assignment to a restrict pointer', it is not possible to see a difference between 'foo' and 'bar':
void foo(int* pA, int* pC, int n) {
int* __restrict rp;
for (int i=0; i<n; ++i) {
rp=pA+i;
*rp=42;
pC[i]=99;
}
}
void bar(int* pA, int* pC, int n) {
for (int i=0; i<n; ++i) {
int* __restrict rp;
rp=pA+i;
*rp=42;
pC[i]=99;
}
}
The problem occurs when unrolling the loop: for 'bar', the metadata must be cloned, as the restrict scope starts and ends with the loop body. For 'foo', the restrict scope resides outside the loop body and the metadata must not be cloned when unrolling.
In the more complex case, the metadata must be partially cloned (= the part that covers restrict scopes introduced inside the loop body). Any idea on an approach for differentiating between those two cases ?
https://reviews.llvm.org/D9375
More information about the llvm-commits
mailing list