Skip to content

Commit b18da74

Browse files
authored
Merge branch 'main' into bundle-break-phyreg-liveness
2 parents cfa6151 + f626620 commit b18da74

File tree

474 files changed

+17765
-12367
lines changed

Some content is hidden

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

474 files changed

+17765
-12367
lines changed

bolt/lib/Utils/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,25 @@ set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
66

77
set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
88

9+
if(llvm_vc AND LLVM_APPEND_VC_REV)
10+
set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
11+
endif()
12+
if(LLVM_VC_REPOSITORY AND LLVM_VC_REVISION)
13+
set(llvm_source_dir ${LLVM_SOURCE_DIR})
14+
set(llvm_vc_repository ${LLVM_VC_REPOSITORY})
15+
set(llvm_vc_revision ${LLVM_VC_REVISION})
16+
endif()
17+
if(bolt_vc AND LLVM_APPEND_VC_REV)
18+
set(bolt_source_dir ${BOLT_SOURCE_DIR})
19+
endif()
20+
921
# Create custom target to generate the VC revision include.
1022
add_custom_command(OUTPUT "${version_inc}"
1123
DEPENDS "${llvm_vc}" "${bolt_vc}" "${generate_vcs_version_script}"
1224
COMMAND ${CMAKE_COMMAND} "-DNAMES=BOLT"
25+
"-DLLVM_SOURCE_DIR=${llvm_source_dir}"
26+
"-DBOLT_SOURCE_DIR=${bolt_source_dir}"
1327
"-DHEADER_FILE=${version_inc}"
14-
"-DBOLT_SOURCE_DIR=${BOLT_SOURCE_DIR}"
1528
"-DLLVM_VC_REPOSITORY=${llvm_vc_repository}"
1629
"-DLLVM_VC_REVISION=${llvm_vc_revision}"
1730
"-DLLVM_FORCE_VC_REVISION=${LLVM_FORCE_VC_REVISION}"

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ mergeInfos(std::vector<std::unique_ptr<Info>> &Values) {
147147
return llvm::createStringError(llvm::inconvertibleErrorCode(),
148148
"unexpected info type");
149149
}
150+
llvm_unreachable("unhandled enumerator");
150151
}
151152

152153
bool CommentInfo::operator==(const CommentInfo &Other) const {

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ std::string serialize(std::unique_ptr<Info> &I) {
392392
case InfoType::IT_default:
393393
return "";
394394
}
395+
llvm_unreachable("unhandled enumerator");
395396
}
396397

397398
static void parseFullComment(const FullComment *C, CommentInfo &CI) {

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ Bug Fixes in This Version
704704
- Fixed a bug with constexpr evaluation for structs containing unions in case of C++ modules. (#GH143168)
705705
- Fixed incorrect token location when emitting diagnostics for tokens expanded from macros. (#GH143216)
706706
- Fixed an infinite recursion when checking constexpr destructors. (#GH141789)
707+
- Fixed a crash when a malformed using declaration appears in a ``constexpr`` function. (#GH144264)
707708

708709
Bug Fixes to Compiler Builtins
709710
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/ASTContext.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,48 @@ class ASTContext : public RefCountedBase<ASTContext> {
629629
void setRelocationInfoForCXXRecord(const CXXRecordDecl *,
630630
CXXRecordDeclRelocationInfo);
631631

632+
/// Examines a given type, and returns whether the type itself
633+
/// is address discriminated, or any transitively embedded types
634+
/// contain data that is address discriminated. This includes
635+
/// implicitly authenticated values like vtable pointers, as well as
636+
/// explicitly qualified fields.
637+
bool containsAddressDiscriminatedPointerAuth(QualType T) {
638+
if (!isPointerAuthenticationAvailable())
639+
return false;
640+
return findPointerAuthContent(T) != PointerAuthContent::None;
641+
}
642+
643+
/// Examines a given type, and returns whether the type itself
644+
/// or any data it transitively contains has a pointer authentication
645+
/// schema that is not safely relocatable. e.g. any data or fields
646+
/// with address discrimination other than any otherwise similar
647+
/// vtable pointers.
648+
bool containsNonRelocatablePointerAuth(QualType T) {
649+
if (!isPointerAuthenticationAvailable())
650+
return false;
651+
return findPointerAuthContent(T) ==
652+
PointerAuthContent::AddressDiscriminatedData;
653+
}
654+
632655
private:
633656
llvm::DenseMap<const CXXRecordDecl *, CXXRecordDeclRelocationInfo>
634657
RelocatableClasses;
635658

659+
// FIXME: store in RecordDeclBitfields in future?
660+
enum class PointerAuthContent : uint8_t {
661+
None,
662+
AddressDiscriminatedVTable,
663+
AddressDiscriminatedData
664+
};
665+
666+
// A simple helper function to short circuit pointer auth checks.
667+
bool isPointerAuthenticationAvailable() const {
668+
return LangOpts.PointerAuthCalls || LangOpts.PointerAuthIntrinsics;
669+
}
670+
PointerAuthContent findPointerAuthContent(QualType T);
671+
llvm::DenseMap<const RecordDecl *, PointerAuthContent>
672+
RecordContainsAddressDiscriminatedPointerAuth;
673+
636674
ImportDecl *FirstLocalImport = nullptr;
637675
ImportDecl *LastLocalImport = nullptr;
638676

@@ -3668,6 +3706,7 @@ OPT_LIST(V)
36683706
/// authentication policy for the specified record.
36693707
const CXXRecordDecl *
36703708
baseForVTableAuthentication(const CXXRecordDecl *ThisClass);
3709+
36713710
bool useAbbreviatedThunkName(GlobalDecl VirtualMethodDecl,
36723711
StringRef MangledName);
36733712

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,10 @@ CODEGENOPT(StaticClosure, 1, 0)
483483
/// Assume that UAVs/SRVs may alias
484484
CODEGENOPT(ResMayAlias, 1, 0)
485485

486-
/// Enables unwind v2 (epilog) information for x64 Windows.
487-
CODEGENOPT(WinX64EHUnwindV2, 1, 0)
486+
/// Controls how unwind v2 (epilog) information should be generated for x64
487+
/// Windows.
488+
ENUM_CODEGENOPT(WinX64EHUnwindV2, llvm::WinX64EHUnwindV2Mode,
489+
2, llvm::WinX64EHUnwindV2Mode::Disabled)
488490

489491
/// FIXME: Make DebugOptions its own top-level .def file.
490492
#include "DebugOptions.def"

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -815,19 +815,22 @@ changes to one object won't affect the others, the object's initializer will run
815815
once per copy, etc.
816816

817817
Specifically, this warning fires when it detects an object which:
818-
1. Is defined as ``inline`` in a header file (so it might get compiled into multiple libaries), and
819-
2. Has external linkage (otherwise it's supposed to be duplicated), and
820-
3. Has hidden visibility (posix) or lacks a dllimport/dllexport attribute (windows).
818+
819+
#. Is defined as ``inline`` in a header file (so it might get compiled into multiple libaries), and
820+
#. Has external linkage (otherwise it's supposed to be duplicated), and
821+
#. Has hidden visibility (posix) or lacks a dllimport/dllexport attribute (windows).
821822

822823
As well as one of the following:
823-
1. The object is mutable, or
824-
2. The object's initializer definitely has side effects.
824+
825+
#. The object is mutable, or
826+
#. The object's initializer definitely has side effects.
825827

826828
The warning can be resolved by removing one of the conditions above. In rough
827829
order of preference, this may be done by:
828-
1. Marking the object ``const`` (if possible)
829-
2. Moving the object's definition to a source file
830-
3. Making the object visible using ``__attribute((visibility("default")))``,
830+
831+
#. Marking the object ``const`` (if possible)
832+
#. Moving the object's definition to a source file
833+
#. Making the object visible using ``__attribute((visibility("default")))``,
831834
``__declspec(dllimport)``, or ``__declspec(dllexport)``.
832835

833836
When annotating an object with ``__declspec(dllimport)`` or ``__declspec(dllexport)``,

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,6 +2155,8 @@ def VecCmpOp : CIR_Op<"vec.cmp", [Pure, SameTypeOperands]> {
21552155
`(` $kind `,` $lhs `,` $rhs `)` `:` qualified(type($lhs)) `,`
21562156
qualified(type($result)) attr-dict
21572157
}];
2158+
2159+
let hasFolder = 1;
21582160
}
21592161

21602162
//===----------------------------------------------------------------------===//

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ struct MissingFeatures {
236236
static bool runCleanupsScope() { return false; }
237237
static bool lowerAggregateLoadStore() { return false; }
238238
static bool dataLayoutTypeAllocSize() { return false; }
239+
static bool asmLabelAttr() { return false; }
239240

240241
// Missing types
241242
static bool dataMemberType() { return false; }

clang/include/clang/Driver/Options.td

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,11 +2167,14 @@ defm assume_nothrow_exception_dtor: BoolFOption<"assume-nothrow-exception-dtor",
21672167
LangOpts<"AssumeNothrowExceptionDtor">, DefaultFalse,
21682168
PosFlag<SetTrue, [], [ClangOption, CC1Option], "Assume that exception objects' destructors are non-throwing">,
21692169
NegFlag<SetFalse>>;
2170-
defm winx64_eh_unwindv2 : BoolFOption<"winx64-eh-unwindv2",
2171-
CodeGenOpts<"WinX64EHUnwindV2">, DefaultFalse,
2172-
PosFlag<SetTrue, [], [ClangOption, CC1Option], "Enable">,
2173-
NegFlag<SetFalse, [], [ClangOption], "Disable">,
2174-
BothFlags<[], [ClangOption], " unwind v2 (epilog) information for x64 Windows">>;
2170+
def winx64_eh_unwindv2
2171+
: Joined<["-"], "fwinx64-eh-unwindv2=">, Group<f_Group>,
2172+
Visibility<[ClangOption, CC1Option]>,
2173+
HelpText<"Generate unwind v2 (epilog) information for x64 Windows">,
2174+
Values<"disabled,best-effort,required">,
2175+
NormalizedValues<["Disabled", "BestEffort", "Required"]>,
2176+
NormalizedValuesScope<"llvm::WinX64EHUnwindV2Mode">,
2177+
MarshallingInfoEnum<CodeGenOpts<"WinX64EHUnwindV2">, "Disabled">;
21752178
def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">, Group<f_Group>,
21762179
Visibility<[ClangOption, CLOption]>,
21772180
HelpText<"Allows control over excess precision on targets where native "
@@ -5147,10 +5150,16 @@ def mno_fix_cortex_a72_aes_1655431 : Flag<["-"], "mno-fix-cortex-a72-aes-1655431
51475150
Alias<mno_fix_cortex_a57_aes_1742098>;
51485151
def mfix_cortex_a53_835769 : Flag<["-"], "mfix-cortex-a53-835769">,
51495152
Group<m_aarch64_Features_Group>,
5150-
HelpText<"Workaround Cortex-A53 erratum 835769 (AArch64 only)">;
5153+
HelpText<"Work around Cortex-A53 erratum 835769 (AArch64 only)">;
51515154
def mno_fix_cortex_a53_835769 : Flag<["-"], "mno-fix-cortex-a53-835769">,
51525155
Group<m_aarch64_Features_Group>,
5153-
HelpText<"Don't workaround Cortex-A53 erratum 835769 (AArch64 only)">;
5156+
HelpText<"Don't work around Cortex-A53 erratum 835769 (AArch64 only)">;
5157+
def mfix_cortex_a53_843419 : Flag<["-"], "mfix-cortex-a53-843419">,
5158+
Group<m_aarch64_Features_Group>,
5159+
HelpText<"Work around Cortex-A53 erratum 843419 (AArch64 only)">;
5160+
def mno_fix_cortex_a53_843419 : Flag<["-"], "mno-fix-cortex-a53-843419">,
5161+
Group<m_aarch64_Features_Group>,
5162+
HelpText<"Don't work around Cortex-A53 erratum 843419 (AArch64 only)">;
51545163
def mmark_bti_property : Flag<["-"], "mmark-bti-property">,
51555164
Group<m_aarch64_Features_Group>,
51565165
HelpText<"Add .note.gnu.property with BTI to assembly files (AArch64 only)">;
@@ -8972,7 +8981,9 @@ def _SLASH_volatile_Group : OptionGroup<"</volatile group>">,
89728981
Group<cl_compile_Group>;
89738982

89748983
def _SLASH_d2epilogunwind : CLFlag<"d2epilogunwind">,
8975-
HelpText<"Enable unwind v2 (epilog) information for x64 Windows">;
8984+
HelpText<"Best effort generate unwind v2 (epilog) information for x64 Windows">;
8985+
def _SLASH_d2epilogunwindrequirev2 : CLFlag<"d2epilogunwindrequirev2">,
8986+
HelpText<"Require generation of unwind v2 (epilog) information for x64 Windows">;
89768987
def _SLASH_EH : CLJoined<"EH">, HelpText<"Set exception handling model">;
89778988
def _SLASH_EP : CLFlag<"EP">,
89788989
HelpText<"Disable linemarker output and preprocess to stdout">;

0 commit comments

Comments
 (0)