[all-commits] [llvm/llvm-project] 43adf5: [flang][acc] Handle ViewLike ops with OutlineRemat...
khaki3 via All-commits
all-commits at lists.llvm.org
Thu Mar 5 13:29:33 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 43adf574134cb86ef46b38e29171779e4d844864
https://github.com/llvm/llvm-project/commit/43adf574134cb86ef46b38e29171779e4d844864
Author: khaki3 <47756807+khaki3 at users.noreply.github.com>
Date: 2026-03-05 (Thu, 05 Mar 2026)
Changed paths:
M flang/lib/Optimizer/OpenACC/Support/RegisterOpenACCExtensions.cpp
M flang/test/Fir/OpenACC/offload-livein-value-canonicalization.fir
M mlir/lib/Dialect/OpenACC/Transforms/OffloadLiveInValueCanonicalization.cpp
Log Message:
-----------
[flang][acc] Handle ViewLike ops with OutlineRematerializationOpInterface in OffloadLiveInValueCanonicalization (#184218)
`fir::ConvertOp` implements both `ViewLikeOpInterface` and
`OutlineRematerializationOpInterface`. `fir.convert` is also used for
ptr-to-int conversions like `(!fir.ref<i32>) -> i64`. That is not really
a "view" — it converts a pointer to an integer — but
`ViewLikeOpInterface` is still attached, so `getOriginalValue` traces
through it to the underlying value.
When the underlying value is not a rematerialization candidate (e.g.,
`fir.alloca`, a block argument, or a `fir.call` result),
`isRematerializationCandidate` returns false and the `fir.convert` is
left as a live-in. This prevents `ACCImplicitData` from tracing back to
the original pointer to create the data mapping.
This PR:
1. Registers `fir::ConvertOp` with
`OutlineRematerializationOpInterface`.
2. Adds a fallback in `isRematerializationCandidate`: when the traced
original op is not a candidate, check the direct defining op (the
`fir.convert` itself) for `OutlineRematerializationOpInterface`.
```fortran
subroutine test()
integer :: x
!$acc declare create(x)
!$acc parallel
x = 1
!$acc end parallel
end subroutine
```
Before: CSE merges `fir.convert` outside the region; `ACCImplicitData`
cannot map the pointer.
After: `fir.convert` is sunk/rematerialized inside the ACC region
regardless of its input source.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list