@@ -406,19 +406,6 @@ fir::ShapeOp genShapeOp(mlir::OpBuilder &builder, fir::SequenceType seqTy,
406406 return builder.create <fir::ShapeOp>(loc, extents);
407407}
408408
409- // / Return the nested sequence type if any.
410- static mlir::Type extractSequenceType (mlir::Type ty) {
411- if (mlir::isa<fir::SequenceType>(ty))
412- return ty;
413- if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(ty))
414- return extractSequenceType (boxTy.getEleTy ());
415- if (auto heapTy = mlir::dyn_cast<fir::HeapType>(ty))
416- return extractSequenceType (heapTy.getEleTy ());
417- if (auto ptrTy = mlir::dyn_cast<fir::PointerType>(ty))
418- return extractSequenceType (ptrTy.getEleTy ());
419- return mlir::Type{};
420- }
421-
422409template <typename RecipeOp>
423410static void genPrivateLikeInitRegion (mlir::OpBuilder &builder, RecipeOp recipe,
424411 mlir::Type ty, mlir::Location loc) {
@@ -454,7 +441,7 @@ static void genPrivateLikeInitRegion(mlir::OpBuilder &builder, RecipeOp recipe,
454441 }
455442 }
456443 } else if (auto boxTy = mlir::dyn_cast_or_null<fir::BaseBoxType>(ty)) {
457- mlir::Type innerTy = extractSequenceType (boxTy);
444+ mlir::Type innerTy = fir:: extractSequenceType (boxTy);
458445 if (!innerTy)
459446 TODO (loc, " Unsupported boxed type in OpenACC privatization" );
460447 fir::FirOpBuilder firBuilder{builder, recipe.getOperation ()};
@@ -688,7 +675,7 @@ mlir::acc::FirstprivateRecipeOp Fortran::lower::createOrGetFirstprivateRecipe(
688675 } else if (auto boxTy = mlir::dyn_cast_or_null<fir::BaseBoxType>(ty)) {
689676 fir::FirOpBuilder firBuilder{builder, recipe.getOperation ()};
690677 llvm::SmallVector<mlir::Value> tripletArgs;
691- mlir::Type innerTy = extractSequenceType (boxTy);
678+ mlir::Type innerTy = fir:: extractSequenceType (boxTy);
692679 fir::SequenceType seqTy =
693680 mlir::dyn_cast_or_null<fir::SequenceType>(innerTy);
694681 if (!seqTy)
@@ -1018,7 +1005,7 @@ static mlir::Value genReductionInitRegion(fir::FirOpBuilder &builder,
10181005 return declareOp.getBase ();
10191006 }
10201007 } else if (auto boxTy = mlir::dyn_cast_or_null<fir::BaseBoxType>(ty)) {
1021- mlir::Type innerTy = extractSequenceType (boxTy);
1008+ mlir::Type innerTy = fir:: extractSequenceType (boxTy);
10221009 if (!mlir::isa<fir::SequenceType>(innerTy))
10231010 TODO (loc, " Unsupported boxed type for reduction" );
10241011 // Create the private copy from the initial fir.box.
@@ -1230,7 +1217,7 @@ static void genCombiner(fir::FirOpBuilder &builder, mlir::Location loc,
12301217 builder.create <fir::StoreOp>(loc, res, addr1);
12311218 builder.setInsertionPointAfter (loops[0 ]);
12321219 } else if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(ty)) {
1233- mlir::Type innerTy = extractSequenceType (boxTy);
1220+ mlir::Type innerTy = fir:: extractSequenceType (boxTy);
12341221 fir::SequenceType seqTy =
12351222 mlir::dyn_cast_or_null<fir::SequenceType>(innerTy);
12361223 if (!seqTy)
0 commit comments