[llvm-branch-commits] [clang] [flang] [llvm] [OpenMP][Attributor] Infer noalias for host callback captures (PR #218453)

Tomas Matheson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Aug 26 03:49:01 PDT 2026


tommat01 wrote:

> > Is it possible / would it make sense to directly annotate these noalias in the frontend (i.e. when clang emits the outlined function)?
> 
> I hadn't considered that exactly (I tried other frontend fixes) but I think it would work for the outlined function case. The main reason for not doing it in the frontend was to not repeat the same analysis for flang etc. Also (rightly or wrongly) I just had more confidence that Attributor would do the alias analysis correctly; there might be some edge cases in the frontend that could be missed.

Alias analysis is still necessary because the address of the captured values might escape before the parallel region:
```
escaped = &value; // address of the slot escapes
#pragma omp parallel
{
  opaque(); // might access the slot via escaped pointer
  use(value);
}
```
In that case annotating the pointer to `value` with `noalias` would be wrong.

https://github.com/llvm/llvm-project/pull/218453


More information about the llvm-branch-commits mailing list