[flang-commits] [flang] [mlir] [flang][OpenMP] Ignore target-data operations with no offload targets (PR #144534)
Sergio Afonso via flang-commits
flang-commits at lists.llvm.org
Tue Jun 17 09:08:41 PDT 2025
================
@@ -4402,6 +4405,8 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder,
.Case([&](omp::TargetEnterDataOp enterDataOp) -> LogicalResult {
if (failed(checkImplementationStatus(*enterDataOp)))
return failure();
+ if (!isOffloadEntry)
+ return success();
----------------
skatrak wrote:
Nit: I think it would be more readable if we checked this condition and exited early before this `TypeSwitch`, rather than checking on each case and then later after it was executed.
Also, shouldn't we still process the body of `omp.target_data`? That code still should run on the host, AFAIU.
```c++
if (!isOffloadEntry && !isa<omp::TargetDataOp>(op))
return success();
LogicalResult result = llvm::TypeSwitch...;
if (failed(result))
return failure();
using InsertPointTy = ...
```
https://github.com/llvm/llvm-project/pull/144534
More information about the flang-commits
mailing list