Skip to content

Commit fa81402

Browse files
committed
merge main into amd-staging
2 parents 3a73595 + c5ce802 commit fa81402

File tree

197 files changed

+9979
-6636
lines changed

Some content is hidden

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

197 files changed

+9979
-6636
lines changed

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
HeaderFilterRegex: ''
12
Checks: >
23
-*,
34
clang-diagnostic-*,

clang/lib/Basic/Diagnostic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ WarningsSpecialCaseList::create(const llvm::MemoryBuffer &Input,
534534
void WarningsSpecialCaseList::processSections(DiagnosticsEngine &Diags) {
535535
static constexpr auto WarningFlavor = clang::diag::Flavor::WarningOrError;
536536
for (const auto &SectionEntry : sections()) {
537-
StringRef DiagGroup = SectionEntry.SectionStr;
537+
StringRef DiagGroup = SectionEntry.name();
538538
if (DiagGroup == "*") {
539539
// Drop the default section introduced by special case list, we only
540540
// support exact diagnostic group names.

clang/lib/Basic/ProfileList.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ProfileSpecialCaseList : public llvm::SpecialCaseList {
3636

3737
bool hasPrefix(StringRef Prefix) const {
3838
for (const auto &It : sections())
39-
if (It.Entries.count(Prefix) > 0)
39+
if (It.hasPrefix(Prefix))
4040
return true;
4141
return false;
4242
}

clang/lib/Basic/SanitizerSpecialCaseList.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void SanitizerSpecialCaseList::createSanitizerSections() {
4242
SanitizerMask Mask;
4343

4444
#define SANITIZER(NAME, ID) \
45-
if (S.SectionMatcher.matchAny(NAME)) \
45+
if (S.matchName(NAME)) \
4646
Mask |= SanitizerKind::ID;
4747
#define SANITIZER_GROUP(NAME, ID, ALIAS) SANITIZER(NAME, ID)
4848

@@ -68,7 +68,7 @@ SanitizerSpecialCaseList::inSectionBlame(SanitizerMask Mask, StringRef Prefix,
6868
if (S.Mask & Mask) {
6969
unsigned LineNum = S.S.getLastMatch(Prefix, Query, Category);
7070
if (LineNum > 0)
71-
return {S.S.FileIdx, LineNum};
71+
return {S.S.fileIndex(), LineNum};
7272
}
7373
}
7474
return NotFound;

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10083,19 +10083,44 @@ static llvm::Value *emitDeviceID(
1008310083
return DeviceID;
1008410084
}
1008510085

10086-
static llvm::Value *emitDynCGGroupMem(const OMPExecutableDirective &D,
10087-
CodeGenFunction &CGF) {
10088-
llvm::Value *DynCGroupMem = CGF.Builder.getInt32(0);
10089-
10090-
if (auto *DynMemClause = D.getSingleClause<OMPXDynCGroupMemClause>()) {
10091-
CodeGenFunction::RunCleanupsScope DynCGroupMemScope(CGF);
10092-
llvm::Value *DynCGroupMemVal = CGF.EmitScalarExpr(
10093-
DynMemClause->getSize(), /*IgnoreResultAssign=*/true);
10094-
DynCGroupMem = CGF.Builder.CreateIntCast(DynCGroupMemVal, CGF.Int32Ty,
10095-
/*isSigned=*/false);
10086+
static std::pair<llvm::Value *, OMPDynGroupprivateFallbackType>
10087+
emitDynCGroupMem(const OMPExecutableDirective &D, CodeGenFunction &CGF) {
10088+
llvm::Value *DynGP = CGF.Builder.getInt32(0);
10089+
auto DynGPFallback = OMPDynGroupprivateFallbackType::Abort;
10090+
10091+
if (auto *DynGPClause = D.getSingleClause<OMPDynGroupprivateClause>()) {
10092+
CodeGenFunction::RunCleanupsScope DynGPScope(CGF);
10093+
llvm::Value *DynGPVal =
10094+
CGF.EmitScalarExpr(DynGPClause->getSize(), /*IgnoreResultAssign=*/true);
10095+
DynGP = CGF.Builder.CreateIntCast(DynGPVal, CGF.Int32Ty,
10096+
/*isSigned=*/false);
10097+
auto FallbackModifier = DynGPClause->getDynGroupprivateFallbackModifier();
10098+
switch (FallbackModifier) {
10099+
case OMPC_DYN_GROUPPRIVATE_FALLBACK_abort:
10100+
DynGPFallback = OMPDynGroupprivateFallbackType::Abort;
10101+
break;
10102+
case OMPC_DYN_GROUPPRIVATE_FALLBACK_null:
10103+
DynGPFallback = OMPDynGroupprivateFallbackType::Null;
10104+
break;
10105+
case OMPC_DYN_GROUPPRIVATE_FALLBACK_default_mem:
10106+
case OMPC_DYN_GROUPPRIVATE_FALLBACK_unknown:
10107+
// This is the default for dyn_groupprivate.
10108+
DynGPFallback = OMPDynGroupprivateFallbackType::DefaultMem;
10109+
break;
10110+
default:
10111+
llvm_unreachable("Unknown fallback modifier for OpenMP dyn_groupprivate");
10112+
}
10113+
} else if (auto *OMPXDynCGClause =
10114+
D.getSingleClause<OMPXDynCGroupMemClause>()) {
10115+
CodeGenFunction::RunCleanupsScope DynCGMemScope(CGF);
10116+
llvm::Value *DynCGMemVal = CGF.EmitScalarExpr(OMPXDynCGClause->getSize(),
10117+
/*IgnoreResultAssign=*/true);
10118+
DynGP = CGF.Builder.CreateIntCast(DynCGMemVal, CGF.Int32Ty,
10119+
/*isSigned=*/false);
1009610120
}
10097-
return DynCGroupMem;
10121+
return {DynGP, DynGPFallback};
1009810122
}
10123+
1009910124
static void genMapInfoForCaptures(
1010010125
MappableExprsHandler &MEHandler, CodeGenFunction &CGF,
1010110126
const CapturedStmt &CS, llvm::SmallVectorImpl<llvm::Value *> &CapturedVars,
@@ -10640,7 +10665,7 @@ static void emitTargetCallKernelLaunch(
1064010665
llvm::Value *RTLoc = OMPRuntime->emitUpdateLocation(CGF, D.getBeginLoc());
1064110666
llvm::Value *NumIterations =
1064210667
OMPRuntime->emitTargetNumIterationsCall(CGF, D, SizeEmitter);
10643-
llvm::Value *DynCGGroupMem = emitDynCGGroupMem(D, CGF);
10668+
auto [DynCGroupMem, DynCGroupMemFallback] = emitDynCGroupMem(D, CGF);
1064410669
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP(
1064510670
CGF.AllocaInsertPt->getParent(), CGF.AllocaInsertPt->getIterator());
1064610671

@@ -10650,7 +10675,7 @@ static void emitTargetCallKernelLaunch(
1065010675

1065110676
llvm::OpenMPIRBuilder::TargetKernelArgs Args(
1065210677
NumTargetItems, RTArgs, NumIterations, NumTeams, NumThreads,
10653-
DynCGGroupMem, HasNoWait);
10678+
DynCGroupMem, HasNoWait, DynCGroupMemFallback);
1065410679

1065510680
llvm::OpenMPIRBuilder::InsertPointTy AfterIP =
1065610681
cantFail(OMPRuntime->getOMPBuilder().emitKernelLaunch(

clang/test/CIR/CodeGen/complex.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,3 +1495,42 @@ void calling_function_that_return_complex() {
14951495
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1
14961496
// OGCG: store float %[[RESULT_REAL]], ptr %[[A_REAL_PTR]], align 4
14971497
// OGCG: store float %[[RESULT_IMAG]], ptr %[[A_IMAG_PTR]], align 4
1498+
1499+
void imag_literal_gnu_extension() {
1500+
float _Complex a = 3.0fi;
1501+
double _Complex b = 3.0i;
1502+
int _Complex c = 3i;
1503+
}
1504+
1505+
// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a", init]
1506+
// CIR: %[[B_ADDR:.*]] = cir.alloca !cir.complex<!cir.double>, !cir.ptr<!cir.complex<!cir.double>>, ["b", init]
1507+
// CIR: %[[C_ADDR:.*]] = cir.alloca !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>>, ["c", init]
1508+
// CIR: %[[COMPLEX_A:.*]] = cir.const #cir.const_complex<#cir.fp<0.000000e+00> : !cir.float, #cir.fp<3.000000e+00> : !cir.float> : !cir.complex<!cir.float>
1509+
// CIR: cir.store{{.*}} %[[COMPLEX_A]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>
1510+
// CIR: %[[COMPLEX_B:.*]] = cir.const #cir.const_complex<#cir.fp<0.000000e+00> : !cir.double, #cir.fp<3.000000e+00> : !cir.double> : !cir.complex<!cir.double>
1511+
// CIR: cir.store{{.*}} %[[COMPLEX_B]], %[[B_ADDR]] : !cir.complex<!cir.double>, !cir.ptr<!cir.complex<!cir.double>>
1512+
// CIR: %[[COMPLEX_C:.*]] = cir.const #cir.const_complex<#cir.int<0> : !s32i, #cir.int<3> : !s32i> : !cir.complex<!s32i>
1513+
// CIR: cir.store{{.*}} %[[COMPLEX_C]], %[[C_ADDR]] : !cir.complex<!s32i>, !cir.ptr<!cir.complex<!s32i>>
1514+
1515+
// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4
1516+
// LLVM: %[[B_ADDR:.*]] = alloca { double, double }, i64 1, align 8
1517+
// LLVM: %[[C_ADDR:.*]] = alloca { i32, i32 }, i64 1, align 4
1518+
// LLVM: store { float, float } { float 0.000000e+00, float 3.000000e+00 }, ptr %[[A_ADDR]], align 4
1519+
// LLVM: store { double, double } { double 0.000000e+00, double 3.000000e+00 }, ptr %[[B_ADDR]], align 8
1520+
// LLVM: store { i32, i32 } { i32 0, i32 3 }, ptr %[[C_ADDR]], align 4
1521+
1522+
// OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4
1523+
// OGCG: %[[B_ADDR:.*]] = alloca { double, double }, align 8
1524+
// OGCG: %[[C_ADDR:.*]] = alloca { i32, i32 }, align 4
1525+
// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0
1526+
// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1
1527+
// OGCG: store float 0.000000e+00, ptr %[[A_REAL_PTR]], align 4
1528+
// OGCG: store float 3.000000e+00, ptr %[[A_IMAG_PTR]], align 4
1529+
// OGCG: %[[B_REAL_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[B_ADDR]], i32 0, i32 0
1530+
// OGCG: %[[B_IMAG_PTR:.*]] = getelementptr inbounds nuw { double, double }, ptr %[[B_ADDR]], i32 0, i32 1
1531+
// OGCG: store double 0.000000e+00, ptr %[[B_REAL_PTR]], align 8
1532+
// OGCG: store double 3.000000e+00, ptr %[[B_IMAG_PTR]], align 8
1533+
// OGCG: %[[C_REAL_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[C_ADDR]], i32 0, i32 0
1534+
// OGCG: %[[C_IMAG_PTR:.*]] = getelementptr inbounds nuw { i32, i32 }, ptr %[[C_ADDR]], i32 0, i32 1
1535+
// OGCG: store i32 0, ptr %[[C_REAL_PTR]], align 4
1536+
// OGCG: store i32 3, ptr %[[C_IMAG_PTR]], align 4
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
!world
1+
v1
2+
f world
3+
c 0

clang/test/CodeGen/basic-block-sections.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ int another(int a) {
3030
//
3131
// BB_WORLD: .section .text.world,"ax",@progbits{{$}}
3232
// BB_WORLD: world:
33-
// BB_WORLD: .section .text.world,"ax",@progbits,unique
34-
// BB_WORLD: world.__part.1:
33+
// BB_ALL: .section .text.world,"ax",@progbits,unique
34+
// BB_ALL: world.__part.1:
35+
// BB_LIST: .section .text.split.world,"ax",@progbits
36+
// BB_LIST: world.cold:
3537
// BB_ALL: .section .text.another,"ax",@progbits
3638
// BB_ALL: another.__part.1:
3739
// BB_LIST-NOT: .section .text.another,"ax",@progbits

0 commit comments

Comments
 (0)