Skip to content

Commit d2f98f8

Browse files
committed
Merge remote-tracking branch 'origin/main' into add-noalias.addrspace-attribute-for-load-and-store
2 parents ee7cee0 + f626620 commit d2f98f8

File tree

604 files changed

+21660
-15628
lines changed

Some content is hidden

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

604 files changed

+21660
-15628
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/Basic/riscv_vector.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2397,7 +2397,7 @@ let RequiredFeatures = ["zvfbfmin"] in {
23972397
}
23982398
defm vrgatherei16 : RVVOutBuiltinSet<"vrgatherei16_vv", "csilfd",
23992399
[["vv", "v", "vv(Log2EEW:4)Uv"]]>;
2400-
let RequiredFeatures = ["zvfh"] in
2400+
let RequiredFeatures = ["zvfhmin"] in
24012401
defm vrgatherei16 : RVVOutBuiltinSet<"vrgatherei16_vv", "x",
24022402
[["vv", "v", "vv(Log2EEW:4)Uv"]]>;
24032403
// unsigned type

clang/include/clang/Basic/riscv_vector_common.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ let UnMaskedPolicyScheme = HasPolicyOperand,
593593
multiclass RVVSlideUpBuiltinSet {
594594
defm "" : RVVOutBuiltinSet<NAME, "csilfd",
595595
[["vx","v", "vvvz"]]>;
596-
let RequiredFeatures = ["zvfh"] in
596+
let RequiredFeatures = ["zvfhmin"] in
597597
defm "" : RVVOutBuiltinSet<NAME, "x",
598598
[["vx","v", "vvvz"]]>;
599599
defm "" : RVVOutBuiltinSet<NAME, "csil",
@@ -618,7 +618,7 @@ let UnMaskedPolicyScheme = HasPassthruOperand,
618618
multiclass RVVSlideDownBuiltinSet {
619619
defm "" : RVVOutBuiltinSet<NAME, "csilfd",
620620
[["vx","v", "vvz"]]>;
621-
let RequiredFeatures = ["zvfh"] in
621+
let RequiredFeatures = ["zvfhmin"] in
622622
defm "" : RVVOutBuiltinSet<NAME, "x",
623623
[["vx","v", "vvz"]]>;
624624
defm "" : RVVOutBuiltinSet<NAME, "csil",

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
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)