[llvm-branch-commits] [flang] [mlir] [mlir][OpenMP][flang] make private variable allocation implicit in omp.private (PR #124019)

Kareem Ergawy via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 24 00:49:06 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");
----------------
ergawy wrote:

> MLIR values can come from two places:

That's exactly my point. What prevents us from working with block args here? Why do we need to assume it is defined by an op?

I am not against that, we can keep the assertion. But beyond the fact that we need to call `getBase` below, we only care about `var` and a `Value` and not about its defining op.

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


More information about the llvm-branch-commits mailing list