Skip to content

Commit 296a95a

Browse files
SaieieiSairudra Morealexey-bataev
authored andcommitted
[OpenMP] Fix firstprivate pointer handling in target regions (llvm#167879)
Firstprivate pointers in OpenMP target regions were not being lowered correctly, causing the runtime to perform unnecessary present table lookups instead of passing pointer values directly. This patch adds the OMP_MAP_LITERAL flag for firstprivate pointers, enabling the runtime to pass pointer values directly without lookups. The fix handles both explicit firstprivate clauses and implicit firstprivate semantics from defaultmap clauses. Key changes: - Track defaultmap(firstprivate:...) clauses in MappableExprsHandler - Add isEffectivelyFirstprivate() to check both explicit and implicit firstprivate semantics - Apply OMP_MAP_LITERAL flag to firstprivate pointers in generateDefaultMapInfo() Map type values: - 288 = OMP_MAP_TARGET_PARAM | OMP_MAP_LITERAL (explicit firstprivate) - 800 = OMP_MAP_TARGET_PARAM | OMP_MAP_LITERAL | OMP_MAP_IS_PTR (implicit firstprivate from defaultmap) Before: Pointers got 544 (TARGET_PARAM | IS_PTR) causing runtime lookups After: Pointers get 288 or 800 (includes LITERAL) for direct pass Updated the 16 existing test cases in OpenMP that were expecting the previous (buggy) behavior. The tests were checking for map type values of 544 (TARGET_PARAM | IS_PTR) and 32 (TARGET_PARAM) for firstprivate pointers, which lacked the LITERAL flag (256). With this fix, firstprivate pointers now correctly include the LITERAL flag, resulting in map types 800 (TARGET_PARAM | LITERAL | IS_PTR) for implicit firstprivate and 288 (TARGET_PARAM | LITERAL) for explicit firstprivate. The updated tests now validate the correct behavior as per OpenMP 5.2 semantics, where firstprivate variables should be passed by value rather than requiring runtime present table lookups. --------- Co-authored-by: Sairudra More <[email protected]> Co-authored-by: Alexey Bataev <[email protected]>
1 parent 3eb3ac4 commit 296a95a

18 files changed

+256
-34
lines changed

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 64 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "clang/Basic/SourceManager.h"
2929
#include "clang/CodeGen/ConstantInitBuilder.h"
3030
#include "llvm/ADT/ArrayRef.h"
31+
#include "llvm/ADT/SmallSet.h"
3132
#include "llvm/ADT/SmallVector.h"
3233
#include "llvm/ADT/StringExtras.h"
3334
#include "llvm/Bitcode/BitcodeReader.h"
@@ -7210,6 +7211,9 @@ class MappableExprsHandler {
72107211
/// firstprivate, false otherwise.
72117212
llvm::DenseMap<CanonicalDeclPtr<const VarDecl>, bool> FirstPrivateDecls;
72127213

7214+
/// Set of defaultmap clause kinds that use firstprivate behavior.
7215+
llvm::SmallSet<OpenMPDefaultmapClauseKind, 4> DefaultmapFirstprivateKinds;
7216+
72137217
/// Map between device pointer declarations and their expression components.
72147218
/// The key value for declarations in 'this' is null.
72157219
llvm::DenseMap<
@@ -8988,6 +8992,10 @@ class MappableExprsHandler {
89888992
FirstPrivateDecls.try_emplace(VD, /*Implicit=*/true);
89898993
}
89908994
}
8995+
// Extract defaultmap clause information.
8996+
for (const auto *C : Dir.getClausesOfKind<OMPDefaultmapClause>())
8997+
if (C->getDefaultmapModifier() == OMPC_DEFAULTMAP_MODIFIER_firstprivate)
8998+
DefaultmapFirstprivateKinds.insert(C->getDefaultmapKind());
89918999
// Extract device pointer clause information.
89929000
for (const auto *C : Dir.getClausesOfKind<OMPIsDevicePtrClause>())
89939001
for (auto L : C->component_lists())
@@ -9565,6 +9573,35 @@ class MappableExprsHandler {
95659573
}
95669574
}
95679575

9576+
/// Check if a variable should be treated as firstprivate due to explicit
9577+
/// firstprivate clause or defaultmap(firstprivate:...).
9578+
bool isEffectivelyFirstprivate(const VarDecl *VD, QualType Type) const {
9579+
// Check explicit firstprivate clauses
9580+
if (FirstPrivateDecls.count(VD))
9581+
return true;
9582+
9583+
// Check defaultmap(firstprivate:scalar) for scalar types
9584+
if (DefaultmapFirstprivateKinds.count(OMPC_DEFAULTMAP_scalar)) {
9585+
if (Type->isScalarType())
9586+
return true;
9587+
}
9588+
9589+
// Check defaultmap(firstprivate:pointer) for pointer types
9590+
if (DefaultmapFirstprivateKinds.count(OMPC_DEFAULTMAP_pointer)) {
9591+
if (Type->isAnyPointerType())
9592+
return true;
9593+
}
9594+
9595+
// Check defaultmap(firstprivate:aggregate) for aggregate types
9596+
if (DefaultmapFirstprivateKinds.count(OMPC_DEFAULTMAP_aggregate)) {
9597+
if (Type->isAggregateType())
9598+
return true;
9599+
}
9600+
9601+
// Check defaultmap(firstprivate:all) for all types
9602+
return DefaultmapFirstprivateKinds.count(OMPC_DEFAULTMAP_all);
9603+
}
9604+
95689605
/// Generate the default map information for a given capture \a CI,
95699606
/// record field declaration \a RI and captured value \a CV.
95709607
void generateDefaultMapInfo(const CapturedStmt::Capture &CI,
@@ -9592,13 +9629,23 @@ class MappableExprsHandler {
95929629
CombinedInfo.DevicePtrDecls.push_back(nullptr);
95939630
CombinedInfo.DevicePointers.push_back(DeviceInfoTy::None);
95949631
CombinedInfo.Pointers.push_back(CV);
9632+
bool IsFirstprivate =
9633+
isEffectivelyFirstprivate(VD, RI.getType().getNonReferenceType());
9634+
95959635
if (!RI.getType()->isAnyPointerType()) {
95969636
// We have to signal to the runtime captures passed by value that are
95979637
// not pointers.
95989638
CombinedInfo.Types.push_back(
95999639
OpenMPOffloadMappingFlags::OMP_MAP_LITERAL);
96009640
CombinedInfo.Sizes.push_back(CGF.Builder.CreateIntCast(
96019641
CGF.getTypeSize(RI.getType()), CGF.Int64Ty, /*isSigned=*/true));
9642+
} else if (IsFirstprivate) {
9643+
// Firstprivate pointers should be passed by value (as literals)
9644+
// without performing a present table lookup at runtime.
9645+
CombinedInfo.Types.push_back(
9646+
OpenMPOffloadMappingFlags::OMP_MAP_LITERAL);
9647+
// Use zero size for pointer literals (just passing the pointer value)
9648+
CombinedInfo.Sizes.push_back(llvm::Constant::getNullValue(CGF.Int64Ty));
96029649
} else {
96039650
// Pointers are implicitly mapped with a zero size and no flags
96049651
// (other than first map that is added for all implicit maps).
@@ -9612,26 +9659,31 @@ class MappableExprsHandler {
96129659
assert(CI.capturesVariable() && "Expected captured reference.");
96139660
const auto *PtrTy = cast<ReferenceType>(RI.getType().getTypePtr());
96149661
QualType ElementType = PtrTy->getPointeeType();
9615-
CombinedInfo.Sizes.push_back(CGF.Builder.CreateIntCast(
9616-
CGF.getTypeSize(ElementType), CGF.Int64Ty, /*isSigned=*/true));
9617-
// The default map type for a scalar/complex type is 'to' because by
9618-
// default the value doesn't have to be retrieved. For an aggregate
9619-
// type, the default is 'tofrom'.
9620-
CombinedInfo.Types.push_back(getMapModifiersForPrivateClauses(CI));
96219662
const VarDecl *VD = CI.getCapturedVar();
9622-
auto I = FirstPrivateDecls.find(VD);
9663+
bool IsFirstprivate = isEffectivelyFirstprivate(VD, ElementType);
96239664
CombinedInfo.Exprs.push_back(VD->getCanonicalDecl());
96249665
CombinedInfo.BasePointers.push_back(CV);
96259666
CombinedInfo.DevicePtrDecls.push_back(nullptr);
96269667
CombinedInfo.DevicePointers.push_back(DeviceInfoTy::None);
9627-
if (I != FirstPrivateDecls.end() && ElementType->isAnyPointerType()) {
9628-
Address PtrAddr = CGF.EmitLoadOfReference(CGF.MakeAddrLValue(
9629-
CV, ElementType, CGF.getContext().getDeclAlign(VD),
9630-
AlignmentSource::Decl));
9631-
CombinedInfo.Pointers.push_back(PtrAddr.emitRawPointer(CGF));
9668+
9669+
// For firstprivate pointers, pass by value instead of dereferencing
9670+
if (IsFirstprivate && ElementType->isAnyPointerType()) {
9671+
// Treat as a literal value (pass the pointer value itself)
9672+
CombinedInfo.Pointers.push_back(CV);
9673+
// Use zero size for pointer literals
9674+
CombinedInfo.Sizes.push_back(llvm::Constant::getNullValue(CGF.Int64Ty));
9675+
CombinedInfo.Types.push_back(
9676+
OpenMPOffloadMappingFlags::OMP_MAP_LITERAL);
96329677
} else {
9678+
CombinedInfo.Sizes.push_back(CGF.Builder.CreateIntCast(
9679+
CGF.getTypeSize(ElementType), CGF.Int64Ty, /*isSigned=*/true));
9680+
// The default map type for a scalar/complex type is 'to' because by
9681+
// default the value doesn't have to be retrieved. For an aggregate
9682+
// type, the default is 'tofrom'.
9683+
CombinedInfo.Types.push_back(getMapModifiersForPrivateClauses(CI));
96339684
CombinedInfo.Pointers.push_back(CV);
96349685
}
9686+
auto I = FirstPrivateDecls.find(VD);
96359687
if (I != FirstPrivateDecls.end())
96369688
IsImplicit = I->getSecond();
96379689
}

clang/test/OpenMP/target_codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
// code and have mapped arguments, and only 6 have all-constant map sizes.
7979

8080
// CHECK-DAG: [[SIZET:@.+]] = private unnamed_addr constant [2 x i64] [i64 0, i64 4]
81-
// CHECK-DAG: [[MAPT:@.+]] = private unnamed_addr constant [2 x i64] [i64 544, i64 800]
81+
// CHECK-DAG: [[MAPT:@.+]] = private unnamed_addr constant [2 x i64] [i64 800, i64 800]
8282
// CHECK-DAG: [[SIZET2:@.+]] = private unnamed_addr constant [1 x i{{32|64}}] [i64 2]
8383
// CHECK-DAG: [[MAPT2:@.+]] = private unnamed_addr constant [1 x i64] [i64 800]
8484
// CHECK-DAG: [[SIZET3:@.+]] = private unnamed_addr constant [2 x i64] [i64 4, i64 2]

clang/test/OpenMP/target_defaultmap_codegen_01.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ void explicit_maps_single (){
735735

736736
// CK14: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer
737737
// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544
738-
// CK14: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 544]
738+
// CK14: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 800]
739739

740740
// CK14-LABEL: explicit_maps_single{{.*}}(
741741
void explicit_maps_single (){
@@ -1235,7 +1235,7 @@ void implicit_maps_struct (int a){
12351235

12361236
// CK22-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] zeroinitializer
12371237
// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544
1238-
// CK22-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 544]
1238+
// CK22-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
12391239

12401240
// CK22-LABEL: implicit_maps_pointer{{.*}}(
12411241
void implicit_maps_pointer (){

clang/test/OpenMP/target_depend_codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
// TCHECK: [[ENTTY:%.+]] = type { i64, i16, i16, i32, ptr, ptr, i64, i64, ptr }
4545

4646
// CHECK-DAG: [[SIZET:@.+]] = private unnamed_addr constant [3 x i64] [i64 0, i64 4, i64 {{16|12}}]
47-
// CHECK-DAG: [[MAPT:@.+]] = private unnamed_addr constant [3 x i64] [i64 544, i64 800, i64 3]
47+
// CHECK-DAG: [[MAPT:@.+]] = private unnamed_addr constant [3 x i64] [i64 800, i64 800, i64 3]
4848
// CHECK-DAG: @{{.*}} = weak constant i8 0
4949

5050
// TCHECK: @{{.+}} = weak constant [[ENTTY]]
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s
2+
// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3+
// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4+
// expected-no-diagnostics
5+
6+
#ifndef HEADER
7+
#define HEADER
8+
9+
/// ========================================================================
10+
/// Test: Firstprivate pointer handling in OpenMP target regions
11+
/// ========================================================================
12+
///
13+
/// This test verifies that pointers with firstprivate semantics get the
14+
/// OMP_MAP_LITERAL flag, enabling the runtime to pass pointer values directly
15+
/// without performing present table lookups.
16+
///
17+
/// Map type values:
18+
/// 288 = OMP_MAP_TARGET_PARAM (32) + OMP_MAP_LITERAL (256)
19+
/// Used for explicit firstprivate(ptr)
20+
///
21+
/// 800 = OMP_MAP_TARGET_PARAM (32) + OMP_MAP_LITERAL (256) + OMP_MAP_IS_PTR (512)
22+
/// Used for implicit firstprivate pointers (e.g., from defaultmap clauses)
23+
/// Note: 512 is OMP_MAP_IS_PTR, not IMPLICIT. Implicitness is tracked separately.
24+
///
25+
/// 544 = OMP_MAP_TARGET_PARAM (32) + OMP_MAP_IS_PTR (512)
26+
/// Incorrect behavior - missing LITERAL flag, causes runtime present table lookup
27+
///
28+
29+
///==========================================================================
30+
/// Test 1: Explicit firstprivate(pointer) → map type 288
31+
///==========================================================================
32+
33+
// CHECK-DAG: @.offload_maptypes{{[^.]*}} = private unnamed_addr constant [1 x i64] [i64 288]
34+
// CHECK-DAG: @.offload_sizes{{[^.]*}} = private unnamed_addr constant [1 x i64] zeroinitializer
35+
36+
void test1_explicit_firstprivate() {
37+
double *ptr = nullptr;
38+
39+
// Explicit firstprivate should generate map type 288
40+
// (TARGET_PARAM | LITERAL, no IS_PTR flag for explicit clauses)
41+
#pragma omp target firstprivate(ptr)
42+
{
43+
if (ptr) ptr[0] = 1.0;
44+
}
45+
}
46+
47+
///==========================================================================
48+
/// Test 2: defaultmap(firstprivate:pointer) → map type 800
49+
///==========================================================================
50+
51+
// CHECK-DAG: @.offload_maptypes{{.*}} = private unnamed_addr constant [1 x i64] [i64 800]
52+
// CHECK-DAG: @.offload_sizes{{.*}} = private unnamed_addr constant [1 x i64] zeroinitializer
53+
54+
void test2_defaultmap_firstprivate_pointer() {
55+
double *ptr = nullptr;
56+
57+
// defaultmap(firstprivate:pointer) creates implicit firstprivate
58+
// Should generate map type 800 (TARGET_PARAM | LITERAL | IS_PTR)
59+
#pragma omp target defaultmap(firstprivate:pointer)
60+
{
61+
if (ptr) ptr[0] = 2.0;
62+
}
63+
}
64+
65+
///==========================================================================
66+
/// Test 3: defaultmap(firstprivate:scalar) with double → map type 800
67+
///==========================================================================
68+
69+
// CHECK-DAG: @.offload_maptypes{{.*}} = private unnamed_addr constant [1 x i64] [i64 800]
70+
71+
void test3_defaultmap_scalar_double() {
72+
double d = 3.0;
73+
74+
// OpenMP's "scalar" category excludes pointers but includes arithmetic types
75+
// Double gets implicit firstprivate → map type 800
76+
#pragma omp target defaultmap(firstprivate:scalar)
77+
{
78+
d += 1.0;
79+
}
80+
}
81+
82+
///==========================================================================
83+
/// Test 4: Pointer with defaultmap(firstprivate:scalar) → map type 800
84+
///==========================================================================
85+
86+
// CHECK-DAG: @.offload_maptypes{{.*}} = private unnamed_addr constant [1 x i64] [i64 800]
87+
// CHECK-DAG: @.offload_sizes{{.*}} = private unnamed_addr constant [1 x i64] zeroinitializer
88+
89+
void test4_pointer_with_scalar_defaultmap() {
90+
double *ptr = nullptr;
91+
92+
// Note: defaultmap(firstprivate:scalar) does NOT apply to pointers (scalar excludes pointers).
93+
// However, the pointer still gets 800 because in OpenMP 5.0+, pointers without explicit
94+
// data-sharing attributes are implicitly firstprivate and lowered as IS_PTR|LITERAL|TARGET_PARAM.
95+
// This is the default pointer behavior, NOT due to the scalar defaultmap.
96+
#pragma omp target defaultmap(firstprivate:scalar)
97+
{
98+
if (ptr) ptr[0] = 4.0;
99+
}
100+
}
101+
102+
///==========================================================================
103+
/// Test 5: Multiple pointers with explicit firstprivate → all get 288
104+
///==========================================================================
105+
106+
// CHECK-DAG: @.offload_maptypes{{.*}} = private unnamed_addr constant [3 x i64] [i64 288, i64 288, i64 288]
107+
// CHECK-DAG: @.offload_sizes{{.*}} = private unnamed_addr constant [3 x i64] zeroinitializer
108+
109+
void test5_multiple_firstprivate() {
110+
int *a = nullptr;
111+
float *b = nullptr;
112+
double *c = nullptr;
113+
114+
// All explicit firstprivate pointers get map type 288
115+
#pragma omp target firstprivate(a, b, c)
116+
{
117+
if (a) a[0] = 6;
118+
if (b) b[0] = 7.0f;
119+
if (c) c[0] = 8.0;
120+
}
121+
}
122+
123+
///==========================================================================
124+
/// Test 6: Pointer to const with firstprivate → map type 288
125+
///==========================================================================
126+
127+
// CHECK-DAG: @.offload_maptypes{{.*}} = private unnamed_addr constant [1 x i64] [i64 288]
128+
// CHECK-DAG: @.offload_sizes{{.*}} = private unnamed_addr constant [1 x i64] zeroinitializer
129+
130+
void test6_const_pointer() {
131+
const double *const_ptr = nullptr;
132+
133+
// Const pointer with explicit firstprivate → 288
134+
#pragma omp target firstprivate(const_ptr)
135+
{
136+
if (const_ptr) {
137+
double val = const_ptr[0];
138+
(void)val;
139+
}
140+
}
141+
}
142+
143+
///==========================================================================
144+
/// Test 7: Pointer-to-pointer with firstprivate → map type 288
145+
///==========================================================================
146+
147+
// CHECK-DAG: @.offload_maptypes{{.*}} = private unnamed_addr constant [1 x i64] [i64 288]
148+
// CHECK-DAG: @.offload_sizes{{.*}} = private unnamed_addr constant [1 x i64] zeroinitializer
149+
150+
void test7_pointer_to_pointer() {
151+
int **pp = nullptr;
152+
153+
// Pointer-to-pointer with explicit firstprivate → 288
154+
#pragma omp target firstprivate(pp)
155+
{
156+
if (pp && *pp) (*pp)[0] = 9;
157+
}
158+
}
159+
160+
///==========================================================================
161+
/// Verification: The key fix is that firstprivate pointers now include
162+
/// the LITERAL flag (256), which tells the runtime to pass the pointer
163+
/// value directly instead of performing a present table lookup.
164+
///
165+
/// Before fix: Pointers got 544 (TARGET_PARAM | IS_PTR) → runtime lookup
166+
/// After fix: Pointers get 288 or 800 (includes LITERAL) → direct pass
167+
///==========================================================================
168+
169+
#endif // HEADER

clang/test/OpenMP/target_map_codegen_01.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@
3838
// CK2-LABEL: @.__omp_offloading_{{.*}}implicit_maps_reference{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
3939

4040
// CK2: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 4]
41-
// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
41+
// Map types: OMP_MAP_LITERAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
4242
// CK2: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
4343
// CK2-LABEL: @.__omp_offloading_{{.*}}implicit_maps_reference{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
4444
// CK2: [[SIZES2:@.+]] = {{.+}}constant [1 x i64] zeroinitializer
45-
// Map types: OMP_MAP_IS_PTR | OMP_MAP_IMPLICIT = 544
46-
// CK2: [[TYPES2:@.+]] = {{.+}}constant [1 x i64] [i64 544]
45+
// Map types: OMP_MAP_IS_PTR | OMP_MAP_LITERAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
46+
// CK2: [[TYPES2:@.+]] = {{.+}}constant [1 x i64] [i64 800]
4747

4848
// CK2-LABEL: implicit_maps_reference{{.*}}(
4949
void implicit_maps_reference (int a, int *b){

clang/test/OpenMP/target_map_codegen_09.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
// CK10-LABEL: @.__omp_offloading_{{.*}}implicit_maps_pointer{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
3737

3838
// CK10-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] zeroinitializer
39-
// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544
40-
// CK10-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 544]
39+
// Map types: OMP_MAP_IS_PTR | OMP_MAP_LITERAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
40+
// CK10-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
4141

4242
// CK10-LABEL: implicit_maps_pointer{{.*}}(
4343
void implicit_maps_pointer (){

clang/test/OpenMP/target_map_codegen_10.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
// CK11_5-DAG: [[SIZES:@.+]] = {{.+}}constant [2 x i64] [i64 16, i64 0]
3333
// Map types: OMP_MAP_TO | OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547
3434
// CK11_4-DAG: [[TYPES:@.+]] = {{.+}}constant [2 x i64] [i64 547, i64 547]
35-
// CK11_5-DAG: [[TYPES:@.+]] = {{.+}}constant [2 x i64] [i64 547, i64 544]
35+
// Map types: OMP_MAP_TO | OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547, OMP_MAP_IS_PTR | OMP_MAP_LITERAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
36+
// CK11_5-DAG: [[TYPES:@.+]] = {{.+}}constant [2 x i64] [i64 547, i64 800]
3637

3738
// CK11-LABEL: implicit_maps_double_complex{{.*}}(
3839
void implicit_maps_double_complex (int a, int *b){

clang/test/OpenMP/target_map_codegen_26.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
3737
// CK27: [[SIZE00:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer
38-
// CK27: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 544]
38+
// CK27: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 800]
3939

4040
// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
4141
// CK27: [[SIZE01:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer
@@ -52,7 +52,7 @@
5252
// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
5353
// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
5454
// CK27: [[SIZE05:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer
55-
// CK27: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
55+
// CK27: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 288]
5656

5757
// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
5858
// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0

0 commit comments

Comments
 (0)