[clang] [Clang][OpenMP] Only defer loop analysis in a dependent context (PR #226805)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 30 01:17:21 PDT 2026
https://github.com/ojhunt requested changes to this pull request.
In the earlier iteration the llm added a block test, and didn't indicate why. I investigated and found _many_ problems around blocks and omp, but I think there's something weird happening in dependent blocks in general.
But I looked into lambdas as well and with this PR we now get incorrect codegen:
```cpp
int foo(auto x, int(*F)() = []()->int{
int k = 0;
#pragma omp simd collapse(sizeof(x)/sizeof(x))
for (int i = 0; i < 10; ++i)
k++;
return k; }) {
return F();
}
int bar() { return foo(1); }
```
This drops the for loop and reduces to `ret 0`.
The original version of this `#pragma omp simd collapse(sizeof(x))` which should produce an error, but also just drops the loop.
I think this PR is tending towards addressing symptoms
https://github.com/llvm/llvm-project/pull/226805
More information about the cfe-commits
mailing list