[flang-commits] [mlir] [flang] [MLIR][OpenMP] Changes to function-filtering pass (PR #71850)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Fri Nov 10 03:27:02 PST 2023


================
@@ -2496,8 +2496,6 @@ convertDeclareTargetAttr(Operation *op, mlir::omp::DeclareTargetAttr attribute,
       if (declareType == omp::DeclareTargetDeviceType::host) {
         llvm::Function *llvmFunc =
             moduleTranslation.lookupFunction(funcOp.getName());
-        llvmFunc->replaceAllUsesWith(
----------------
skatrak wrote:

I think this code or similar should remain, because otherwise host functions containing target regions calling other host functions containing target regions will give problems. This example should work, and I think this change may have broken it:

```fortran
subroutine before(x)
  integer, intent(out) :: x
  !$omp target map(from: x)
    x = 1
  !$omp end target
end subroutine

subroutine middle()
  integer :: x
  !$omp target map(from: x)
    x = 0
  !$omp end target
  call before(x)
  call after(x)
end subroutine

subroutine after(x)
  integer, intent(out) :: x
  !$omp target map(from:x)
    x = 2
  !$omp end target
end subroutine
```

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


More information about the flang-commits mailing list