llvm-project
4f51825e - [Clang][OpenMP] Use the associated loop's range in loop metadata (#240649)

Commit
6 hours ago
[Clang][OpenMP] Use the associated loop's range in loop metadata (#240649) The start and end locations in the `!llvm.loop` metadata of an OpenMP loop came from the directive's source range, which covers only the pragma line. Consumers of these locations, such as optimization remarks, therefore reported the loop at the `#pragma omp` line rather than at the loop. Use the range of the associated loop instead, looking through loop transformation directives such as `unroll` and `tile`. This covers the inner loop and the outer dispatch loop of dynamic, guided and chunked schedules. `sections` has no associated loop and keeps the directive range. For example, with `-fopenmp -O2 -Rpass=loop-vectorize`: 2 #pragma omp simd 3 for (int i = 0; i < n; ++i) 4 a[i] += b[i]; before: t.c:2:1: remark: vectorized loop ... after: t.c:3:3: remark: vectorized loop ... Assisted-by: Cursor / Claude Opus 5.5
Author
Parents
Loading