Skip to content

Commit eb0930b

Browse files
authored
merge main into amd-staging (llvm#2425)
2 parents ce2ffee + e99bcd6 commit eb0930b

File tree

76 files changed

+534
-197
lines changed

Some content is hidden

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

76 files changed

+534
-197
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@ Bug Fixes in This Version
685685
base classes. (GH139452)
686686
- Fixed an assertion failure in serialization of constexpr structs containing unions. (#GH140130)
687687
- Fixed duplicate entries in TableGen that caused the wrong attribute to be selected. (GH#140701)
688+
- Fixed type mismatch error when 'builtin-elementwise-math' arguments have different qualifiers, this should be well-formed. (#GH141397)
688689

689690
Bug Fixes to Compiler Builtins
690691
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,11 @@ AFFECTING_VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is
223223
CODEGENOPT(AtomicProfileUpdate , 1, 0) ///< Set -fprofile-update=atomic
224224
CODEGENOPT(ContinuousProfileSync, 1, 0) ///< Enable continuous instrumentation profiling
225225
/// Choose profile instrumenation kind or no instrumentation.
226-
ENUM_CODEGENOPT(ProfileInstr, ProfileInstrKind, 4, ProfileNone)
226+
227+
ENUM_CODEGENOPT(ProfileInstr, llvm::driver::ProfileInstrKind, 4, llvm::driver::ProfileInstrKind::ProfileNone)
228+
227229
/// Choose profile kind for PGO use compilation.
228-
ENUM_CODEGENOPT(ProfileUse, ProfileInstrKind, 2, ProfileNone)
230+
ENUM_CODEGENOPT(ProfileUse, llvm::driver::ProfileInstrKind, 2, llvm::driver::ProfileInstrKind::ProfileNone)
229231
/// Partition functions into N groups and select only functions in group i to be
230232
/// instrumented. Selected group numbers can be 0 to N-1 inclusive.
231233
VALUE_CODEGENOPT(ProfileTotalFunctionGroups, 32, 1)

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,35 +526,41 @@ class CodeGenOptions : public CodeGenOptionsBase {
526526

527527
/// Check if Clang profile instrumenation is on.
528528
bool hasProfileClangInstr() const {
529-
return getProfileInstr() == ProfileClangInstr;
529+
return getProfileInstr() ==
530+
llvm::driver::ProfileInstrKind::ProfileClangInstr;
530531
}
531532

532533
/// Check if IR level profile instrumentation is on.
533534
bool hasProfileIRInstr() const {
534-
return getProfileInstr() == ProfileIRInstr;
535+
return getProfileInstr() == llvm::driver::ProfileInstrKind::ProfileIRInstr;
535536
}
536537

537538
/// Check if CS IR level profile instrumentation is on.
538539
bool hasProfileCSIRInstr() const {
539-
return getProfileInstr() == ProfileCSIRInstr;
540+
return getProfileInstr() ==
541+
llvm::driver::ProfileInstrKind::ProfileCSIRInstr;
540542
}
541543

542544
/// Check if any form of instrumentation is on.
543-
bool hasProfileInstr() const { return getProfileInstr() != ProfileNone; }
545+
bool hasProfileInstr() const {
546+
return getProfileInstr() != llvm::driver::ProfileInstrKind::ProfileNone;
547+
}
544548

545549
/// Check if Clang profile use is on.
546550
bool hasProfileClangUse() const {
547-
return getProfileUse() == ProfileClangInstr;
551+
return getProfileUse() == llvm::driver::ProfileInstrKind::ProfileClangInstr;
548552
}
549553

550554
/// Check if IR level profile use is on.
551555
bool hasProfileIRUse() const {
552-
return getProfileUse() == ProfileIRInstr ||
553-
getProfileUse() == ProfileCSIRInstr;
556+
return getProfileUse() == llvm::driver::ProfileInstrKind::ProfileIRInstr ||
557+
getProfileUse() == llvm::driver::ProfileInstrKind::ProfileCSIRInstr;
554558
}
555559

556560
/// Check if CSIR profile use is on.
557-
bool hasProfileCSIRUse() const { return getProfileUse() == ProfileCSIRInstr; }
561+
bool hasProfileCSIRUse() const {
562+
return getProfileUse() == llvm::driver::ProfileInstrKind::ProfileCSIRInstr;
563+
}
558564

559565
/// Check if type and variable info should be emitted.
560566
bool hasReducedDebugInfo() const {

clang/include/clang/Basic/ProfileList.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,16 @@ class ProfileList {
4949
~ProfileList();
5050

5151
bool isEmpty() const { return Empty; }
52-
ExclusionType getDefault(CodeGenOptions::ProfileInstrKind Kind) const;
52+
ExclusionType getDefault(llvm::driver::ProfileInstrKind Kind) const;
5353

5454
std::optional<ExclusionType>
5555
isFunctionExcluded(StringRef FunctionName,
56-
CodeGenOptions::ProfileInstrKind Kind) const;
56+
llvm::driver::ProfileInstrKind Kind) const;
5757
std::optional<ExclusionType>
5858
isLocationExcluded(SourceLocation Loc,
59-
CodeGenOptions::ProfileInstrKind Kind) const;
59+
llvm::driver::ProfileInstrKind Kind) const;
6060
std::optional<ExclusionType>
61-
isFileExcluded(StringRef FileName,
62-
CodeGenOptions::ProfileInstrKind Kind) const;
61+
isFileExcluded(StringRef FileName, llvm::driver::ProfileInstrKind Kind) const;
6362
};
6463

6564
} // namespace clang

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ def fmcdc_max_test_vectors_EQ : Joined<["-"], "fmcdc-max-test-vectors=">,
17811781
HelpText<"Maximum number of test vectors in MC/DC coverage">,
17821782
MarshallingInfoInt<CodeGenOpts<"MCDCMaxTVs">, "0x7FFFFFFE">;
17831783
def fprofile_generate : Flag<["-"], "fprofile-generate">,
1784-
Group<f_Group>, Visibility<[ClangOption, CLOption]>,
1784+
Group<f_Group>, Visibility<[ClangOption, CLOption, FlangOption, FC1Option]>,
17851785
HelpText<"Generate instrumented code to collect execution counts into default.profraw (overridden by LLVM_PROFILE_FILE env var)">;
17861786
def fprofile_generate_EQ : Joined<["-"], "fprofile-generate=">,
17871787
Group<f_Group>, Visibility<[ClangOption, CLOption]>,
@@ -1798,7 +1798,7 @@ def fprofile_use : Flag<["-"], "fprofile-use">, Group<f_Group>,
17981798
Visibility<[ClangOption, CLOption]>, Alias<fprofile_instr_use>;
17991799
def fprofile_use_EQ : Joined<["-"], "fprofile-use=">,
18001800
Group<f_Group>,
1801-
Visibility<[ClangOption, CLOption]>,
1801+
Visibility<[ClangOption, CLOption, FlangOption, FC1Option]>,
18021802
MetaVarName<"<pathname>">,
18031803
HelpText<"Use instrumentation data for profile-guided optimization. If pathname is a directory, it reads from <pathname>/default.profdata. Otherwise, it reads from file <pathname>.">;
18041804
def fno_profile_instr_generate : Flag<["-"], "fno-profile-instr-generate">,
@@ -5625,7 +5625,7 @@ def mrecip_EQ : CommaJoined<["-"], "mrecip=">, Group<m_Group>,
56255625
"<value> = ( ['!'] ['vec-'] ('rcp'|'sqrt') [('h'|'s'|'d')] [':'<n>] ) | 'all' | 'default' | 'none'">,
56265626
MarshallingInfoStringVector<CodeGenOpts<"Reciprocals">>;
56275627
def mprefer_vector_width_EQ : Joined<["-"], "mprefer-vector-width=">, Group<m_Group>,
5628-
Visibility<[ClangOption, CC1Option]>,
5628+
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
56295629
HelpText<"Specifies preferred vector width for auto-vectorization. Defaults to 'none' which allows target specific decisions.">,
56305630
MarshallingInfoString<CodeGenOpts<"PreferVectorWidth">>;
56315631
def mstack_protector_guard_EQ : Joined<["-"], "mstack-protector-guard=">, Group<m_Group>,

clang/lib/Basic/ProfileList.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,24 @@ ProfileList::ProfileList(ArrayRef<std::string> Paths, SourceManager &SM)
7070

7171
ProfileList::~ProfileList() = default;
7272

73-
static StringRef getSectionName(CodeGenOptions::ProfileInstrKind Kind) {
73+
static StringRef getSectionName(llvm::driver::ProfileInstrKind Kind) {
7474
switch (Kind) {
75-
case CodeGenOptions::ProfileNone:
75+
case llvm::driver::ProfileInstrKind::ProfileNone:
7676
return "";
77-
case CodeGenOptions::ProfileClangInstr:
77+
case llvm::driver::ProfileInstrKind::ProfileClangInstr:
7878
return "clang";
79-
case CodeGenOptions::ProfileIRInstr:
79+
case llvm::driver::ProfileInstrKind::ProfileIRInstr:
8080
return "llvm";
81-
case CodeGenOptions::ProfileCSIRInstr:
81+
case llvm::driver::ProfileInstrKind::ProfileCSIRInstr:
8282
return "csllvm";
8383
case CodeGenOptions::ProfileIRSampleColdCov:
8484
return "sample-coldcov";
8585
}
86-
llvm_unreachable("Unhandled CodeGenOptions::ProfileInstrKind enum");
86+
llvm_unreachable("Unhandled llvm::driver::ProfileInstrKind enum");
8787
}
8888

8989
ProfileList::ExclusionType
90-
ProfileList::getDefault(CodeGenOptions::ProfileInstrKind Kind) const {
90+
ProfileList::getDefault(llvm::driver::ProfileInstrKind Kind) const {
9191
StringRef Section = getSectionName(Kind);
9292
// Check for "default:<type>"
9393
if (SCL->inSection(Section, "default", "allow"))
@@ -118,7 +118,7 @@ ProfileList::inSection(StringRef Section, StringRef Prefix,
118118

119119
std::optional<ProfileList::ExclusionType>
120120
ProfileList::isFunctionExcluded(StringRef FunctionName,
121-
CodeGenOptions::ProfileInstrKind Kind) const {
121+
llvm::driver::ProfileInstrKind Kind) const {
122122
StringRef Section = getSectionName(Kind);
123123
// Check for "function:<regex>=<case>"
124124
if (auto V = inSection(Section, "function", FunctionName))
@@ -132,13 +132,13 @@ ProfileList::isFunctionExcluded(StringRef FunctionName,
132132

133133
std::optional<ProfileList::ExclusionType>
134134
ProfileList::isLocationExcluded(SourceLocation Loc,
135-
CodeGenOptions::ProfileInstrKind Kind) const {
135+
llvm::driver::ProfileInstrKind Kind) const {
136136
return isFileExcluded(SM.getFilename(SM.getFileLoc(Loc)), Kind);
137137
}
138138

139139
std::optional<ProfileList::ExclusionType>
140140
ProfileList::isFileExcluded(StringRef FileName,
141-
CodeGenOptions::ProfileInstrKind Kind) const {
141+
llvm::driver::ProfileInstrKind Kind) const {
142142
StringRef Section = getSectionName(Kind);
143143
// Check for "source:<regex>=<case>"
144144
if (auto V = inSection(Section, "source", FileName))

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,10 @@ namespace clang {
123123
extern llvm::cl::opt<bool> ClSanitizeGuardChecks;
124124
}
125125

126-
// Default filename used for profile generation.
127-
static std::string getDefaultProfileGenName() {
128-
return DebugInfoCorrelate || ProfileCorrelate != InstrProfCorrelator::NONE
129-
? "default_%m.proflite"
130-
: "default_%m.profraw";
131-
}
132-
133126
// Path and name of file used for profile generation
134127
static std::string getProfileGenName(const CodeGenOptions &CodeGenOpts) {
135128
std::string FileName = CodeGenOpts.InstrProfileOutput.empty()
136-
? getDefaultProfileGenName()
129+
? llvm::driver::getDefaultProfileGenName()
137130
: CodeGenOpts.InstrProfileOutput;
138131
if (CodeGenOpts.ContinuousProfileSync)
139132
FileName = "%c" + FileName;
@@ -835,44 +828,45 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
835828

836829
if (CodeGenOpts.hasProfileIRInstr())
837830
// -fprofile-generate.
838-
PGOOpt = PGOOptions(getProfileGenName(CodeGenOpts), "", "",
839-
CodeGenOpts.MemoryProfileUsePath, nullptr,
840-
PGOOptions::IRInstr, PGOOptions::NoCSAction,
841-
ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling,
842-
/*PseudoProbeForProfiling=*/false,
843-
CodeGenOpts.AtomicProfileUpdate);
831+
PGOOpt = PGOOptions(
832+
getProfileGenName(CodeGenOpts), "", "",
833+
CodeGenOpts.MemoryProfileUsePath, nullptr, PGOOptions::IRInstr,
834+
PGOOptions::NoCSAction, llvm::ClPGOColdFuncAttr,
835+
CodeGenOpts.DebugInfoForProfiling,
836+
/*PseudoProbeForProfiling=*/false, CodeGenOpts.AtomicProfileUpdate);
844837
else if (CodeGenOpts.hasProfileIRUse()) {
845838
// -fprofile-use.
846839
auto CSAction = CodeGenOpts.hasProfileCSIRUse() ? PGOOptions::CSIRUse
847840
: PGOOptions::NoCSAction;
848841
PGOOpt = PGOOptions(CodeGenOpts.ProfileInstrumentUsePath, "",
849842
CodeGenOpts.ProfileRemappingFile,
850843
CodeGenOpts.MemoryProfileUsePath, VFS,
851-
PGOOptions::IRUse, CSAction, ClPGOColdFuncAttr,
844+
PGOOptions::IRUse, CSAction, llvm::ClPGOColdFuncAttr,
852845
CodeGenOpts.DebugInfoForProfiling);
853846
} else if (!CodeGenOpts.SampleProfileFile.empty())
854847
// -fprofile-sample-use
855848
PGOOpt = PGOOptions(
856849
CodeGenOpts.SampleProfileFile, "", CodeGenOpts.ProfileRemappingFile,
857850
CodeGenOpts.MemoryProfileUsePath, VFS, PGOOptions::SampleUse,
858-
PGOOptions::NoCSAction, ClPGOColdFuncAttr,
851+
PGOOptions::NoCSAction, llvm::ClPGOColdFuncAttr,
859852
CodeGenOpts.DebugInfoForProfiling, CodeGenOpts.PseudoProbeForProfiling);
860853
else if (!CodeGenOpts.MemoryProfileUsePath.empty())
861854
// -fmemory-profile-use (without any of the above options)
862-
PGOOpt = PGOOptions("", "", "", CodeGenOpts.MemoryProfileUsePath, VFS,
863-
PGOOptions::NoAction, PGOOptions::NoCSAction,
864-
ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling);
865-
else if (CodeGenOpts.PseudoProbeForProfiling)
866-
// -fpseudo-probe-for-profiling
867855
PGOOpt =
868-
PGOOptions("", "", "", /*MemoryProfile=*/"", nullptr,
856+
PGOOptions("", "", "", CodeGenOpts.MemoryProfileUsePath, VFS,
869857
PGOOptions::NoAction, PGOOptions::NoCSAction,
870-
ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling, true);
858+
llvm::ClPGOColdFuncAttr, CodeGenOpts.DebugInfoForProfiling);
859+
else if (CodeGenOpts.PseudoProbeForProfiling)
860+
// -fpseudo-probe-for-profiling
861+
PGOOpt = PGOOptions("", "", "", /*MemoryProfile=*/"", nullptr,
862+
PGOOptions::NoAction, PGOOptions::NoCSAction,
863+
llvm::ClPGOColdFuncAttr,
864+
CodeGenOpts.DebugInfoForProfiling, true);
871865
else if (CodeGenOpts.DebugInfoForProfiling)
872866
// -fdebug-info-for-profiling
873867
PGOOpt = PGOOptions("", "", "", /*MemoryProfile=*/"", nullptr,
874868
PGOOptions::NoAction, PGOOptions::NoCSAction,
875-
ClPGOColdFuncAttr, true);
869+
llvm::ClPGOColdFuncAttr, true);
876870

877871
// Check to see if we want to generate a CS profile.
878872
if (CodeGenOpts.hasProfileCSIRInstr()) {

clang/lib/CodeGen/CodeGenAction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ void BackendConsumer::HandleTranslationUnit(ASTContext &C) {
274274
std::unique_ptr<llvm::ToolOutputFile> OptRecordFile =
275275
std::move(*OptRecordFileOrErr);
276276

277-
if (OptRecordFile &&
278-
CodeGenOpts.getProfileUse() != CodeGenOptions::ProfileNone)
277+
if (OptRecordFile && CodeGenOpts.getProfileUse() !=
278+
llvm::driver::ProfileInstrKind::ProfileNone)
279279
Ctx.setDiagnosticsHotnessRequested(true);
280280

281281
if (CodeGenOpts.MisExpect) {

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,8 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
940940
}
941941
}
942942

943-
if (CGM.getCodeGenOpts().getProfileInstr() != CodeGenOptions::ProfileNone) {
943+
if (CGM.getCodeGenOpts().getProfileInstr() !=
944+
llvm::driver::ProfileInstrKind::ProfileNone) {
944945
switch (CGM.isFunctionBlockedFromProfileInstr(Fn, Loc)) {
945946
case ProfileList::Skip:
946947
Fn->addFnAttr(llvm::Attribute::SkipProfile);

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3608,7 +3608,7 @@ CodeGenModule::isFunctionBlockedByProfileList(llvm::Function *Fn,
36083608
// If the profile list is empty, then instrument everything.
36093609
if (ProfileList.isEmpty())
36103610
return ProfileList::Allow;
3611-
CodeGenOptions::ProfileInstrKind Kind = getCodeGenOpts().getProfileInstr();
3611+
llvm::driver::ProfileInstrKind Kind = getCodeGenOpts().getProfileInstr();
36123612
// First, check the function name.
36133613
if (auto V = ProfileList.isFunctionExcluded(Fn->getName(), Kind))
36143614
return *V;

0 commit comments

Comments
 (0)