[llvm-branch-commits] [flang] [mlir] [mlir][OpenMP][flang] make private variable allocation implicit in omp.private (PR #124019)
Tom Eccles via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jan 23 07:06:15 PST 2025
================
@@ -55,15 +55,19 @@ class MapsForPrivatizedSymbolsPass
std::underlying_type_t<llvm::omp::OpenMPOffloadMappingFlags>>(
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO);
Operation *definingOp = var.getDefiningOp();
- auto declOp = llvm::dyn_cast_or_null<hlfir::DeclareOp>(definingOp);
- assert(declOp &&
- "Expected defining Op of privatized var to be hlfir.declare");
+ assert(definingOp &&
+ "Privatizing a block argument without any hlfir.declare");
----------------
tblah wrote:
MLIR values can come from two places:
1. the result of an operation
2. a block argument
We can't assume that getting the defining operation produces a non-null result because the value might be a block argument.
For example,
```
func.func @func(%arg0 : !type0, %arg1 : !type1) {
%0 = hlfir.declare %arg0
omp.private(%0, %arg1)
}
```
Here we can get a defining operation for `%0` because it is the `hlfir.declare` for that function argument (which is the normal way flang would lower a function argument). `%arg1` has no defining operation because it is a block argument.
https://github.com/llvm/llvm-project/pull/124019
More information about the llvm-branch-commits
mailing list