Skip to content

Commit 8310775

Browse files
committed
merge main into amd-staging
2 parents a78a7c8 + 4aeb290 commit 8310775

File tree

153 files changed

+6362
-2265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+6362
-2265
lines changed

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,9 @@ TARGET_BUILTIN(__builtin_amdgcn_global_load_monitor_b128, "V4iV4i*1Ii", "nc", "g
672672
TARGET_BUILTIN(__builtin_amdgcn_flat_load_monitor_b32, "ii*0Ii", "nc", "gfx1250-insts")
673673
TARGET_BUILTIN(__builtin_amdgcn_flat_load_monitor_b64, "V2iV2i*0Ii", "nc", "gfx1250-insts")
674674
TARGET_BUILTIN(__builtin_amdgcn_flat_load_monitor_b128, "V4iV4i*0Ii", "nc", "gfx1250-insts")
675+
TARGET_BUILTIN(__builtin_amdgcn_cluster_load_b32, "ii*1Iii", "nc", "gfx1250-insts,wavefrontsize32")
676+
TARGET_BUILTIN(__builtin_amdgcn_cluster_load_b64, "V2iV2i*1Iii", "nc", "gfx1250-insts,wavefrontsize32")
677+
TARGET_BUILTIN(__builtin_amdgcn_cluster_load_b128, "V4iV4i*1Iii", "nc", "gfx1250-insts,wavefrontsize32")
675678
TARGET_BUILTIN(__builtin_amdgcn_global_load_async_to_lds_b8, "vc*1c*3IiIi", "nc", "gfx1250-insts")
676679
TARGET_BUILTIN(__builtin_amdgcn_global_load_async_to_lds_b32, "vi*1i*3IiIi", "nc", "gfx1250-insts")
677680
TARGET_BUILTIN(__builtin_amdgcn_global_load_async_to_lds_b64, "vV2i*1V2i*3IiIi", "nc", "gfx1250-insts")

clang/lib/CodeGen/CGCall.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4830,19 +4830,6 @@ struct DestroyUnpassedArg final : EHScopeStack::Cleanup {
48304830
}
48314831
};
48324832

4833-
struct DisableDebugLocationUpdates {
4834-
CodeGenFunction &CGF;
4835-
bool disabledDebugInfo;
4836-
DisableDebugLocationUpdates(CodeGenFunction &CGF, const Expr *E) : CGF(CGF) {
4837-
if ((disabledDebugInfo = isa<CXXDefaultArgExpr>(E) && CGF.getDebugInfo()))
4838-
CGF.disableDebugInfo();
4839-
}
4840-
~DisableDebugLocationUpdates() {
4841-
if (disabledDebugInfo)
4842-
CGF.enableDebugInfo();
4843-
}
4844-
};
4845-
48464833
} // end anonymous namespace
48474834

48484835
RValue CallArg::getRValue(CodeGenFunction &CGF) const {
@@ -4879,7 +4866,9 @@ void CodeGenFunction::EmitWritebacks(const CallArgList &args) {
48794866

48804867
void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E,
48814868
QualType type) {
4882-
DisableDebugLocationUpdates Dis(*this, E);
4869+
std::optional<DisableDebugLocationUpdates> Dis;
4870+
if (isa<CXXDefaultArgExpr>(E))
4871+
Dis.emplace(*this);
48834872
if (const ObjCIndirectCopyRestoreExpr *CRE =
48844873
dyn_cast<ObjCIndirectCopyRestoreExpr>(E)) {
48854874
assert(getLangOpts().ObjCAutoRefCount);
@@ -6294,3 +6283,12 @@ RValue CodeGenFunction::EmitVAArg(VAArgExpr *VE, Address &VAListAddr,
62946283
return CGM.getABIInfo().EmitMSVAArg(*this, VAListAddr, Ty, Slot);
62956284
return CGM.getABIInfo().EmitVAArg(*this, VAListAddr, Ty, Slot);
62966285
}
6286+
6287+
DisableDebugLocationUpdates::DisableDebugLocationUpdates(CodeGenFunction &CGF)
6288+
: CGF(CGF) {
6289+
CGF.disableDebugInfo();
6290+
}
6291+
6292+
DisableDebugLocationUpdates::~DisableDebugLocationUpdates() {
6293+
CGF.enableDebugInfo();
6294+
}

clang/lib/CodeGen/CGCall.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,12 @@ inline FnInfoOpts &operator&=(FnInfoOpts &A, FnInfoOpts B) {
453453
return A;
454454
}
455455

456+
struct DisableDebugLocationUpdates {
457+
CodeGenFunction &CGF;
458+
DisableDebugLocationUpdates(CodeGenFunction &CGF);
459+
~DisableDebugLocationUpdates();
460+
};
461+
456462
} // end namespace CodeGen
457463
} // end namespace clang
458464

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3387,7 +3387,14 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
33873387
auto *FD = LambdaCaptureFields.lookup(BD);
33883388
return EmitCapturedFieldLValue(*this, FD, CXXABIThisValue);
33893389
}
3390-
return EmitLValue(BD->getBinding());
3390+
// Suppress debug location updates when visiting the binding, since the
3391+
// binding may emit instructions that would otherwise be associated with the
3392+
// binding itself, rather than the expression referencing the binding. (this
3393+
// leads to jumpy debug stepping behavior where the location/debugger jump
3394+
// back to the binding declaration, then back to the expression referencing
3395+
// the binding)
3396+
DisableDebugLocationUpdates D(*this);
3397+
return EmitLValue(BD->getBinding(), NotKnownNonNull);
33913398
}
33923399

33933400
// We can form DeclRefExprs naming GUID declarations when reconstituting

clang/lib/CodeGen/TargetBuiltins/AMDGPU.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,27 @@ Value *CodeGenFunction::EmitAMDGPUBuiltinExpr(unsigned BuiltinID,
687687
llvm::Function *F = CGM.getIntrinsic(IID, {LoadTy});
688688
return Builder.CreateCall(F, {Addr, Val});
689689
}
690+
case AMDGPU::BI__builtin_amdgcn_cluster_load_b32:
691+
case AMDGPU::BI__builtin_amdgcn_cluster_load_b64:
692+
case AMDGPU::BI__builtin_amdgcn_cluster_load_b128: {
693+
Intrinsic::ID IID;
694+
switch (BuiltinID) {
695+
case AMDGPU::BI__builtin_amdgcn_cluster_load_b32:
696+
IID = Intrinsic::amdgcn_cluster_load_b32;
697+
break;
698+
case AMDGPU::BI__builtin_amdgcn_cluster_load_b64:
699+
IID = Intrinsic::amdgcn_cluster_load_b64;
700+
break;
701+
case AMDGPU::BI__builtin_amdgcn_cluster_load_b128:
702+
IID = Intrinsic::amdgcn_cluster_load_b128;
703+
break;
704+
}
705+
SmallVector<Value *, 3> Args;
706+
for (int i = 0, e = E->getNumArgs(); i != e; ++i)
707+
Args.push_back(EmitScalarExpr(E->getArg(i)));
708+
llvm::Function *F = CGM.getIntrinsic(IID, {ConvertType(E->getType())});
709+
return Builder.CreateCall(F, {Args});
710+
}
690711
case AMDGPU::BI__builtin_amdgcn_load_to_lds: {
691712
// Should this have asan instrumentation?
692713
return emitBuiltinWithOneOverloadedType<5>(*this, E,

clang/lib/Sema/SemaOpenACCClause.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,8 +1969,9 @@ ExprResult SemaOpenACC::CheckReductionVar(OpenACCDirectiveKind DirectiveKind,
19691969
}
19701970

19711971
auto IsValidMemberOfComposite = [](QualType Ty) {
1972-
return Ty->isDependentType() ||
1973-
(Ty->isScalarType() && !Ty->isPointerType());
1972+
return !Ty->isAnyComplexType() &&
1973+
(Ty->isDependentType() ||
1974+
(Ty->isScalarType() && !Ty->isPointerType()));
19741975
};
19751976

19761977
auto EmitDiags = [&](SourceLocation Loc, PartialDiagnostic PD) {

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16922,9 +16922,13 @@ OMPClause *SemaOpenMP::ActOnOpenMPMessageClause(Expr *ME,
1692216922

1692316923
Stmt *HelperValStmt = nullptr;
1692416924

16925+
// Depending on whether this clause appears in an executable context or not,
16926+
// we may or may not build a capture.
1692516927
OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective();
16926-
OpenMPDirectiveKind CaptureRegion = getOpenMPCaptureRegionForClause(
16927-
DKind, OMPC_message, getLangOpts().OpenMP);
16928+
OpenMPDirectiveKind CaptureRegion =
16929+
DKind == OMPD_unknown ? OMPD_unknown
16930+
: getOpenMPCaptureRegionForClause(
16931+
DKind, OMPC_message, getLangOpts().OpenMP);
1692816932
if (CaptureRegion != OMPD_unknown &&
1692916933
!SemaRef.CurContext->isDependentContext()) {
1693016934
ME = SemaRef.MakeFullExpr(ME).get();
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2+
// REQUIRES: amdgpu-registered-target
3+
// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu gfx1250 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-GFX1250
4+
5+
typedef int v2i __attribute__((ext_vector_type(2)));
6+
typedef int v4i __attribute__((ext_vector_type(4)));
7+
8+
// CHECK-GFX1250-LABEL: @test_amdgcn_cluster_load_b32(
9+
// CHECK-GFX1250-NEXT: entry:
10+
// CHECK-GFX1250-NEXT: [[TMP0:%.*]] = tail call i32 @llvm.amdgcn.cluster.load.b32.i32(ptr addrspace(1) [[INPTR:%.*]], i32 10, i32 [[MASK:%.*]])
11+
// CHECK-GFX1250-NEXT: ret i32 [[TMP0]]
12+
//
13+
int test_amdgcn_cluster_load_b32(global int* inptr, int mask)
14+
{
15+
return __builtin_amdgcn_cluster_load_b32(inptr, 10, mask);
16+
}
17+
18+
// CHECK-GFX1250-LABEL: @test_amdgcn_cluster_load_b64(
19+
// CHECK-GFX1250-NEXT: entry:
20+
// CHECK-GFX1250-NEXT: [[TMP0:%.*]] = tail call <2 x i32> @llvm.amdgcn.cluster.load.b64.v2i32(ptr addrspace(1) [[INPTR:%.*]], i32 22, i32 [[MASK:%.*]])
21+
// CHECK-GFX1250-NEXT: ret <2 x i32> [[TMP0]]
22+
//
23+
v2i test_amdgcn_cluster_load_b64(global v2i* inptr, int mask)
24+
{
25+
return __builtin_amdgcn_cluster_load_b64(inptr, 22, mask);
26+
}
27+
28+
// CHECK-GFX1250-LABEL: @test_amdgcn_cluster_load_b128(
29+
// CHECK-GFX1250-NEXT: entry:
30+
// CHECK-GFX1250-NEXT: [[TMP0:%.*]] = tail call <4 x i32> @llvm.amdgcn.cluster.load.b128.v4i32(ptr addrspace(1) [[INPTR:%.*]], i32 27, i32 [[MASK:%.*]])
31+
// CHECK-GFX1250-NEXT: ret <4 x i32> [[TMP0]]
32+
//
33+
v4i test_amdgcn_cluster_load_b128(global v4i* inptr, int mask)
34+
{
35+
return __builtin_amdgcn_cluster_load_b128(inptr, 27, mask);
36+
}

clang/test/DebugInfo/CXX/structured-binding.cpp

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
// CHECK: #dbg_declare(ptr %{{[0-9]+}}, ![[VAR_4:[0-9]+]], !DIExpression(DW_OP_deref, DW_OP_plus_uconst, 4),
88
// CHECK: #dbg_declare(ptr %z1, ![[VAR_5:[0-9]+]], !DIExpression()
99
// CHECK: #dbg_declare(ptr %z2, ![[VAR_6:[0-9]+]], !DIExpression()
10+
// CHECK: getelementptr inbounds nuw %struct.A, ptr {{.*}}, i32 0, i32 1, !dbg ![[Y1_DEBUG_LOC:[0-9]+]]
11+
// CHECK: getelementptr inbounds nuw %struct.A, ptr {{.*}}, i32 0, i32 1, !dbg ![[Y2_DEBUG_LOC:[0-9]+]]
12+
// CHECK: load ptr, ptr %z2, {{.*}}!dbg ![[Z2_DEBUG_LOC:[0-9]+]]
13+
// CHECK: getelementptr inbounds [2 x i32], ptr {{.*}}, i{{64|32}} 0, i{{64|32}} 1, !dbg ![[A2_DEBUG_LOC:[0-9]+]]
14+
// CHECK: getelementptr inbounds nuw { i32, i32 }, ptr {{.*}}, i32 0, i32 1, !dbg ![[C2_DEBUG_LOC:[0-9]+]]
15+
// CHECK: extractelement <2 x i32> {{.*}}, i32 1, !dbg ![[V2_DEBUG_LOC:[0-9]+]]
1016
// CHECK: ![[VAR_0]] = !DILocalVariable(name: "a"
1117
// CHECK: ![[VAR_1]] = !DILocalVariable(name: "x1", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
1218
// CHECK: ![[VAR_2]] = !DILocalVariable(name: "y1", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
@@ -46,5 +52,41 @@ int f() {
4652
auto [x1, y1] = a;
4753
auto &[x2, y2] = a;
4854
auto [z1, z2] = B{1, 2};
49-
return x1 + y1 + x2 + y2 + z1 + z2;
55+
int array[2] = {3, 4};
56+
auto &[a1, a2] = array;
57+
_Complex int cmplx = {1, 2};
58+
auto &[c1, c2] = cmplx;
59+
int vctr __attribute__ ((vector_size (sizeof(int)*2)))= {1, 2};
60+
auto &[v1, v2] = vctr;
61+
return //
62+
x1 //
63+
+ //
64+
// CHECK: ![[Y1_DEBUG_LOC]] = !DILocation(line: [[@LINE+1]]
65+
y1 //
66+
+ //
67+
x2 //
68+
+ //
69+
// CHECK: ![[Y2_DEBUG_LOC]] = !DILocation(line: [[@LINE+1]]
70+
y2 //
71+
+ //
72+
z1 //
73+
+ //
74+
// CHECK: ![[Z2_DEBUG_LOC]] = !DILocation(line: [[@LINE+1]]
75+
z2 //
76+
+ //
77+
a1 //
78+
+ //
79+
// CHECK: ![[A2_DEBUG_LOC]] = !DILocation(line: [[@LINE+1]]
80+
a2 //
81+
+ //
82+
c1 //
83+
+ //
84+
// CHECK: ![[C2_DEBUG_LOC]] = !DILocation(line: [[@LINE+1]]
85+
c2 //
86+
+ //
87+
v1 //
88+
+ //
89+
// CHECK: ![[V2_DEBUG_LOC]] = !DILocation(line: [[@LINE+1]]
90+
v2 //
91+
;
5092
}

clang/test/OpenMP/error_message.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -ferror-limit 100 %s -Wuninitialized
55
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=60 -ferror-limit 100 %s -Wuninitialized
66

7+
// Test outside of an executable context.
8+
#pragma omp error severity(warning) message("msg") at(compilation) // expected-warning {{msg}}
9+
710
template <class T>
811
T tmain(T argc) {
912
if (argc)

0 commit comments

Comments
 (0)