Skip to content

Commit 44bbbe8

Browse files
committed
Allow block arguments in MapsForPrivatizedSymbols
1 parent ca35ec2 commit 44bbbe8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

flang/lib/Optimizer/OpenMP/MapsForPrivatizedSymbols.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ class MapsForPrivatizedSymbolsPass
5555
std::underlying_type_t<llvm::omp::OpenMPOffloadMappingFlags>>(
5656
llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO);
5757
Operation *definingOp = var.getDefiningOp();
58-
assert(definingOp &&
59-
"Privatizing a block argument without any hlfir.declare");
6058

6159
Value varPtr = var;
6260
// We want the first result of the hlfir.declare op because our goal
@@ -66,7 +64,7 @@ class MapsForPrivatizedSymbolsPass
6664
// Some types are boxed immediately before privatization. These have other
6765
// operations in between the privatization and the declaration. It is safe
6866
// to use var directly here because they will be boxed anyway.
69-
if (auto declOp = llvm::dyn_cast<hlfir::DeclareOp>(definingOp))
67+
if (auto declOp = llvm::dyn_cast_if_present<hlfir::DeclareOp>(definingOp))
7068
varPtr = declOp.getBase();
7169

7270
// If we do not have a reference to descritor, but the descriptor itself

0 commit comments

Comments
 (0)