[PATCH] D126533: [LAA] Relax pointer dependency with runtime pointer checks
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 31 01:05:11 PDT 2022
fhahn added a comment.
In D126533#3546793 <https://reviews.llvm.org/D126533#3546793>, @dmgreen wrote:
> Is this example from the summary the motivating example?
>
> struct Arrays {
> double X[128];
> double Y[128];
> double Z[128];
> double D;
> } s1;
>
> void test(Arrays *S, int n) {
> for ( int k=0 ; k<n ; k++ ) {
> S->X[k] = S->D + S->Y[k] * S->Z[k];
> }
> }
>
> GCC seems to pull the invariant load out of the loop without needing any runtime checks: https://godbolt.org/z/PPn4jP1be
> Should clang be able to do the same? It seems that GCC thinks that S->X[k] cannot alias with S->D.
I think what's missing here is that Clang/LLVM doesn't support accesses to fixed-sizes arrays in structs in TBAA. There's been a lot of discussions about improving TBAA a couple of years ago that didn't make any progress unfortunately. I'm planning to summarize the status and see if we can find a way forward to address some of the current limitations.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126533/new/
https://reviews.llvm.org/D126533
More information about the llvm-commits
mailing list