Skip to content

Commit fc9fdf0

Browse files
authored
merge main into amd-staging (llvm#3846)
2 parents a78a7c8 + 60492aa commit fc9fdf0

File tree

154 files changed

+6433
-2334
lines changed

Some content is hidden

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

154 files changed

+6433
-2334
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();

0 commit comments

Comments
 (0)