[clang] [llvm] [OpenMP] Diagnostic check for imperfect loop collapse (PR #96087)

Julian Brown via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 10:55:42 PDT 2024


jtb20 wrote:

> > Can you explain why the critical section version of the code is safe, and why it is an improvement over simply not collapsing the loop?
> 
> 1. I'm not saying it is safe, I'm just saying that something like this might be safe
> 2. Without properly collapsing the loops, the compiler won't be able to properly schedule the execution per programmer's request

Yes, OK.

The trouble is, I'm still not sure that there **is** "something like this" that lets the collapsed loop execute correctly with independent iterations. (There might be declarations in the "imperfect" part of the loop -- that's probably the most likely thing to be there, in fact. That makes conditionalising those bits or putting them inside other synthesised directives more complicated). Maybe I'll think about it some more.

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


More information about the llvm-commits mailing list