[Mlir-commits] [flang] [mlir] [OpenMP][Flang][MLIR] Skip trip count calculation when bounds are null (PR #176469)

Sergio Afonso llvmlistbot at llvm.org
Mon Jan 19 04:39:07 PST 2026


https://github.com/skatrak commented:

Thank you Jason for bringing attention to this issue. After having a quick look, I can see that what's happening is that, during host compilation, loop bounds in Flang lowering are not being passed as `host_eval` (this is very restricted, so it won't do it if there's any sort of statement in addition to the `distribute parallel do` construct nested inside of `target teams`), but MLIR to LLVM IR translation incorrectly assumes this was the case, so `initTargetRuntimeAttrs` tries to look up the `llvm::Value`s associated to some uninitialized data.

This points to `TargetOp::getKernelExecFlags` as the culprit, which is also the cause for another bug I was planning to address, since that MLIR pattern detection approach has always been rather flaky. In the meantime, though, I think your fix will do the trick in this situation. I just have a small comment, but otherwise LGTM.

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


More information about the Mlir-commits mailing list