Skip to content

Commit aceffbc

Browse files
Update a comment in MapInfoFinalizationPass and also add one more check that will advance the walk in case the MapInfoOp already has bounds
1 parent 38f7e06 commit aceffbc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,9 @@ class MapInfoFinalizationPass
542542
// iterations from previous function scopes.
543543
localBoxAllocas.clear();
544544

545-
// First, walk `omp.map.info` ops to see if any
545+
// First, walk `omp.map.info` ops to see if any of them have varPtrs
546+
// with an underlying type of fir.char<k, ?>, i.e a character
547+
// with dynamic length. If so, check if they need bounds added.
546548
func->walk([&](mlir::omp::MapInfoOp op) {
547549
mlir::Value varPtr = op.getVarPtr();
548550
mlir::Type underlyingVarType = fir::unwrapRefType(varPtr.getType());
@@ -554,6 +556,8 @@ class MapInfoFinalizationPass
554556
if (!cType.hasDynamicLen())
555557
return mlir::WalkResult::advance();
556558

559+
if (!op.getBounds().empty())
560+
return mlir::WalkResult::advance();
557561
// This means varPtr is a BlockArgument. I do not know how to get to a
558562
// fir.boxchar<> type of mlir::Value for varPtr. So, skipping this for
559563
// now.

0 commit comments

Comments
 (0)