[PATCH] D103907: [LV] Parallel annotated loop does not imply all loads can be hoisted.
Michael Kruse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 10 11:18:40 PDT 2021
Meinersbur added a comment.
I am in favor of this. Would be great if we had another person had a look. @pjaaskel? @fhahn?
To make another case: I think this kind speculation causes undefined behaviour/implementation-dependent semantics. For example:
#pragma omp simd // adds llvm.loop.parallel_accesses
for (int i = 0; i < N; i+=1) {
double *C = i ? A : B;
V = C[i].;
}
which an optimization might transform to
#pragma omp simd
for (int i = 0; i < N; i+=1) {
if (i)
V = A[i];
if (!i)
V = *B;
}
This moved from an unconditional memory access (no if-conversion) to two speculable accesses. In cases such as `N == 1`, A was never accessed (and might not have been allocated), but it would after an if-conversion. IMHO it is not predictable what memory is going to accessed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103907/new/
https://reviews.llvm.org/D103907
More information about the llvm-commits
mailing list