@@ -69,7 +69,6 @@ class MapsForPrivatizedSymbolsPass
6969
7070 if (mlir::isa<fir::BaseBoxType>(varPtr.getType ()) ||
7171 mlir::isa<fir::BoxCharType>(varPtr.getType ())) {
72- llvm::errs () << " Is a basebox type\n " ;
7372 OpBuilder::InsertPoint savedInsPoint = builder.saveInsertionPoint ();
7473 mlir::Block *allocaBlock = builder.getAllocaBlock ();
7574 assert (allocaBlock && " No allocablock found for a funcOp" );
@@ -94,11 +93,12 @@ class MapsForPrivatizedSymbolsPass
9493 StringAttr (), builder.getBoolAttr (false ));
9594 }
9695 void addMapInfoOp (omp::TargetOp targetOp, omp::MapInfoOp mapInfoOp) {
97- Location loc = targetOp.getLoc ();
96+ auto argIface = llvm::cast<omp::BlockArgOpenMPOpInterface>(*targetOp);
97+ unsigned insertIndex =
98+ argIface.getMapBlockArgsStart () + argIface.numMapBlockArgs ();
9899 targetOp.getMapVarsMutable ().append (ValueRange{mapInfoOp});
99- size_t numMapVars = targetOp.getMapVars ().size ();
100- targetOp.getRegion ().insertArgument (numMapVars - 1 , mapInfoOp.getType (),
101- loc);
100+ targetOp.getRegion ().insertArgument (insertIndex, mapInfoOp.getType (),
101+ mapInfoOp.getLoc ());
102102 }
103103 void addMapInfoOps (omp::TargetOp targetOp,
104104 llvm::SmallVectorImpl<omp::MapInfoOp> &mapInfoOps) {
@@ -129,9 +129,7 @@ class MapsForPrivatizedSymbolsPass
129129 }
130130 builder.setInsertionPoint (targetOp);
131131 Location loc = targetOp.getLoc ();
132- llvm::errs () << " Here\n " ;
133132 omp::MapInfoOp mapInfoOp = createMapInfo (loc, privVar, builder);
134- llvm::errs () << " Here again\n " ;
135133 mapInfoOps.push_back (mapInfoOp);
136134 LLVM_DEBUG (llvm::dbgs () << " MapsForPrivatizedSymbolsPass created ->\n " );
137135 LLVM_DEBUG (mapInfoOp.dump ());
0 commit comments