[flang-commits] [flang] [llvm] [flang][OpenMP] Sink intervening code unguarded into collapsed loop body (PR #225159)
Sergio Afonso via flang-commits
flang-commits at lists.llvm.org
Thu Sep 24 06:27:14 PDT 2026
skatrak wrote:
I'm no expert on it @sshrestha-aa, but to me if the user wanted sequential-equivalent behavior in these cases you mention, they shouldn't use `collapse` (based on my reading of the spec, which may or may not be correct) due to potential code portability concerns. It doesn't look like the spec makes any sort of exceptions with regards to the number of times intervening code in a collapsed loop runs, so if running it an "undefined within a range" number of times is not what they want, then it shouldn't be collapsed or it would have to be done manually inside of the inner loop.
If we want to provide the more user-friendly behavior of running intervening code once per outer iteration, we could as well. But, since it adds complexity and this simpler approach already matches Clang, I would lean towards accepting this instead and potentially leaving the alternative as future work in case this is something users really ask for. Just my opinion, though.
https://github.com/llvm/llvm-project/pull/225159
More information about the flang-commits
mailing list