Skip to content

Commit 86879ac

Browse files
authored
merge main into amd-staging (llvm#1527)
2 parents f1e0d3a + 360aa42 commit 86879ac

File tree

181 files changed

+4020
-5706
lines changed

Some content is hidden

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

181 files changed

+4020
-5706
lines changed

.github/new-prs-labeler.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,12 @@ backend:DirectX:
660660
- '**/*dxil*/**'
661661
- '**/*DXContainer*'
662662
- '**/*DXContainer*/**'
663+
- clang/lib/Sema/SemaDirectX.cpp
664+
- clang/include/clang/Sema/SemaDirectX.h
665+
- clang/include/clang/Basic/BuiltinsDirectX.td
666+
- clang/lib/CodeGen/TargetBuiltins/DirectX.cpp
667+
- clang/test/CodeGenDirectX/**
668+
- clang/test/SemaDirectX/**
663669

664670
backend:SPIR-V:
665671
- clang/lib/Driver/ToolChains/SPIRV.*

clang/cmake/caches/HLSL.cmake

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# Including the native target is important because some of LLVM's tests fail if
22
# you don't.
3-
set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
3+
set(LLVM_TARGETS_TO_BUILD "Native;SPIRV" CACHE STRING "")
44

5-
# Include the DirectX target for DXIL code generation, eventually we'll include
6-
# SPIR-V here too.
7-
set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "DirectX;SPIRV" CACHE STRING "")
5+
# Include the DirectX target for DXIL code generation.
6+
set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "DirectX" CACHE STRING "")
87

9-
# HLSL support is currently limted to clang, eventually it will expand to
10-
# clang-tools-extra too.
118
set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra" CACHE STRING "")
129

1310
set(CLANG_ENABLE_HLSL On CACHE BOOL "")

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,9 @@ Improvements to Clang's diagnostics
335335
- ``-Wc++98-compat`` no longer diagnoses use of ``__auto_type`` or
336336
``decltype(auto)`` as though it was the extension for ``auto``. (#GH47900)
337337

338+
- Now correctly diagnose a tentative definition of an array with static
339+
storage duration in pedantic mode in C. (#GH50661)
340+
338341
Improvements to Clang's time-trace
339342
----------------------------------
340343

@@ -409,6 +412,7 @@ Bug Fixes to C++ Support
409412
- Improved fix for an issue with pack expansions of type constraints, where this
410413
now also works if the constraint has non-type or template template parameters.
411414
(#GH131798)
415+
- Fixes to partial ordering of non-type template parameter packs. (#GH132562)
412416
- Fix crash when evaluating the trailing requires clause of generic lambdas which are part of
413417
a pack expansion.
414418
- Fixes matching of nested template template parameters. (#GH130362)

clang/include/clang/AST/Expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6757,7 +6757,7 @@ class PseudoObjectExpr final
67576757
/// and corresponding __opencl_atomic_* for OpenCL 2.0.
67586758
/// All of these instructions take one primary pointer, at least one memory
67596759
/// order. The instructions for which getScopeModel returns non-null value
6760-
/// take one synch scope.
6760+
/// take one sync scope.
67616761
class AtomicExpr : public Expr {
67626762
public:
67636763
enum AtomicOp {

clang/include/clang/AST/ExprCXX.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4209,10 +4209,10 @@ class PackExpansionExpr : public Expr {
42094209
Stmt *Pattern;
42104210

42114211
public:
4212-
PackExpansionExpr(QualType T, Expr *Pattern, SourceLocation EllipsisLoc,
4212+
PackExpansionExpr(Expr *Pattern, SourceLocation EllipsisLoc,
42134213
UnsignedOrNone NumExpansions)
4214-
: Expr(PackExpansionExprClass, T, Pattern->getValueKind(),
4215-
Pattern->getObjectKind()),
4214+
: Expr(PackExpansionExprClass, Pattern->getType(),
4215+
Pattern->getValueKind(), Pattern->getObjectKind()),
42164216
EllipsisLoc(EllipsisLoc),
42174217
NumExpansions(NumExpansions ? *NumExpansions + 1 : 0),
42184218
Pattern(Pattern) {

clang/include/clang/Basic/Builtins.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4891,12 +4891,6 @@ def HLSLDotProduct : LangBuiltin<"HLSL_LANG"> {
48914891
let Prototype = "void(...)";
48924892
}
48934893

4894-
def HLSLDot2Add : LangBuiltin<"HLSL_LANG"> {
4895-
let Spellings = ["__builtin_hlsl_dot2add"];
4896-
let Attributes = [NoThrow, Const];
4897-
let Prototype = "float(_ExtVector<2, _Float16>, _ExtVector<2, _Float16>, float)";
4898-
}
4899-
49004894
def HLSLDot4AddI8Packed : LangBuiltin<"HLSL_LANG"> {
49014895
let Spellings = ["__builtin_hlsl_dot4add_i8packed"];
49024896
let Attributes = [NoThrow, Const];
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//===--- BuiltinsDirectX.td - DirectX Builtin function database -----------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
include "clang/Basic/BuiltinsBase.td"
10+
11+
def DxDot2Add : Builtin {
12+
let Spellings = ["__builtin_dx_dot2add"];
13+
let Attributes = [NoThrow, Const];
14+
let Prototype = "float(_ExtVector<2, _Float16>, _ExtVector<2, _Float16>, float)";
15+
}

clang/include/clang/Basic/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ clang_tablegen(BuiltinsBPF.inc -gen-clang-builtins
8282
SOURCE BuiltinsBPF.td
8383
TARGET ClangBuiltinsBPF)
8484

85+
clang_tablegen(BuiltinsDirectX.inc -gen-clang-builtins
86+
SOURCE BuiltinsDirectX.td
87+
TARGET ClangBuiltinsDirectX)
88+
8589
clang_tablegen(BuiltinsHexagon.inc -gen-clang-builtins
8690
SOURCE BuiltinsHexagon.td
8791
TARGET ClangBuiltinsHexagon)

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7350,8 +7350,9 @@ def err_typecheck_pointer_arith_void_type : Error<
73507350
"arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
73517351
def err_typecheck_decl_incomplete_type : Error<
73527352
"variable has incomplete type %0">;
7353-
def ext_typecheck_decl_incomplete_type : ExtWarn<
7354-
"tentative definition of variable with internal linkage has incomplete non-array type %0">,
7353+
def ext_typecheck_decl_incomplete_type : Extension<
7354+
"tentative definition of variable with internal linkage has incomplete "
7355+
"%select{non-array|array}0 type %1">,
73557356
InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
73567357
def err_tentative_def_incomplete_type : Error<
73577358
"tentative definition has type %0 that is never completed">;
@@ -9075,7 +9076,7 @@ def err_atomic_op_needs_atomic_int : Error<
90759076
def warn_atomic_op_has_invalid_memory_order : Warning<
90769077
"%select{|success |failure }0memory order argument to atomic operation is invalid">,
90779078
InGroup<DiagGroup<"atomic-memory-ordering">>;
9078-
def err_atomic_op_has_invalid_synch_scope : Error<
9079+
def err_atomic_op_has_invalid_sync_scope : Error<
90799080
"synchronization scope argument to atomic operation is invalid">;
90809081
def warn_atomic_implicit_seq_cst : Warning<
90819082
"implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,

clang/include/clang/Basic/SyncScope.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121

2222
namespace clang {
2323

24-
/// Defines synch scope values used internally by clang.
24+
/// Defines sync scope values used internally by clang.
2525
///
2626
/// The enum values start from 0 and are contiguous. They are mainly used for
27-
/// enumerating all supported synch scope values and mapping them to LLVM
28-
/// synch scopes. Their numerical values may be different from the corresponding
29-
/// synch scope enums used in source languages.
27+
/// enumerating all supported sync scope values and mapping them to LLVM
28+
/// sync scopes. Their numerical values may be different from the corresponding
29+
/// sync scope enums used in source languages.
3030
///
31-
/// In atomic builtin and expressions, language-specific synch scope enums are
31+
/// In atomic builtin and expressions, language-specific sync scope enums are
3232
/// used. Currently only OpenCL memory scope enums are supported and assumed
3333
/// to be used by all languages. However, in the future, other languages may
34-
/// define their own set of synch scope enums. The language-specific synch scope
34+
/// define their own set of sync scope enums. The language-specific sync scope
3535
/// values are represented by class AtomicScopeModel and its derived classes.
3636
///
3737
/// To add a new enum value:
@@ -88,39 +88,39 @@ inline llvm::StringRef getAsString(SyncScope S) {
8888
case SyncScope::OpenCLSubGroup:
8989
return "opencl_subgroup";
9090
}
91-
llvm_unreachable("Invalid synch scope");
91+
llvm_unreachable("Invalid sync scope");
9292
}
9393

9494
/// Defines the kind of atomic scope models.
9595
enum class AtomicScopeModelKind { None, OpenCL, HIP, Generic };
9696

97-
/// Defines the interface for synch scope model.
97+
/// Defines the interface for sync scope model.
9898
class AtomicScopeModel {
9999
public:
100100
virtual ~AtomicScopeModel() {}
101-
/// Maps language specific synch scope values to internal
101+
/// Maps language specific sync scope values to internal
102102
/// SyncScope enum.
103103
virtual SyncScope map(unsigned S) const = 0;
104104

105-
/// Check if the compile-time constant synch scope value
105+
/// Check if the compile-time constant sync scope value
106106
/// is valid.
107107
virtual bool isValid(unsigned S) const = 0;
108108

109-
/// Get all possible synch scope values that might be
109+
/// Get all possible sync scope values that might be
110110
/// encountered at runtime for the current language.
111111
virtual ArrayRef<unsigned> getRuntimeValues() const = 0;
112112

113113
/// If atomic builtin function is called with invalid
114-
/// synch scope value at runtime, it will fall back to a valid
115-
/// synch scope value returned by this function.
114+
/// sync scope value at runtime, it will fall back to a valid
115+
/// sync scope value returned by this function.
116116
virtual unsigned getFallBackValue() const = 0;
117117

118118
/// Create an atomic scope model by AtomicScopeModelKind.
119119
/// \return an empty std::unique_ptr for AtomicScopeModelKind::None.
120120
static std::unique_ptr<AtomicScopeModel> create(AtomicScopeModelKind K);
121121
};
122122

123-
/// Defines the synch scope model for OpenCL.
123+
/// Defines the sync scope model for OpenCL.
124124
class AtomicScopeOpenCLModel : public AtomicScopeModel {
125125
public:
126126
/// The enum values match the pre-defined macros
@@ -147,7 +147,7 @@ class AtomicScopeOpenCLModel : public AtomicScopeModel {
147147
case SubGroup:
148148
return SyncScope::OpenCLSubGroup;
149149
}
150-
llvm_unreachable("Invalid language synch scope value");
150+
llvm_unreachable("Invalid language sync scope value");
151151
}
152152

153153
bool isValid(unsigned S) const override {
@@ -156,7 +156,7 @@ class AtomicScopeOpenCLModel : public AtomicScopeModel {
156156
}
157157

158158
ArrayRef<unsigned> getRuntimeValues() const override {
159-
static_assert(Last == SubGroup, "Does not include all synch scopes");
159+
static_assert(Last == SubGroup, "Does not include all sync scopes");
160160
static const unsigned Scopes[] = {
161161
static_cast<unsigned>(WorkGroup), static_cast<unsigned>(Device),
162162
static_cast<unsigned>(AllSVMDevices), static_cast<unsigned>(SubGroup)};
@@ -168,7 +168,7 @@ class AtomicScopeOpenCLModel : public AtomicScopeModel {
168168
}
169169
};
170170

171-
/// Defines the synch scope model for HIP.
171+
/// Defines the sync scope model for HIP.
172172
class AtomicScopeHIPModel : public AtomicScopeModel {
173173
public:
174174
/// The enum values match the pre-defined macros
@@ -198,7 +198,7 @@ class AtomicScopeHIPModel : public AtomicScopeModel {
198198
case System:
199199
return SyncScope::HIPSystem;
200200
}
201-
llvm_unreachable("Invalid language synch scope value");
201+
llvm_unreachable("Invalid language sync scope value");
202202
}
203203

204204
bool isValid(unsigned S) const override {
@@ -207,7 +207,7 @@ class AtomicScopeHIPModel : public AtomicScopeModel {
207207
}
208208

209209
ArrayRef<unsigned> getRuntimeValues() const override {
210-
static_assert(Last == System, "Does not include all synch scopes");
210+
static_assert(Last == System, "Does not include all sync scopes");
211211
static const unsigned Scopes[] = {
212212
static_cast<unsigned>(SingleThread), static_cast<unsigned>(Wavefront),
213213
static_cast<unsigned>(Workgroup), static_cast<unsigned>(Agent),

0 commit comments

Comments
 (0)