Skip to content

Commit 4e95612

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:d89d3a6a0eb3 into amd-gfx:6b554b98f849
Local branch amd-gfx 6b554b9 Merged main:7ebf3e019488 into amd-gfx:481ed31ee2aa Remote branch main d89d3a6 [Sema] add cast from IncompleteArrayType to ConstantArrayType in TryReferenceListInitialization (llvm#65918)
2 parents 6b554b9 + d89d3a6 commit 4e95612

File tree

60 files changed

+1319
-1536
lines changed

Some content is hidden

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

60 files changed

+1319
-1536
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ Bug Fixes in This Version
264264
(`#66047 <https://github.com/llvm/llvm-project/issues/66047>`_)
265265
- Fix parser crash when dealing with ill-formed objective C++ header code. Fixes
266266
(`#64836 <https://github.com/llvm/llvm-project/issues/64836>`_)
267+
- Fix crash in implicit conversions from initialize list to arrays of unknown
268+
bound for C++20. Fixes
269+
(`#62945 <https://github.com/llvm/llvm-project/issues/62945>`_)
267270
- Clang now allows an ``_Atomic`` qualified integer in a switch statement. Fixes
268271
(`#65557 <https://github.com/llvm/llvm-project/issues/65557>`_)
269272
- Fixes crash when trying to obtain the common sugared type of

clang/include/clang/AST/OpenMPClause.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9220,27 +9220,6 @@ class OMPXAttributeClause
92209220
}
92219221
};
92229222

9223-
/// This represents 'ompx_bare' clause in the '#pragma omp target teams ...'
9224-
/// directive.
9225-
///
9226-
/// \code
9227-
/// #pragma omp target teams ompx_bare
9228-
/// \endcode
9229-
/// In this example directive '#pragma omp target teams' has a 'ompx_bare'
9230-
/// clause.
9231-
class OMPXBareClause : public OMPNoChildClause<llvm::omp::OMPC_ompx_bare> {
9232-
public:
9233-
/// Build 'ompx_bare' clause.
9234-
///
9235-
/// \param StartLoc Starting location of the clause.
9236-
/// \param EndLoc Ending location of the clause.
9237-
OMPXBareClause(SourceLocation StartLoc, SourceLocation EndLoc)
9238-
: OMPNoChildClause(StartLoc, EndLoc) {}
9239-
9240-
/// Build an empty clause.
9241-
OMPXBareClause() = default;
9242-
};
9243-
92449223
} // namespace clang
92459224

92469225
#endif // LLVM_CLANG_AST_OPENMPCLAUSE_H

clang/include/clang/AST/OperationKinds.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ CAST_OPERATION(LValueToRValue)
8080
/// (possibly) adding qualifiers or removing noexcept.
8181
/// int -> int
8282
/// char** -> const char * const *
83+
/// int[1] -> int[]
8384
/// void () noexcept -> void ()
8485
CAST_OPERATION(NoOp)
8586

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3890,11 +3890,6 @@ bool RecursiveASTVisitor<Derived>::VisitOMPXAttributeClause(
38903890
return true;
38913891
}
38923892

3893-
template <typename Derived>
3894-
bool RecursiveASTVisitor<Derived>::VisitOMPXBareClause(OMPXBareClause *C) {
3895-
return true;
3896-
}
3897-
38983893
// FIXME: look at the following tricky-seeming exprs to see if we
38993894
// need to recurse on anything. These are ones that have methods
39003895
// returning decls or qualtypes or nestednamespecifier -- though I'm

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,8 +1360,6 @@ def warn_clause_expected_string : Warning<
13601360
"expected string literal in 'clause %0' - ignoring">, InGroup<IgnoredPragmas>;
13611361
def err_omp_unexpected_clause : Error<
13621362
"unexpected OpenMP clause '%0' in directive '#pragma omp %1'">;
1363-
def err_omp_unexpected_clause_extension_only : Error<
1364-
"OpenMP clause '%0' is only available as extension, use '-fopenmp-extensions'">;
13651363
def err_omp_immediate_directive : Error<
13661364
"'#pragma omp %0' %select{|with '%2' clause }1cannot be an immediate substatement">;
13671365
def err_omp_expected_identifier_for_critical : Error<
@@ -1454,8 +1452,6 @@ def warn_unknown_declare_variant_isa_trait
14541452
"spelling or consider restricting the context selector with the "
14551453
"'arch' selector further">,
14561454
InGroup<SourceUsesOpenMP>;
1457-
def note_ompx_bare_clause : Note<
1458-
"OpenMP extension clause '%0' only allowed with '#pragma omp %1'">;
14591455
def note_omp_declare_variant_ctx_options
14601456
: Note<"context %select{set|selector|property}0 options are: %1">;
14611457
def warn_omp_declare_variant_expected

clang/include/clang/Basic/TokenKinds.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,9 @@ C23_KEYWORD(typeof , KEYGNU)
423423
C23_KEYWORD(typeof_unqual , 0)
424424

425425
// ISO/IEC JTC1 SC22 WG14 N1169 Extension
426-
KEYWORD(_Accum , KEYNOCXX)
427-
KEYWORD(_Fract , KEYNOCXX)
428-
KEYWORD(_Sat , KEYNOCXX)
426+
KEYWORD(_Accum , KEYALL)
427+
KEYWORD(_Fract , KEYALL)
428+
KEYWORD(_Sat , KEYALL)
429429

430430
// GNU Extensions (in impl-reserved namespace)
431431
KEYWORD(_Decimal32 , KEYALL)

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2054,7 +2054,7 @@ defm fixed_point : BoolFOption<"fixed-point",
20542054
LangOpts<"FixedPoint">, DefaultFalse,
20552055
PosFlag<SetTrue, [], [ClangOption, CC1Option], "Enable">,
20562056
NegFlag<SetFalse, [], [ClangOption], "Disable">,
2057-
BothFlags<[], [ClangOption], " fixed point types">>, ShouldParseIf<!strconcat("!", cplusplus.KeyPath)>;
2057+
BothFlags<[], [ClangOption], " fixed point types">>;
20582058
defm cxx_static_destructors : BoolFOption<"c++-static-destructors",
20592059
LangOpts<"RegisterStaticDestructors">, DefaultTrue,
20602060
NegFlag<SetFalse, [], [ClangOption, CC1Option],

clang/include/clang/Sema/Sema.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12448,10 +12448,6 @@ class Sema final {
1244812448
SourceLocation LParenLoc,
1244912449
SourceLocation EndLoc);
1245012450

12451-
/// Called on a well-formed 'ompx_bare' clause.
12452-
OMPClause *ActOnOpenMPXBareClause(SourceLocation StartLoc,
12453-
SourceLocation EndLoc);
12454-
1245512451
/// The kind of conversion being performed.
1245612452
enum CheckedConversionKind {
1245712453
/// An implicit conversion.

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3048,7 +3048,17 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
30483048
// ::= Di # char32_t
30493049
// ::= Ds # char16_t
30503050
// ::= Dn # std::nullptr_t (i.e., decltype(nullptr))
3051+
// ::= [DS] DA # N1169 fixed-point [_Sat] T _Accum
3052+
// ::= [DS] DR # N1169 fixed-point [_Sat] T _Fract
30513053
// ::= u <source-name> # vendor extended type
3054+
//
3055+
// <fixed-point-size>
3056+
// ::= s # short
3057+
// ::= t # unsigned short
3058+
// ::= i # plain
3059+
// ::= j # unsigned
3060+
// ::= l # long
3061+
// ::= m # unsigned long
30523062
std::string type_name;
30533063
// Normalize integer types as vendor extended types:
30543064
// u<length>i<type size>
@@ -3193,30 +3203,77 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
31933203
Out << "DF16_";
31943204
break;
31953205
case BuiltinType::ShortAccum:
3206+
Out << "DAs";
3207+
break;
31963208
case BuiltinType::Accum:
3209+
Out << "DAi";
3210+
break;
31973211
case BuiltinType::LongAccum:
3212+
Out << "DAl";
3213+
break;
31983214
case BuiltinType::UShortAccum:
3215+
Out << "DAt";
3216+
break;
31993217
case BuiltinType::UAccum:
3218+
Out << "DAj";
3219+
break;
32003220
case BuiltinType::ULongAccum:
3221+
Out << "DAm";
3222+
break;
32013223
case BuiltinType::ShortFract:
3224+
Out << "DRs";
3225+
break;
32023226
case BuiltinType::Fract:
3227+
Out << "DRi";
3228+
break;
32033229
case BuiltinType::LongFract:
3230+
Out << "DRl";
3231+
break;
32043232
case BuiltinType::UShortFract:
3233+
Out << "DRt";
3234+
break;
32053235
case BuiltinType::UFract:
3236+
Out << "DRj";
3237+
break;
32063238
case BuiltinType::ULongFract:
3239+
Out << "DRm";
3240+
break;
32073241
case BuiltinType::SatShortAccum:
3242+
Out << "DSDAs";
3243+
break;
32083244
case BuiltinType::SatAccum:
3245+
Out << "DSDAi";
3246+
break;
32093247
case BuiltinType::SatLongAccum:
3248+
Out << "DSDAl";
3249+
break;
32103250
case BuiltinType::SatUShortAccum:
3251+
Out << "DSDAt";
3252+
break;
32113253
case BuiltinType::SatUAccum:
3254+
Out << "DSDAj";
3255+
break;
32123256
case BuiltinType::SatULongAccum:
3257+
Out << "DSDAm";
3258+
break;
32133259
case BuiltinType::SatShortFract:
3260+
Out << "DSDRs";
3261+
break;
32143262
case BuiltinType::SatFract:
3263+
Out << "DSDRi";
3264+
break;
32153265
case BuiltinType::SatLongFract:
3266+
Out << "DSDRl";
3267+
break;
32163268
case BuiltinType::SatUShortFract:
3269+
Out << "DSDRt";
3270+
break;
32173271
case BuiltinType::SatUFract:
3272+
Out << "DSDRj";
3273+
break;
32183274
case BuiltinType::SatULongFract:
3219-
llvm_unreachable("Fixed point types are disabled for c++");
3275+
Out << "DSDRm";
3276+
break;
32203277
case BuiltinType::Half:
32213278
Out << "Dh";
32223279
break;

clang/lib/AST/OpenMPClause.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
170170
case OMPC_affinity:
171171
case OMPC_when:
172172
case OMPC_bind:
173-
case OMPC_ompx_bare:
174173
break;
175174
default:
176175
break;
@@ -2547,10 +2546,6 @@ void OMPClausePrinter::VisitOMPXAttributeClause(OMPXAttributeClause *Node) {
25472546
OS << ")";
25482547
}
25492548

2550-
void OMPClausePrinter::VisitOMPXBareClause(OMPXBareClause *Node) {
2551-
OS << "ompx_bare";
2552-
}
2553-
25542549
void OMPTraitInfo::getAsVariantMatchInfo(ASTContext &ASTCtx,
25552550
VariantMatchInfo &VMI) const {
25562551
for (const OMPTraitSet &Set : Sets) {

clang/lib/AST/StmtProfile.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,6 @@ void OMPClauseProfiler::VisitOMPDoacrossClause(const OMPDoacrossClause *C) {
930930
}
931931
void OMPClauseProfiler::VisitOMPXAttributeClause(const OMPXAttributeClause *C) {
932932
}
933-
void OMPClauseProfiler::VisitOMPXBareClause(const OMPXBareClause *C) {}
934933
} // namespace
935934

936935
void

clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,10 @@ CGOpenMPRuntimeGPU::getExecutionMode() const {
551551
return CurrentExecutionMode;
552552
}
553553

554-
CGOpenMPRuntimeGPU::DataSharingMode
555-
CGOpenMPRuntimeGPU::getDataSharingMode() const {
556-
return CurrentDataSharingMode;
554+
static CGOpenMPRuntimeGPU::DataSharingMode
555+
getDataSharingMode(CodeGenModule &CGM) {
556+
return CGM.getLangOpts().OpenMPCUDAMode ? CGOpenMPRuntimeGPU::CUDA
557+
: CGOpenMPRuntimeGPU::Generic;
557558
}
558559

559560
/// Check for inner (nested) SPMD construct, if any
@@ -751,9 +752,6 @@ void CGOpenMPRuntimeGPU::emitNonSPMDKernel(const OMPExecutableDirective &D,
751752
EntryFunctionState EST;
752753
WrapperFunctionsMap.clear();
753754

754-
[[maybe_unused]] bool IsBareKernel = D.getSingleClause<OMPXBareClause>();
755-
assert(!IsBareKernel && "bare kernel should not be at generic mode");
756-
757755
// Emit target region as a standalone region.
758756
class NVPTXPrePostActionTy : public PrePostActionTy {
759757
CGOpenMPRuntimeGPU::EntryFunctionState &EST;
@@ -762,13 +760,15 @@ void CGOpenMPRuntimeGPU::emitNonSPMDKernel(const OMPExecutableDirective &D,
762760
NVPTXPrePostActionTy(CGOpenMPRuntimeGPU::EntryFunctionState &EST)
763761
: EST(EST) {}
764762
void Enter(CodeGenFunction &CGF) override {
765-
auto &RT = static_cast<CGOpenMPRuntimeGPU &>(CGF.CGM.getOpenMPRuntime());
763+
auto &RT =
764+
static_cast<CGOpenMPRuntimeGPU &>(CGF.CGM.getOpenMPRuntime());
766765
RT.emitKernelInit(CGF, EST, /* IsSPMD */ false);
767766
// Skip target region initialization.
768767
RT.setLocThreadIdInsertPt(CGF, /*AtCurrentPoint=*/true);
769768
}
770769
void Exit(CodeGenFunction &CGF) override {
771-
auto &RT = static_cast<CGOpenMPRuntimeGPU &>(CGF.CGM.getOpenMPRuntime());
770+
auto &RT =
771+
static_cast<CGOpenMPRuntimeGPU &>(CGF.CGM.getOpenMPRuntime());
772772
RT.clearLocThreadIdInsertPt(CGF);
773773
RT.emitKernelDeinit(CGF, EST, /* IsSPMD */ false);
774774
}
@@ -807,39 +807,25 @@ void CGOpenMPRuntimeGPU::emitSPMDKernel(const OMPExecutableDirective &D,
807807
ExecutionRuntimeModesRAII ModeRAII(CurrentExecutionMode, EM_SPMD);
808808
EntryFunctionState EST;
809809

810-
bool IsBareKernel = D.getSingleClause<OMPXBareClause>();
811-
812810
// Emit target region as a standalone region.
813811
class NVPTXPrePostActionTy : public PrePostActionTy {
814812
CGOpenMPRuntimeGPU &RT;
815813
CGOpenMPRuntimeGPU::EntryFunctionState &EST;
816-
bool IsBareKernel;
817-
DataSharingMode Mode;
818814

819815
public:
820816
NVPTXPrePostActionTy(CGOpenMPRuntimeGPU &RT,
821-
CGOpenMPRuntimeGPU::EntryFunctionState &EST,
822-
bool IsBareKernel)
823-
: RT(RT), EST(EST), IsBareKernel(IsBareKernel),
824-
Mode(RT.CurrentDataSharingMode) {}
817+
CGOpenMPRuntimeGPU::EntryFunctionState &EST)
818+
: RT(RT), EST(EST) {}
825819
void Enter(CodeGenFunction &CGF) override {
826-
if (IsBareKernel) {
827-
RT.CurrentDataSharingMode = DataSharingMode::DS_CUDA;
828-
return;
829-
}
830820
RT.emitKernelInit(CGF, EST, /* IsSPMD */ true);
831821
// Skip target region initialization.
832822
RT.setLocThreadIdInsertPt(CGF, /*AtCurrentPoint=*/true);
833823
}
834824
void Exit(CodeGenFunction &CGF) override {
835-
if (IsBareKernel) {
836-
RT.CurrentDataSharingMode = Mode;
837-
return;
838-
}
839825
RT.clearLocThreadIdInsertPt(CGF);
840826
RT.emitKernelDeinit(CGF, EST, /* IsSPMD */ true);
841827
}
842-
} Action(*this, EST, IsBareKernel);
828+
} Action(*this, EST);
843829
CodeGen.setAction(Action);
844830
IsInTTDRegion = true;
845831
emitTargetOutlinedFunctionHelper(D, ParentName, OutlinedFn, OutlinedFnID,
@@ -857,8 +843,7 @@ void CGOpenMPRuntimeGPU::emitTargetOutlinedFunction(
857843
assert(!ParentName.empty() && "Invalid target region parent name!");
858844

859845
bool Mode = supportsSPMDExecutionMode(CGM.getContext(), D);
860-
bool IsBareKernel = D.getSingleClause<OMPXBareClause>();
861-
if (Mode || IsBareKernel)
846+
if (Mode)
862847
emitSPMDKernel(D, ParentName, OutlinedFn, OutlinedFnID, IsOffloadEntry,
863848
CodeGen);
864849
else
@@ -882,9 +867,6 @@ CGOpenMPRuntimeGPU::CGOpenMPRuntimeGPU(CodeGenModule &CGM)
882867
if (CGM.getLangOpts().NoGPULib || CGM.getLangOpts().OMPHostIRFile.empty())
883868
return;
884869

885-
if (CGM.getLangOpts().OpenMPCUDAMode)
886-
CurrentDataSharingMode = CGOpenMPRuntimeGPU::DS_CUDA;
887-
888870
OMPBuilder.createGlobalFlag(CGM.getLangOpts().OpenMPTargetDebug,
889871
"__omp_rtl_debug_kind");
890872
OMPBuilder.createGlobalFlag(CGM.getLangOpts().OpenMPTeamSubscription,
@@ -1048,7 +1030,7 @@ llvm::Function *CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction(
10481030
void CGOpenMPRuntimeGPU::emitGenericVarsProlog(CodeGenFunction &CGF,
10491031
SourceLocation Loc,
10501032
bool WithSPMDCheck) {
1051-
if (getDataSharingMode() != CGOpenMPRuntimeGPU::DS_Generic &&
1033+
if (getDataSharingMode(CGM) != CGOpenMPRuntimeGPU::Generic &&
10521034
getExecutionMode() != CGOpenMPRuntimeGPU::EM_SPMD)
10531035
return;
10541036

@@ -1160,7 +1142,7 @@ void CGOpenMPRuntimeGPU::getKmpcFreeShared(
11601142

11611143
void CGOpenMPRuntimeGPU::emitGenericVarsEpilog(CodeGenFunction &CGF,
11621144
bool WithSPMDCheck) {
1163-
if (getDataSharingMode() != CGOpenMPRuntimeGPU::DS_Generic &&
1145+
if (getDataSharingMode(CGM) != CGOpenMPRuntimeGPU::Generic &&
11641146
getExecutionMode() != CGOpenMPRuntimeGPU::EM_SPMD)
11651147
return;
11661148

@@ -1196,18 +1178,11 @@ void CGOpenMPRuntimeGPU::emitTeamsCall(CodeGenFunction &CGF,
11961178
if (!CGF.HaveInsertPoint())
11971179
return;
11981180

1199-
bool IsBareKernel = D.getSingleClause<OMPXBareClause>();
1200-
12011181
Address ZeroAddr = CGF.CreateDefaultAlignTempAlloca(CGF.Int32Ty,
12021182
/*Name=*/".zero.addr");
12031183
CGF.Builder.CreateStore(CGF.Builder.getInt32(/*C*/ 0), ZeroAddr);
12041184
llvm::SmallVector<llvm::Value *, 16> OutlinedFnArgs;
1205-
// We don't emit any thread id function call in bare kernel, but because the
1206-
// outlined function has a pointer argument, we emit a nullptr here.
1207-
if (IsBareKernel)
1208-
OutlinedFnArgs.push_back(llvm::ConstantPointerNull::get(CGM.VoidPtrTy));
1209-
else
1210-
OutlinedFnArgs.push_back(emitThreadIDAddress(CGF, Loc).getPointer());
1185+
OutlinedFnArgs.push_back(emitThreadIDAddress(CGF, Loc).getPointer());
12111186
OutlinedFnArgs.push_back(ZeroAddr.getPointer());
12121187
OutlinedFnArgs.append(CapturedVars.begin(), CapturedVars.end());
12131188
emitOutlinedFunctionCall(CGF, Loc, OutlinedFn, OutlinedFnArgs);
@@ -3298,7 +3273,7 @@ llvm::Function *CGOpenMPRuntimeGPU::createParallelDataSharingWrapper(
32983273

32993274
void CGOpenMPRuntimeGPU::emitFunctionProlog(CodeGenFunction &CGF,
33003275
const Decl *D) {
3301-
if (getDataSharingMode() != CGOpenMPRuntimeGPU::DS_Generic)
3276+
if (getDataSharingMode(CGM) != CGOpenMPRuntimeGPU::Generic)
33023277
return;
33033278

33043279
assert(D && "Expected function or captured|block decl.");
@@ -3407,7 +3382,7 @@ Address CGOpenMPRuntimeGPU::getAddressOfLocalVariable(CodeGenFunction &CGF,
34073382
VarTy, Align);
34083383
}
34093384

3410-
if (getDataSharingMode() != CGOpenMPRuntimeGPU::DS_Generic)
3385+
if (getDataSharingMode(CGM) != CGOpenMPRuntimeGPU::Generic)
34113386
return Address::invalid();
34123387

34133388
VD = VD->getCanonicalDecl();

0 commit comments

Comments
 (0)