Skip to content

Commit fb26c3d

Browse files
committed
Revert "[Flang][MLIR][OpenMP] - Add support for firstprivate when translating omp.target ops from MLIR to LLVMIR (llvm#131213)"
This reverts commit 7dd8122.
1 parent 010e67f commit fb26c3d

File tree

7 files changed

+43
-181
lines changed

7 files changed

+43
-181
lines changed

flang/lib/Optimizer/OpenMP/MapsForPrivatizedSymbols.cpp

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@
3838
#include <type_traits>
3939

4040
#define DEBUG_TYPE "omp-maps-for-privatized-symbols"
41-
#define PDBGS() (llvm::dbgs() << "[" << DEBUG_TYPE << "]: ")
41+
4242
namespace flangomp {
4343
#define GEN_PASS_DEF_MAPSFORPRIVATIZEDSYMBOLSPASS
4444
#include "flang/Optimizer/OpenMP/Passes.h.inc"
4545
} // namespace flangomp
46-
4746
using namespace mlir;
48-
4947
namespace {
5048
class MapsForPrivatizedSymbolsPass
5149
: public flangomp::impl::MapsForPrivatizedSymbolsPassBase<
@@ -62,14 +60,14 @@ class MapsForPrivatizedSymbolsPass
6260
// We want the first result of the hlfir.declare op because our goal
6361
// is to map the descriptor (fir.box or fir.boxchar) and the first
6462
// result for hlfir.declare is the descriptor if a the symbol being
65-
// declared needs a descriptor.
63+
// decalred needs a descriptor.
6664
// Some types are boxed immediately before privatization. These have other
6765
// operations in between the privatization and the declaration. It is safe
6866
// to use var directly here because they will be boxed anyway.
6967
if (auto declOp = llvm::dyn_cast_if_present<hlfir::DeclareOp>(definingOp))
7068
varPtr = declOp.getBase();
7169

72-
// If we do not have a reference to a descriptor but the descriptor itself,
70+
// If we do not have a reference to descritor, but the descriptor itself
7371
// then we need to store that on the stack so that we can map the
7472
// address of the descriptor.
7573
if (mlir::isa<fir::BaseBoxType>(varPtr.getType()) ||
@@ -83,15 +81,6 @@ class MapsForPrivatizedSymbolsPass
8381
builder.create<fir::StoreOp>(loc, varPtr, alloca);
8482
varPtr = alloca;
8583
}
86-
assert(mlir::isa<omp::PointerLikeType>(varPtr.getType()) &&
87-
"Dealing with a varPtr that is not a PointerLikeType");
88-
89-
// Figure out the bounds because knowing the bounds will help the subsequent
90-
// MapInfoFinalizationPass map the underlying data of the descriptor.
91-
llvm::SmallVector<mlir::Value> boundsOps;
92-
if (needsBoundsOps(varPtr))
93-
genBoundsOps(builder, varPtr, boundsOps);
94-
9584
return builder.create<omp::MapInfoOp>(
9685
loc, varPtr.getType(), varPtr,
9786
TypeAttr::get(llvm::cast<omp::PointerLikeType>(varPtr.getType())
@@ -103,7 +92,7 @@ class MapsForPrivatizedSymbolsPass
10392
/*varPtrPtr=*/Value{},
10493
/*members=*/SmallVector<Value>{},
10594
/*member_index=*/mlir::ArrayAttr{},
106-
/*bounds=*/boundsOps,
95+
/*bounds=*/ValueRange{},
10796
/*mapperId=*/mlir::FlatSymbolRefAttr(), /*name=*/StringAttr(),
10897
builder.getBoolAttr(false));
10998
}
@@ -154,8 +143,8 @@ class MapsForPrivatizedSymbolsPass
154143
omp::MapInfoOp mapInfoOp = createMapInfo(loc, privVar, builder);
155144
mapInfoOps.push_back(mapInfoOp);
156145

157-
LLVM_DEBUG(PDBGS() << "MapsForPrivatizedSymbolsPass created ->\n"
158-
<< mapInfoOp << "\n");
146+
LLVM_DEBUG(llvm::dbgs() << "MapsForPrivatizedSymbolsPass created ->\n");
147+
LLVM_DEBUG(mapInfoOp.dump());
159148
}
160149
if (!mapInfoOps.empty()) {
161150
mapInfoOpsForTarget.insert({targetOp.getOperation(), mapInfoOps});
@@ -169,52 +158,5 @@ class MapsForPrivatizedSymbolsPass
169158
}
170159
}
171160
}
172-
// As the name suggests, this function examines var to determine if
173-
// it has dynamic size. If true, this pass'll have to extract these
174-
// bounds from descriptor of var and add the bounds to the resultant
175-
// MapInfoOp.
176-
bool needsBoundsOps(mlir::Value var) {
177-
assert(mlir::isa<omp::PointerLikeType>(var.getType()) &&
178-
"needsBoundsOps can deal only with pointer types");
179-
mlir::Type t = fir::unwrapRefType(var.getType());
180-
// t could be a box, so look inside the box
181-
auto innerType = fir::dyn_cast_ptrOrBoxEleTy(t);
182-
if (innerType)
183-
return fir::hasDynamicSize(innerType);
184-
return fir::hasDynamicSize(t);
185-
}
186-
187-
// TODO: Remove this in favor of fir::factory::genImplicitBoundsOps
188-
// in a subsequent PR.
189-
void genBoundsOps(fir::FirOpBuilder &builder, mlir::Value var,
190-
llvm::SmallVector<mlir::Value> &boundsOps) {
191-
if (!fir::isBoxAddress(var.getType()))
192-
return;
193-
194-
unsigned int rank = 0;
195-
rank = fir::getBoxRank(fir::unwrapRefType(var.getType()));
196-
mlir::Location loc = var.getLoc();
197-
mlir::Type idxTy = builder.getIndexType();
198-
mlir::Value one = builder.createIntegerConstant(loc, idxTy, 1);
199-
mlir::Value zero = builder.createIntegerConstant(loc, idxTy, 0);
200-
mlir::Type boundTy = builder.getType<omp::MapBoundsType>();
201-
mlir::Value box = builder.create<fir::LoadOp>(loc, var);
202-
for (unsigned int i = 0; i < rank; ++i) {
203-
mlir::Value dimNo = builder.createIntegerConstant(loc, idxTy, i);
204-
auto dimInfo =
205-
builder.create<fir::BoxDimsOp>(loc, idxTy, idxTy, idxTy, box, dimNo);
206-
mlir::Value lb = dimInfo.getLowerBound();
207-
mlir::Value extent = dimInfo.getExtent();
208-
mlir::Value byteStride = dimInfo.getByteStride();
209-
mlir::Value ub = builder.create<mlir::arith::SubIOp>(loc, extent, one);
210-
211-
mlir::Value boundsOp = builder.create<omp::MapBoundsOp>(
212-
loc, boundTy, /*lower_bound=*/zero,
213-
/*upper_bound=*/ub, /*extent=*/extent, /*stride=*/byteStride,
214-
/*stride_in_bytes = */ true, /*start_idx=*/lb);
215-
LLVM_DEBUG(PDBGS() << "Created BoundsOp " << boundsOp << "\n");
216-
boundsOps.push_back(boundsOp);
217-
}
218-
}
219161
};
220162
} // namespace

flang/lib/Optimizer/Passes/Pipelines.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,8 @@ void createOpenMPFIRPassPipeline(mlir::PassManager &pm,
298298
pm.addPass(flangomp::createDoConcurrentConversionPass(
299299
opts.doConcurrentMappingKind == DoConcurrentMappingKind::DCMK_Device));
300300

301-
// The MapsForPrivatizedSymbols pass needs to run before
302-
// MapInfoFinalizationPass because the former creates new
303-
// MapInfoOp instances, typically for descriptors.
304-
// MapInfoFinalizationPass adds MapInfoOp instances for the descriptors
305-
// underlying data which is necessary to access the data on the offload
306-
// target device.
307-
pm.addPass(flangomp::createMapsForPrivatizedSymbolsPass());
308301
pm.addPass(flangomp::createMapInfoFinalizationPass());
302+
pm.addPass(flangomp::createMapsForPrivatizedSymbolsPass());
309303
pm.addPass(flangomp::createMarkDeclareTargetPass());
310304
pm.addPass(flangomp::createGenericLoopConversionPass());
311305
if (opts.isTargetDevice) {

flang/test/Lower/OpenMP/DelayedPrivatization/target-private-allocatable.f90

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ end subroutine target_allocatable
5858
! CHECK: %[[VAR_ALLOC:.*]] = fir.alloca [[DESC_TYPE]]
5959
! CHECK-SAME: {bindc_name = "alloc_var", {{.*}}}
6060
! CHECK: %[[VAR_DECL:.*]]:2 = hlfir.declare %[[VAR_ALLOC]]
61-
! CHECK: %[[BASE_ADDR:.*]] = fir.box_offset %[[VAR_DECL]]#0 base_addr : (!fir.ref<!fir.box<!fir.heap<i32>>>) -> [[MEMBER_TYPE:.*]]
62-
! CHECK: %[[MEMBER:.*]] = omp.map.info var_ptr(%[[VAR_DECL]]#0 : [[TYPE]], i32) map_clauses(to) capture(ByRef) var_ptr_ptr(%[[BASE_ADDR]] : [[MEMBER_TYPE:.*]]) -> {{.*}}
63-
! CHECK: %[[MAP_VAR:.*]] = omp.map.info var_ptr(%[[VAR_DECL]]#0 : [[TYPE]], [[DESC_TYPE]]) map_clauses(to) capture(ByRef) members(%[[MEMBER]] : [0] : !fir.llvm_ptr<!fir.ref<i32>>) -> !fir.ref<!fir.box<!fir.heap<i32>>>
6461

65-
! CHECK: omp.target map_entries(%[[MAP_VAR]] -> %arg0, %[[MEMBER]] -> %arg1 : [[TYPE]], [[MEMBER_TYPE]]) private(
66-
! CHECK-SAME: @[[VAR_PRIVATIZER_SYM]] %[[VAR_DECL]]#0 -> %{{.*}} [map_idx=0] : [[TYPE]]) {
62+
! CHECK: %[[MAP_VAR:.*]] = omp.map.info var_ptr(%[[VAR_DECL]]#0 : [[TYPE]], [[DESC_TYPE]])
63+
! CHECK-SAME: map_clauses(to) capture(ByRef) -> [[TYPE]]
64+
! CHECK: omp.target map_entries(%[[MAP_VAR]] -> %arg0 : [[TYPE]]) private(
65+
! CHECK-SAME: @[[VAR_PRIVATIZER_SYM]] %[[VAR_DECL]]#0 -> %{{.*}} : [[TYPE]]) {

flang/test/Lower/OpenMP/DelayedPrivatization/target-private-multiple-variables.f90

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,17 @@ end subroutine target_allocatable
138138
! CHECK: %[[REAL_ARR_DECL:.*]]:2 = hlfir.declare %[[REAL_ARR_ALLOC]]({{.*}})
139139
! CHECK: fir.store %[[REAL_ARR_DECL]]#0 to %[[REAL_ARR_DESC_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xf32>>>
140140
! CHECK: %[[MAPPED_MI0:.*]] = omp.map.info var_ptr(%[[MAPPED_DECL]]#1 : !fir.ref<i32>, i32) {{.*}}
141-
! CHECK: %[[ALLOC_VAR_MEMBER:.*]] = omp.map.info var_ptr(%[[ALLOC_VAR_DECL]]#0 : !fir.ref<!fir.box<!fir.heap<i32>>>, i32)
142-
! CHECK: %[[ALLOC_VAR_MAP:.*]] = omp.map.info var_ptr(%[[ALLOC_VAR_DECL]]#0 : !fir.ref<!fir.box<!fir.heap<i32>>>, !fir.box<!fir.heap<i32>>) {{.*}} members(%[[ALLOC_VAR_MEMBER]] :
143-
! CHECK: %[[REAL_ARR_MEMBER:.*]] = omp.map.info var_ptr(%[[REAL_ARR_DESC_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, f32)
144-
! CHECK: %[[REAL_ARR_DESC_MAP:.*]] = omp.map.info var_ptr(%[[REAL_ARR_DESC_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.box<!fir.array<?xf32>>) {{.*}} members(%[[REAL_ARR_MEMBER]] :
141+
! CHECK: %[[ALLOC_VAR_MAP:.*]] = omp.map.info var_ptr(%[[ALLOC_VAR_DECL]]#0 : !fir.ref<!fir.box<!fir.heap<i32>>>, !fir.box<!fir.heap<i32>>)
142+
! CHECK: %[[REAL_ARR_DESC_MAP:.*]] = omp.map.info var_ptr(%[[REAL_ARR_DESC_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.box<!fir.array<?xf32>>)
145143
! CHECK: fir.store %[[CHAR_VAR_DECL]]#0 to %[[CHAR_VAR_DESC_ALLOCA]] : !fir.ref<!fir.boxchar<1>>
146144
! CHECK: %[[CHAR_VAR_DESC_MAP:.*]] = omp.map.info var_ptr(%[[CHAR_VAR_DESC_ALLOCA]] : !fir.ref<!fir.boxchar<1>>, !fir.boxchar<1>)
147145
! CHECK: omp.target
148146
! CHECK-SAME: map_entries(
149147
! CHECK-SAME: %[[MAPPED_MI0]] -> %[[MAPPED_ARG0:[^,]+]],
150148
! CHECK-SAME: %[[ALLOC_VAR_MAP]] -> %[[MAPPED_ARG1:[^,]+]]
151149
! CHECK-SAME: %[[REAL_ARR_DESC_MAP]] -> %[[MAPPED_ARG2:[^,]+]]
152-
! CHECK-SAME: %[[CHAR_VAR_DESC_MAP]] -> %[[MAPPED_ARG3:.[^,]+]]
153-
! CHECK-SAME: !fir.ref<i32>, !fir.ref<!fir.box<!fir.heap<i32>>>, !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.ref<!fir.boxchar<1>>, !fir.llvm_ptr<!fir.ref<i32>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>
150+
! CHECK-SAME: %[[CHAR_VAR_DESC_MAP]] -> %[[MAPPED_ARG3:.[^,]+]] :
151+
! CHECK-SAME: !fir.ref<i32>, !fir.ref<!fir.box<!fir.heap<i32>>>, !fir.ref<!fir.box<!fir.array<?xf32>>>, !fir.ref<!fir.boxchar<1>>)
154152
! CHECK-SAME: private(
155153
! CHECK-SAME: @[[ALLOC_PRIVATIZER_SYM]] %{{[^[:space:]]+}}#0 -> %[[ALLOC_ARG:[^,]+]] [map_idx=1],
156154
! CHECK-SAME: @[[REAL_PRIVATIZER_SYM]] %{{[^[:space:]]+}}#0 -> %[[REAL_ARG:[^,]+]],

flang/test/Lower/OpenMP/Todo/firstprivate-target.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
integer :: i
55
! CHECK: not yet implemented: Unhandled clause FIRSTPRIVATE in TARGET construct
6-
!$omp target firstprivate(i) nowait
6+
!$omp target firstprivate(i)
77
!$omp end target
88

99
end program

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def PrivateClauseOp : OpenMP_Op<"private", [IsolatedFromAbove, RecipeInterface]>
8181

8282
There are no restrictions on the body except for:
8383
- The `dealloc` regions has a single argument.
84-
- The `init` & `copy` regions have 2 arguments.
84+
- The `init & `copy` regions have 2 arguments.
8585
- All three regions are terminated by `omp.yield` ops.
8686
The above restrictions and other obvious restrictions (e.g. verifying the
8787
type of yielded values) are verified by the custom op verifier. The actual
@@ -90,15 +90,15 @@ def PrivateClauseOp : OpenMP_Op<"private", [IsolatedFromAbove, RecipeInterface]>
9090
Instances of this op would then be used by ops that model directives that
9191
accept data-sharing attribute clauses.
9292

93-
The `sym_name` attribute provides a symbol by which the privatizer op can be
93+
The $sym_name attribute provides a symbol by which the privatizer op can be
9494
referenced by other dialect ops.
9595

96-
The `type` attribute is the type of the value being privatized. This type
96+
The $type attribute is the type of the value being privatized. This type
9797
will be implicitly allocated in MLIR->LLVMIR conversion and passed as the
9898
second argument to the init region. Therefore the type of arguments to
99-
the regions should be a type which represents a pointer to `type`.
99+
the regions should be a type which represents a pointer to $type.
100100

101-
The `data_sharing_type` attribute specifies whether privatizer corresponds
101+
The $data_sharing_type attribute specifies whether privatizer corresponds
102102
to a `private` or a `firstprivate` clause.
103103
}];
104104

@@ -161,10 +161,9 @@ def PrivateClauseOp : OpenMP_Op<"private", [IsolatedFromAbove, RecipeInterface]>
161161
/// needsMap returns true if the value being privatized should additionally
162162
/// be mapped to the target region using a MapInfoOp. This is most common
163163
/// when an allocatable is privatized. In such cases, the descriptor is used
164-
/// in privatization and needs to be mapped on to the device. The use of
165-
/// firstprivate also creates the need to map the host variable to the device.
164+
/// in privatization and needs to be mapped on to the device.
166165
bool needsMap() {
167-
return readsFromMold();
166+
return initReadsFromMold();
168167
}
169168

170169
/// Get the type for arguments to nested regions. This should

mlir/test/Target/LLVMIR/openmp-target-private.mlir

Lines changed: 20 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ llvm.func @target_map_single_private() attributes {fir.internal_name = "_QPtarge
1818
}
1919
llvm.return
2020
}
21+
// CHECK: define internal void @__omp_offloading_
22+
// CHECK-NOT: define {{.*}}
23+
// CHECK: %[[PRIV_ALLOC:.*]] = alloca i32, align 4
24+
// CHECK: %[[ADD:.*]] = add i32 {{.*}}, 10
25+
// CHECK: store i32 %[[ADD]], ptr %[[PRIV_ALLOC]], align 4
2126

2227
omp.private {type = private} @n.privatizer : f32
2328

@@ -45,6 +50,16 @@ llvm.func @target_map_2_privates() attributes {fir.internal_name = "_QPtarget_ma
4550
}
4651

4752

53+
// CHECK: define internal void @__omp_offloading_
54+
// CHECK: %[[PRIV_I32_ALLOC:.*]] = alloca i32, align 4
55+
// CHECK: %[[PRIV_FLOAT_ALLOC:.*]] = alloca float, align 4
56+
// CHECK: %[[ADD_I32:.*]] = add i32 {{.*}}, 10
57+
// CHECK: store i32 %[[ADD_I32]], ptr %[[PRIV_I32_ALLOC]], align 4
58+
// CHECK: %[[LOAD_I32_AGAIN:.*]] = load i32, ptr %[[PRIV_I32_ALLOC]], align 4
59+
// CHECK: %[[CAST_TO_FLOAT:.*]] = sitofp i32 %[[LOAD_I32_AGAIN]] to float
60+
// CHECK: %[[ADD_FLOAT:.*]] = fadd contract float %[[CAST_TO_FLOAT]], 1.100000e+01
61+
// CHECK: store float %[[ADD_FLOAT]], ptr %[[PRIV_FLOAT_ALLOC]], align 4
62+
4863
// An entirely artifical privatizer that is meant to check multi-block
4964
// privatizers. The idea here is to prove that we set the correct
5065
// insertion points for the builder when generating, first, LLVM IR for the
@@ -64,6 +79,10 @@ llvm.func @target_op_private_multi_block(%arg0: !llvm.ptr) {
6479
}
6580
llvm.return
6681
}
82+
// CHECK: define internal void @__omp_offloading_
83+
// CHECK: %[[PRIV_ALLOC:.*]] = alloca float, align 4
84+
// CHECK: %[[PHI_ALLOCA:.*]] = phi ptr [ %[[PRIV_ALLOC]], {{.*}} ]
85+
// CHECK: %[[RESULT:.*]] = load float, ptr %[[PHI_ALLOCA]], align 4
6786

6887
// Descriptors are needed for CHARACTER arrays and their type is
6988
// !fir.boxchar<KIND>. When such arrays are used in the private construct, the
@@ -146,99 +165,10 @@ llvm.func @llvm.memmove.p0.p0.i64(!llvm.ptr, !llvm.ptr, i64, i1) attributes {sym
146165

147166

148167

149-
omp.private {type = firstprivate} @sf.firstprivate : f32 copy {
150-
^bb0(%arg0: !llvm.ptr, %arg1: !llvm.ptr):
151-
%0 = llvm.load %arg0 : !llvm.ptr -> f32
152-
llvm.store %0, %arg1 : f32, !llvm.ptr
153-
omp.yield(%arg1 : !llvm.ptr)
154-
}
155-
omp.private {type = firstprivate} @sv.firstprivate : i32 copy {
156-
^bb0(%arg0: !llvm.ptr, %arg1: !llvm.ptr):
157-
%0 = llvm.load %arg0 : !llvm.ptr -> i32
158-
llvm.store %0, %arg1 : i32, !llvm.ptr
159-
omp.yield(%arg1 : !llvm.ptr)
160-
}
161-
llvm.func @target_firstprivate_() attributes {fir.internal_name = "_QPtarget_firstprivate"} {
162-
%0 = llvm.mlir.constant(1 : i64) : i64
163-
%sv = llvm.alloca %0 x i32 {bindc_name = "sv"} : (i64) -> !llvm.ptr
164-
%sf = llvm.alloca %0 x f32 {bindc_name = "sf"} : (i64) -> !llvm.ptr
165-
%6 = omp.map.info var_ptr(%sv : !llvm.ptr, i32) map_clauses(to) capture(ByRef) -> !llvm.ptr
166-
%7 = omp.map.info var_ptr(%sf : !llvm.ptr, f32) map_clauses(to) capture(ByRef) -> !llvm.ptr
167-
omp.target map_entries(%6 -> %arg0, %7 -> %arg1 : !llvm.ptr, !llvm.ptr) private(@sv.firstprivate %sv -> %arg2 [map_idx=0], @sf.firstprivate %sf -> %arg3 [map_idx=1] : !llvm.ptr, !llvm.ptr) {
168-
%8 = llvm.mlir.constant(2.000000e+00 : f64) : f64
169-
%9 = llvm.mlir.constant(10 : i32) : i32
170-
%10 = llvm.load %arg2 : !llvm.ptr -> i32
171-
%11 = llvm.add %10, %9 : i32
172-
llvm.store %11, %arg2 : i32, !llvm.ptr
173-
%12 = llvm.load %arg3 : !llvm.ptr -> f32
174-
%13 = llvm.fpext %12 : f32 to f64
175-
%14 = llvm.fadd %13, %8 {fastmathFlags = #llvm.fastmath<contract>} : f64
176-
%15 = llvm.fptrunc %14 : f64 to f32
177-
llvm.store %15, %arg3 : f32, !llvm.ptr
178-
omp.terminator
179-
}
180-
llvm.return
181-
}
182-
// CHECK: define void @target_map_single_private() {
183-
// CHECK: call void @__omp_offloading_[[MAP_SINGLE_PRIVATE_OFFLOADED_FUNCTION:.*]](ptr {{.*}})
184-
// CHECK: define void @target_map_2_privates() {
185-
// CHECK: call void @__omp_offloading_[[MAP_2_PRIVATES_OFFLOADED_FUNCTION:.*]](ptr {{.*}})
186-
// CHECK: define void @target_op_private_multi_block
187-
// CHECK: call void @__omp_offloading_[[PRIVATE_MULTI_BLOCK_OFFLOADED_FUNCTION:.*]]()
188-
// CHECK: define void @target_boxchar_
189-
// CHECK: call void @__omp_offloading_[[BOXCHAR_OFFLOADED_FUNCTION:.*]](ptr {{.*}}, ptr {{.*}})
190-
// CHECK: define void @target_firstprivate_()
191-
// CHECK: call void @__omp_offloading_[[SIMPLE_OFFLOADED_FUNCTION:.*]](ptr {{.*}}, ptr {{.*}})
192-
193-
// CHECK: define internal void @__omp_offloading_[[MAP_SINGLE_PRIVATE_OFFLOADED_FUNCTION]]
194-
// CHECK: %[[PRIV_ALLOC:.*]] = alloca i32, align 4
195-
// CHECK: %[[ADD:.*]] = add i32 {{.*}}, 10
196-
// CHECK: store i32 %[[ADD]], ptr %[[PRIV_ALLOC]], align 4
197-
198-
199-
200-
201-
// CHECK: define internal void @__omp_offloading_[[MAP_2_PRIVATES_OFFLOADED_FUNCTION]]
202-
// CHECK: %[[PRIV_I32_ALLOC:.*]] = alloca i32, align 4
203-
// CHECK: %[[PRIV_FLOAT_ALLOC:.*]] = alloca float, align 4
204-
// CHECK: %[[ADD_I32:.*]] = add i32 {{.*}}, 10
205-
// CHECK: store i32 %[[ADD_I32]], ptr %[[PRIV_I32_ALLOC]], align 4
206-
// CHECK: %[[LOAD_I32_AGAIN:.*]] = load i32, ptr %[[PRIV_I32_ALLOC]], align 4
207-
// CHECK: %[[CAST_TO_FLOAT:.*]] = sitofp i32 %[[LOAD_I32_AGAIN]] to float
208-
// CHECK: %[[ADD_FLOAT:.*]] = fadd contract float %[[CAST_TO_FLOAT]], 1.100000e+01
209-
// CHECK: store float %[[ADD_FLOAT]], ptr %[[PRIV_FLOAT_ALLOC]], align 4
210-
211-
// CHECK: define internal void @__omp_offloading_[[PRIVATE_MULTI_BLOCK_OFFLOADED_FUNCTION]]
212-
// CHECK: %[[PRIV_ALLOC:.*]] = alloca float, align 4
213-
// CHECK: %[[PHI_ALLOCA:.*]] = phi ptr [ %[[PRIV_ALLOC]], {{.*}} ]
214-
// CHECK: %[[RESULT:.*]] = load float, ptr %[[PHI_ALLOCA]], align 4
215-
216-
217-
// CHECK: define internal void @__omp_offloading_[[BOXCHAR_OFFLOADED_FUNCTION]](ptr %{{[^,]+}}, ptr %[[MAPPED_ARG:.*]]) {
168+
// CHECK: define internal void @__omp_offloading_{{.*}}(ptr %{{[^,]+}}, ptr %[[MAPPED_ARG:.*]]) {
218169
// CHECK: %[[BOXCHAR:.*]] = load { ptr, i64 }, ptr %[[MAPPED_ARG]]
219170
// CHECK: %[[BOXCHAR_PTR:.*]] = extractvalue { ptr, i64 } %[[BOXCHAR]], 0
220171
// CHECK: %[[BOXCHAR_i64:.*]] = extractvalue { ptr, i64 } %[[BOXCHAR]], 1
221172
// CHECK: %[[MEM_ALLOC:.*]] = alloca i8, i64 %[[BOXCHAR_i64]]
222173
// CHECK: %[[PRIV_BOXCHAR0:.*]] = insertvalue { ptr, i64 } undef, ptr %[[MEM_ALLOC]], 0
223174
// CHECK: %[[PRIV_BOXCHAR1:.*]] = insertvalue { ptr, i64 } %[[PRIV_BOXCHAR0]], i64 %[[BOXCHAR_i64]], 1
224-
225-
226-
// CHECK: define internal void @__omp_offloading_[[SIMPLE_OFFLOADED_FUNCTION]](ptr %[[SV:.*]], ptr %[[SF:.*]])
227-
// CHECK: entry:
228-
// CHECK-NEXT: %[[SV_PRIV_ALLOCA:.*]] = alloca i32, align 4
229-
// CHECK-NEXT: %[[SF_PRIV_ALLOCA:.*]] = alloca float, align 4
230-
// CHECK: omp.private.copy:
231-
// CHECK-NEXT: %[[INIT_SV:.*]] = load i32, ptr %[[SV]], align 4
232-
// CHECK-NEXT: store i32 %[[INIT_SV]], ptr %[[SV_PRIV_ALLOCA]], align 4
233-
// CHECK: %[[INIT_SF:.*]] = load float, ptr %[[SF]], align 4
234-
// CHECK-NEXT store float %[[INIT_SF]], ptr %[[SF_PRIV_ALLOCA]], align 4
235-
// CHECK: omp.target
236-
// CHECK: %[[LOAD_SV:.*]] = load i32, ptr %[[SV_PRIV_ALLOCA]], align 4
237-
// CHECK-NEXT: %[[ADD_SV:.*]] = add i32 %[[LOAD_SV]], 10
238-
// CHECK-NEXT: store i32 %[[ADD_SV]], ptr %[[SV_PRIV_ALLOCA]], align 4
239-
// CHECK: %[[LOAD_SF:.*]] = load float, ptr %[[SF_PRIV_ALLOCA]], align 4
240-
// CHECK-NEXT: %[[SF_EXT:.*]] = fpext float %[[LOAD_SF]] to double
241-
// CHECK-NEXT: %[[ADD_SF:.*]] = fadd contract double %[[SF_EXT]], 2.000000e+00
242-
// CHECK-NEXT: %[[TRUNC_SF:.*]] = fptrunc double %[[ADD_SF]] to float
243-
// CHECK-NEXT: store float %[[TRUNC_SF]], ptr %[[SF_PRIV_ALLOCA]], align 4
244-

0 commit comments

Comments
 (0)