Skip to content

Commit 851703e

Browse files
authored
Merge branch 'main' into helper-upstream
2 parents ab0c9cb + 0767c64 commit 851703e

File tree

107 files changed

+9097
-6234
lines changed

Some content is hidden

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

107 files changed

+9097
-6234
lines changed

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
@@ -10013,19 +10013,44 @@ static llvm::Value *emitDeviceID(
1001310013
return DeviceID;
1001410014
}
1001510015

10016-
static llvm::Value *emitDynCGGroupMem(const OMPExecutableDirective &D,
10017-
CodeGenFunction &CGF) {
10018-
llvm::Value *DynCGroupMem = CGF.Builder.getInt32(0);
10019-
10020-
if (auto *DynMemClause = D.getSingleClause<OMPXDynCGroupMemClause>()) {
10021-
CodeGenFunction::RunCleanupsScope DynCGroupMemScope(CGF);
10022-
llvm::Value *DynCGroupMemVal = CGF.EmitScalarExpr(
10023-
DynMemClause->getSize(), /*IgnoreResultAssign=*/true);
10024-
DynCGroupMem = CGF.Builder.CreateIntCast(DynCGroupMemVal, CGF.Int32Ty,
10025-
/*isSigned=*/false);
10016+
static std::pair<llvm::Value *, OMPDynGroupprivateFallbackType>
10017+
emitDynCGroupMem(const OMPExecutableDirective &D, CodeGenFunction &CGF) {
10018+
llvm::Value *DynGP = CGF.Builder.getInt32(0);
10019+
auto DynGPFallback = OMPDynGroupprivateFallbackType::Abort;
10020+
10021+
if (auto *DynGPClause = D.getSingleClause<OMPDynGroupprivateClause>()) {
10022+
CodeGenFunction::RunCleanupsScope DynGPScope(CGF);
10023+
llvm::Value *DynGPVal =
10024+
CGF.EmitScalarExpr(DynGPClause->getSize(), /*IgnoreResultAssign=*/true);
10025+
DynGP = CGF.Builder.CreateIntCast(DynGPVal, CGF.Int32Ty,
10026+
/*isSigned=*/false);
10027+
auto FallbackModifier = DynGPClause->getDynGroupprivateFallbackModifier();
10028+
switch (FallbackModifier) {
10029+
case OMPC_DYN_GROUPPRIVATE_FALLBACK_abort:
10030+
DynGPFallback = OMPDynGroupprivateFallbackType::Abort;
10031+
break;
10032+
case OMPC_DYN_GROUPPRIVATE_FALLBACK_null:
10033+
DynGPFallback = OMPDynGroupprivateFallbackType::Null;
10034+
break;
10035+
case OMPC_DYN_GROUPPRIVATE_FALLBACK_default_mem:
10036+
case OMPC_DYN_GROUPPRIVATE_FALLBACK_unknown:
10037+
// This is the default for dyn_groupprivate.
10038+
DynGPFallback = OMPDynGroupprivateFallbackType::DefaultMem;
10039+
break;
10040+
default:
10041+
llvm_unreachable("Unknown fallback modifier for OpenMP dyn_groupprivate");
10042+
}
10043+
} else if (auto *OMPXDynCGClause =
10044+
D.getSingleClause<OMPXDynCGroupMemClause>()) {
10045+
CodeGenFunction::RunCleanupsScope DynCGMemScope(CGF);
10046+
llvm::Value *DynCGMemVal = CGF.EmitScalarExpr(OMPXDynCGClause->getSize(),
10047+
/*IgnoreResultAssign=*/true);
10048+
DynGP = CGF.Builder.CreateIntCast(DynCGMemVal, CGF.Int32Ty,
10049+
/*isSigned=*/false);
1002610050
}
10027-
return DynCGroupMem;
10051+
return {DynGP, DynGPFallback};
1002810052
}
10053+
1002910054
static void genMapInfoForCaptures(
1003010055
MappableExprsHandler &MEHandler, CodeGenFunction &CGF,
1003110056
const CapturedStmt &CS, llvm::SmallVectorImpl<llvm::Value *> &CapturedVars,
@@ -10234,7 +10259,7 @@ static void emitTargetCallKernelLaunch(
1023410259
llvm::Value *RTLoc = OMPRuntime->emitUpdateLocation(CGF, D.getBeginLoc());
1023510260
llvm::Value *NumIterations =
1023610261
OMPRuntime->emitTargetNumIterationsCall(CGF, D, SizeEmitter);
10237-
llvm::Value *DynCGGroupMem = emitDynCGGroupMem(D, CGF);
10262+
auto [DynCGroupMem, DynCGroupMemFallback] = emitDynCGroupMem(D, CGF);
1023810263
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP(
1023910264
CGF.AllocaInsertPt->getParent(), CGF.AllocaInsertPt->getIterator());
1024010265

@@ -10244,7 +10269,7 @@ static void emitTargetCallKernelLaunch(
1024410269

1024510270
llvm::OpenMPIRBuilder::TargetKernelArgs Args(
1024610271
NumTargetItems, RTArgs, NumIterations, NumTeams, NumThreads,
10247-
DynCGGroupMem, HasNoWait);
10272+
DynCGroupMem, HasNoWait, DynCGroupMemFallback);
1024810273

1024910274
llvm::OpenMPIRBuilder::InsertPointTy AfterIP =
1025010275
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

0 commit comments

Comments
 (0)