================
@@ -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
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to