[Mlir-commits] [flang] [mlir] [flang][OpenMP] Skip runtime mapping with no offload targets (PR #144534)

Sergio Afonso llvmlistbot at llvm.org
Fri Jun 20 03:55:10 PDT 2025


================
@@ -4467,6 +4476,10 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder,
 
   if (failed(result))
     return failure();
+  if (!isOffloadEntry) {
+    // Pretend we have IF(false) if we're not doing offload.
+    ifCond = builder.getFalse();
+  }
----------------
skatrak wrote:

Why not just reduce the changes to this? At the moment, the `isOffloadEntry` condition is checked in multiple places, which adds complexity, but overriding the `if` condition would be enough to get the wanted behavior (let me know if I'm missing anything there). In my opinion, overhead shouldn't be a concern, since the early returns above only skip a few constant time cheap operations.

If overhead is still a concern for you, I think the other suggestion I made would achieve that while keeping this logic contained and make things easier to follow.

```suggestion
// Pretend we have IF(false) if we're not doing offload.
if (!isOffloadEntry)
  ifCond = builder.getFalse();
```

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


More information about the Mlir-commits mailing list