Skip to content

Commit 3302435

Browse files
committed
Address reviewer comments.
1 parent c993ac5 commit 3302435

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

flang/test/Fir/convert-to-llvm-openmp-and-fir.fir

+2-2
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ omp.declare_mapper @my_mapper : !fir.type<_QFdeclare_mapperTmy_type{data:i32}> {
12901290
%3 = omp.map.info var_ptr(%2 : !fir.ref<i32>, i32) map_clauses(tofrom) capture(ByRef) -> !fir.ref<i32> {name = "var%data"}
12911291
// CHECK: %[[VAL_5:.*]] = omp.map.info var_ptr(%[[VAL_0]] : !llvm.ptr, !llvm.struct<"_QFdeclare_mapperTmy_type", (i32)>) map_clauses(tofrom) capture(ByRef) members(%[[VAL_3]] : [0] : !llvm.ptr) -> !llvm.ptr {name = "var", partial_map = true}
12921292
%4 = omp.map.info var_ptr(%0 : !fir.ref<!fir.type<_QFdeclare_mapperTmy_type{data:i32}>>, !fir.type<_QFdeclare_mapperTmy_type{data:i32}>) map_clauses(tofrom) capture(ByRef) members(%3 : [0] : !fir.ref<i32>) -> !fir.ref<!fir.type<_QFdeclare_mapperTmy_type{data:i32}>> {name = "var", partial_map = true}
1293-
// CHECK: omp.declare_mapper_info map_entries(%[[VAL_5]], %[[VAL_3]] : !llvm.ptr, !llvm.ptr)
1294-
omp.declare_mapper_info map_entries(%4, %3 : !fir.ref<!fir.type<_QFdeclare_mapperTmy_type{data:i32}>>, !fir.ref<i32>)
1293+
// CHECK: omp.declare_mapper.info map_entries(%[[VAL_5]], %[[VAL_3]] : !llvm.ptr, !llvm.ptr)
1294+
omp.declare_mapper.info map_entries(%4, %3 : !fir.ref<!fir.type<_QFdeclare_mapperTmy_type{data:i32}>>, !fir.ref<i32>)
12951295
// CHECK: }
12961296
}

mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp

+9-8
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ struct DeclMapperOpConversion
196196
SmallVector<NamedAttribute> newAttrs;
197197
newAttrs.emplace_back(curOp.getSymNameAttrName(), curOp.getSymNameAttr());
198198
newAttrs.emplace_back(
199-
curOp.getVarTypeAttrName(),
200-
TypeAttr::get(converter->convertType(curOp.getVarType())));
199+
curOp.getTypeAttrName(),
200+
TypeAttr::get(converter->convertType(curOp.getType())));
201201

202202
auto newOp = rewriter.create<omp::DeclareMapperOp>(
203203
curOp.getLoc(), TypeRange(), adaptor.getOperands(), newAttrs);
@@ -252,12 +252,13 @@ void mlir::configureOpenMPToLLVMConversionLegality(
252252
target.addDynamicallyLegalOp<
253253
omp::AtomicReadOp, omp::AtomicWriteOp, omp::CancellationPointOp,
254254
omp::CancelOp, omp::CriticalDeclareOp, omp::DeclareMapperInfoOp,
255-
omp::FlushOp, omp::MapBoundsOp, omp::MapInfoOp, omp::OrderedOp, omp::ScanOp,
256-
omp::TargetEnterDataOp, omp::TargetExitDataOp, omp::TargetUpdateOp,
257-
omp::ThreadprivateOp, omp::YieldOp>([&](Operation *op) {
258-
return typeConverter.isLegal(op->getOperandTypes()) &&
259-
typeConverter.isLegal(op->getResultTypes());
260-
});
255+
omp::FlushOp, omp::MapBoundsOp, omp::MapInfoOp, omp::OrderedOp,
256+
omp::ScanOp, omp::TargetEnterDataOp, omp::TargetExitDataOp,
257+
omp::TargetUpdateOp, omp::ThreadprivateOp, omp::YieldOp>(
258+
[&](Operation *op) {
259+
return typeConverter.isLegal(op->getOperandTypes()) &&
260+
typeConverter.isLegal(op->getResultTypes());
261+
});
261262
target.addDynamicallyLegalOp<
262263
omp::AtomicUpdateOp, omp::CriticalOp, omp::DeclareMapperOp,
263264
omp::DeclareReductionOp, omp::DistributeOp, omp::LoopNestOp, omp::LoopOp,

mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir

+2-2
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,6 @@ omp.declare_mapper @my_mapper : !llvm.struct<"_QFdeclare_mapperTmy_type", (i32)>
611611
%1 = llvm.getelementptr %arg0[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<"_QFdeclare_mapperTmy_type", (i32)>
612612
%2 = omp.map.info var_ptr(%1 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = "var%data"}
613613
%3 = omp.map.info var_ptr(%arg0 : !llvm.ptr, !llvm.struct<"_QFdeclare_mapperTmy_type", (i32)>) map_clauses(tofrom) capture(ByRef) members(%2 : [0] : !llvm.ptr) -> !llvm.ptr {name = "var", partial_map = true}
614-
// CHECK: omp.declare_mapper_info map_entries(%{{.*}}, %{{.*}} : !llvm.ptr, !llvm.ptr)
615-
omp.declare_mapper_info map_entries(%3, %2 : !llvm.ptr, !llvm.ptr)
614+
// CHECK: omp.declare_mapper.info map_entries(%{{.*}}, %{{.*}} : !llvm.ptr, !llvm.ptr)
615+
omp.declare_mapper.info map_entries(%3, %2 : !llvm.ptr, !llvm.ptr)
616616
}

0 commit comments

Comments
 (0)