Skip to content

Commit 703d7f3

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 68993c5 commit 703d7f3

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
@@ -550,7 +550,9 @@ class MapInfoFinalizationPass
550550
// iterations from previous function scopes.
551551
localBoxAllocas.clear();
552552

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

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

0 commit comments

Comments
 (0)