Skip to content

Commit ea95862

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-add-exit-phi-ops
2 parents d0081f7 + 2dca9e8 commit ea95862

File tree

478 files changed

+25122
-5538
lines changed

Some content is hidden

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

478 files changed

+25122
-5538
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
/mlir/**/Transforms/SROA.* @moxinilian
129129

130130
# BOLT
131-
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @dcci @yota9
131+
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @yota9
132132

133133
# Bazel build system.
134134
/utils/bazel/ @rupprecht @keith @aaronmondal

bolt/test/link_fdata.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import argparse
1111
import os
12+
import shutil
1213
import subprocess
1314
import sys
1415
import re
@@ -85,7 +86,7 @@
8586
exit("ERROR: unexpected input:\n%s" % line)
8687

8788
# Read nm output: <symbol value> <symbol type> <symbol name>
88-
is_llvm_nm = os.path.basename(args.nmtool) == "llvm-nm"
89+
is_llvm_nm = os.path.basename(os.path.realpath(shutil.which(args.nmtool))) == "llvm-nm"
8990
nm_output = subprocess.run(
9091
[
9192
args.nmtool,

clang-tools-extra/clangd/unittests/InlayHintTests.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -1577,19 +1577,21 @@ TEST(TypeHints, Aliased) {
15771577
}
15781578

15791579
TEST(TypeHints, CallingConvention) {
1580-
// Check that we don't crash for lambdas without a FunctionTypeLoc
1580+
// Check that we don't crash for lambdas with an annotation
15811581
// https://github.com/clangd/clangd/issues/2223
1582-
std::string Code = R"cpp(
1582+
Annotations Source(R"cpp(
15831583
void test() {
1584-
[]() __cdecl {};
1584+
[]($lambda[[)]]__cdecl {};
15851585
}
1586-
)cpp";
1587-
TestTU TU = TestTU::withCode(Code);
1586+
)cpp");
1587+
TestTU TU = TestTU::withCode(Source.code());
15881588
TU.ExtraArgs.push_back("--target=x86_64-w64-mingw32");
15891589
TU.PredefineMacros = true; // for the __cdecl
15901590
auto AST = TU.build();
15911591

1592-
EXPECT_THAT(hintsOfKind(AST, InlayHintKind::Type), IsEmpty());
1592+
EXPECT_THAT(
1593+
hintsOfKind(AST, InlayHintKind::Type),
1594+
ElementsAre(HintMatcher(ExpectedHint{"-> void", "lambda"}, Source)));
15931595
}
15941596

15951597
TEST(TypeHints, Decltype) {

clang-tools-extra/clangd/unittests/XRefsTests.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -2303,7 +2303,15 @@ TEST(FindReferences, WithinAST) {
23032303
bool $decl[[operator]]"" _u^dl(unsigned long long value);
23042304
bool x = $(x)[[1_udl]];
23052305
)cpp",
2306-
};
2306+
R"cpp(
2307+
struct S {
2308+
public:
2309+
static void $decl(S)[[operator]] delete(void *);
2310+
static void deleteObject(S *S) {
2311+
$(S::deleteObject)[[de^lete]] S;
2312+
}
2313+
};
2314+
)cpp"};
23072315
for (const char *Test : Tests)
23082316
checkFindRefs(Test);
23092317
}

clang/cmake/caches/Fuchsia-stage2.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ set(LLVM_ENABLE_LIBEDIT OFF CACHE BOOL "")
1818
set(LLVM_ENABLE_LLD ON CACHE BOOL "")
1919
set(LLVM_ENABLE_LTO ON CACHE BOOL "")
2020
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "")
21-
set(LLVM_ENABLE_PIC OFF CACHE BOOL "")
2221
set(LLVM_ENABLE_PLUGINS OFF CACHE BOOL "")
2322
set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "")
2423
set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "")

clang/docs/ReleaseNotes.rst

+6
Original file line numberDiff line numberDiff line change
@@ -398,13 +398,19 @@ Improvements to Clang's diagnostics
398398
constructors to initialize their non-modifiable members. The diagnostic is
399399
not new; being controlled via a warning group is what's new. Fixes #GH41104
400400

401+
402+
- Improved Clang's error recovery for invalid function calls.
403+
401404
- Improved bit-field diagnostics to consider the type specified by the
402405
``preferred_type`` attribute. These diagnostics are controlled by the flags
403406
``-Wpreferred-type-bitfield-enum-conversion`` and
404407
``-Wpreferred-type-bitfield-width``. These warnings are on by default as they
405408
they're only triggered if the authors are already making the choice to use
406409
``preferred_type`` attribute.
407410

411+
- ``-Winitializer-overrides`` and ``-Wreorder-init-list`` are now grouped under
412+
the ``-Wc99-designator`` diagnostic group, as they also are about the
413+
behavior of the C99 feature as it was introduced into C++20. Fixes #GH47037
408414

409415
Improvements to Clang's time-trace
410416
----------------------------------

clang/include/clang/Basic/AddressSpaces.h

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ enum class LangAS : unsigned {
6060
hlsl_groupshared,
6161
hlsl_constant,
6262
hlsl_private,
63+
hlsl_device,
6364

6465
// Wasm specific address spaces.
6566
wasm_funcref,

clang/include/clang/Basic/BuiltinHeaders.def

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
HEADER(NO_HEADER, nullptr)
15+
HEADER(ARMACLE_H, "arm_acle.h")
1516
HEADER(BLOCKS_H, "Blocks.h")
1617
HEADER(COMPLEX_H, "complex.h")
1718
HEADER(CTYPE_H, "ctype.h")

clang/include/clang/Basic/BuiltinsAArch64.def

+8-10
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ BUILTIN(__builtin_arm_wfi, "v", "")
5050
BUILTIN(__builtin_arm_sev, "v", "")
5151
BUILTIN(__builtin_arm_sevl, "v", "")
5252
BUILTIN(__builtin_arm_chkfeat, "WUiWUi", "")
53+
TARGET_HEADER_BUILTIN(__yield, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
54+
TARGET_HEADER_BUILTIN(__wfe, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
55+
TARGET_HEADER_BUILTIN(__wfi, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
56+
TARGET_HEADER_BUILTIN(__sev, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
57+
TARGET_HEADER_BUILTIN(__sevl, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
5358

5459
// Like __builtin_trap but provide an 16-bit immediate reason code (which goes into `brk #N`).
5560
BUILTIN(__builtin_arm_trap, "vUIs", "nr")
@@ -82,6 +87,9 @@ TARGET_BUILTIN(__builtin_arm_mops_memset_tag, "v*v*iz", "", "mte,mops")
8287
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
8388
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
8489
BUILTIN(__builtin_arm_isb, "vUi", "nc")
90+
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
91+
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
92+
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
8593

8694
TARGET_BUILTIN(__builtin_arm_jcvt, "Zid", "nc", "v8.3a")
8795

@@ -98,16 +106,6 @@ BUILTIN(__builtin_arm_wsr64, "vcC*WUi", "nc")
98106
TARGET_BUILTIN(__builtin_arm_wsr128, "vcC*LLLUi", "nc", "d128")
99107
BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc")
100108

101-
// MSVC
102-
LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
103-
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
104-
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
105-
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
106-
LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES)
107-
LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES)
108-
LANGBUILTIN(__sev, "v", "", ALL_MS_LANGUAGES)
109-
LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES)
110-
111109
// Misc
112110
BUILTIN(__builtin_sponentry, "v*", "c")
113111

clang/include/clang/Basic/BuiltinsARM.def

+8-9
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,19 @@ BUILTIN(__builtin_arm_wfi, "v", "")
186186
BUILTIN(__builtin_arm_sev, "v", "")
187187
BUILTIN(__builtin_arm_sevl, "v", "")
188188
BUILTIN(__builtin_arm_dbg, "vUi", "")
189+
TARGET_HEADER_BUILTIN(__yield, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
190+
TARGET_HEADER_BUILTIN(__wfe, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
191+
TARGET_HEADER_BUILTIN(__wfi, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
192+
TARGET_HEADER_BUILTIN(__sev, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
193+
TARGET_HEADER_BUILTIN(__sevl, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
189194

190195
// Data barrier
191196
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
192197
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
193198
BUILTIN(__builtin_arm_isb, "vUi", "nc")
199+
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
200+
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
201+
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
194202

195203
// Prefetch
196204
BUILTIN(__builtin_arm_prefetch, "vvC*UiUi", "nc")
@@ -209,15 +217,6 @@ BUILTIN(__builtin_sponentry, "v*", "c")
209217
// MSVC
210218
LANGBUILTIN(__emit, "vIUiC", "", ALL_MS_LANGUAGES)
211219

212-
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
213-
LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES)
214-
LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES)
215-
LANGBUILTIN(__sev, "v", "", ALL_MS_LANGUAGES)
216-
LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES)
217-
218-
LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
219-
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
220-
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
221220
LANGBUILTIN(__ldrexd, "WiWiCD*", "", ALL_MS_LANGUAGES)
222221
LANGBUILTIN(_MoveFromCoprocessor, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
223222
LANGBUILTIN(_MoveFromCoprocessor2, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)

clang/include/clang/Basic/DiagnosticGroups.td

+10-7
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ def AbstractFinalClass : DiagGroup<"abstract-final-class">;
184184
def FinalDtorNonFinalClass : DiagGroup<"final-dtor-non-final-class">;
185185
def GNUOffsetofExtensions : DiagGroup<"gnu-offsetof-extensions">;
186186

187+
def InitializerOverrides : DiagGroup<"initializer-overrides">;
188+
// For compatibility with GCC; -Woverride-init = -Winitializer-overrides
189+
def : DiagGroup<"override-init", [InitializerOverrides]>;
190+
def ReorderCtor : DiagGroup<"reorder-ctor">;
191+
def ReorderInitList : DiagGroup<"reorder-init-list">;
192+
def Reorder : DiagGroup<"reorder", [ReorderCtor, ReorderInitList]>;
193+
187194
def CXX11CompatDeprecatedWritableStr :
188195
DiagGroup<"c++11-compat-deprecated-writable-strings">;
189196

@@ -250,7 +257,9 @@ def Deprecated : DiagGroup<"deprecated", [DeprecatedAnonEnumEnumConversion,
250257
def CXX20Designator : DiagGroup<"c++20-designator">;
251258
// Allow -Wno-c99-designator to be used to turn off all warnings on valid C99
252259
// designators (including the warning controlled by -Wc++20-designator).
253-
def C99Designator : DiagGroup<"c99-designator", [CXX20Designator]>;
260+
def C99Designator : DiagGroup<"c99-designator", [CXX20Designator,
261+
InitializerOverrides,
262+
ReorderInitList]>;
254263
def GNUDesignator : DiagGroup<"gnu-designator">;
255264
def DtorName : DiagGroup<"dtor-name">;
256265

@@ -595,9 +604,6 @@ def NullabilityCompleteness : DiagGroup<"nullability-completeness",
595604
def NullArithmetic : DiagGroup<"null-arithmetic">;
596605
def NullCharacter : DiagGroup<"null-character">;
597606
def NullDereference : DiagGroup<"null-dereference">;
598-
def InitializerOverrides : DiagGroup<"initializer-overrides">;
599-
// For compatibility with GCC; -Woverride-init = -Winitializer-overrides
600-
def : DiagGroup<"override-init", [InitializerOverrides]>;
601607
def NonNull : DiagGroup<"nonnull">;
602608
def NonPODVarargs : DiagGroup<"non-pod-varargs">;
603609
def ClassVarargs : DiagGroup<"class-varargs", [NonPODVarargs]>;
@@ -919,9 +925,6 @@ def UsedButMarkedUnused : DiagGroup<"used-but-marked-unused">;
919925
def UsedSearchPath : DiagGroup<"search-path-usage">;
920926
def UserDefinedLiterals : DiagGroup<"user-defined-literals">;
921927
def UserDefinedWarnings : DiagGroup<"user-defined-warnings">;
922-
def ReorderCtor : DiagGroup<"reorder-ctor">;
923-
def ReorderInitList : DiagGroup<"reorder-init-list">;
924-
def Reorder : DiagGroup<"reorder", [ReorderCtor, ReorderInitList]>;
925928
def UndeclaredSelector : DiagGroup<"undeclared-selector">;
926929
def ImplicitAtomic : DiagGroup<"implicit-atomic-properties">;
927930
def AtomicAlignment : DiagGroup<"atomic-alignment">;

clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h

+42-8
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
6161

6262
mlir::Value getConstAPInt(mlir::Location loc, mlir::Type typ,
6363
const llvm::APInt &val) {
64-
return create<cir::ConstantOp>(loc, typ, getAttr<cir::IntAttr>(typ, val));
64+
return create<cir::ConstantOp>(loc, getAttr<cir::IntAttr>(typ, val));
6565
}
6666

6767
cir::ConstantOp getConstant(mlir::Location loc, mlir::TypedAttr attr) {
68-
return create<cir::ConstantOp>(loc, attr.getType(), attr);
68+
return create<cir::ConstantOp>(loc, attr);
6969
}
7070

7171
cir::ConstantOp getConstantInt(mlir::Location loc, mlir::Type ty,
@@ -83,21 +83,17 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
8383
return getConstPtrAttr(t, 0);
8484
}
8585

86-
mlir::TypedAttr getZeroAttr(mlir::Type t) {
87-
return cir::ZeroAttr::get(getContext(), t);
88-
}
89-
9086
mlir::TypedAttr getZeroInitAttr(mlir::Type ty) {
9187
if (mlir::isa<cir::IntType>(ty))
9288
return cir::IntAttr::get(ty, 0);
9389
if (cir::isAnyFloatingPointType(ty))
9490
return cir::FPAttr::getZero(ty);
9591
if (auto arrTy = mlir::dyn_cast<cir::ArrayType>(ty))
96-
return getZeroAttr(arrTy);
92+
return cir::ZeroAttr::get(arrTy);
9793
if (auto ptrTy = mlir::dyn_cast<cir::PointerType>(ty))
9894
return getConstNullPtrAttr(ptrTy);
9995
if (auto recordTy = mlir::dyn_cast<cir::RecordType>(ty))
100-
return getZeroAttr(recordTy);
96+
return cir::ZeroAttr::get(recordTy);
10197
if (mlir::isa<cir::BoolType>(ty)) {
10298
return getFalseAttr();
10399
}
@@ -361,6 +357,44 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
361357
return create<cir::CmpOp>(loc, getBoolTy(), kind, lhs, rhs);
362358
}
363359

360+
mlir::Value createShift(mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
361+
bool isShiftLeft) {
362+
return create<cir::ShiftOp>(loc, lhs.getType(), lhs, rhs, isShiftLeft);
363+
}
364+
365+
mlir::Value createShift(mlir::Location loc, mlir::Value lhs,
366+
const llvm::APInt &rhs, bool isShiftLeft) {
367+
return createShift(loc, lhs, getConstAPInt(loc, lhs.getType(), rhs),
368+
isShiftLeft);
369+
}
370+
371+
mlir::Value createShift(mlir::Location loc, mlir::Value lhs, unsigned bits,
372+
bool isShiftLeft) {
373+
auto width = mlir::dyn_cast<cir::IntType>(lhs.getType()).getWidth();
374+
auto shift = llvm::APInt(width, bits);
375+
return createShift(loc, lhs, shift, isShiftLeft);
376+
}
377+
378+
mlir::Value createShiftLeft(mlir::Location loc, mlir::Value lhs,
379+
unsigned bits) {
380+
return createShift(loc, lhs, bits, true);
381+
}
382+
383+
mlir::Value createShiftRight(mlir::Location loc, mlir::Value lhs,
384+
unsigned bits) {
385+
return createShift(loc, lhs, bits, false);
386+
}
387+
388+
mlir::Value createShiftLeft(mlir::Location loc, mlir::Value lhs,
389+
mlir::Value rhs) {
390+
return createShift(loc, lhs, rhs, true);
391+
}
392+
393+
mlir::Value createShiftRight(mlir::Location loc, mlir::Value lhs,
394+
mlir::Value rhs) {
395+
return createShift(loc, lhs, rhs, false);
396+
}
397+
364398
//
365399
// Block handling helpers
366400
// ----------------------

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

+15-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ def ZeroAttr : CIR_Attr<"Zero", "zero", [TypedAttrInterface]> {
7171
}];
7272

7373
let parameters = (ins AttributeSelfTypeParameter<"">:$type);
74+
75+
let builders = [
76+
AttrBuilderWithInferredContext<(ins "mlir::Type":$type), [{
77+
return $_get(type.getContext(), type);
78+
}]>
79+
];
80+
7481
let assemblyFormat = [{}];
7582
}
7683

@@ -86,6 +93,13 @@ def UndefAttr : CIR_Attr<"Undef", "undef", [TypedAttrInterface]> {
8693
}];
8794

8895
let parameters = (ins AttributeSelfTypeParameter<"">:$type);
96+
97+
let builders = [
98+
AttrBuilderWithInferredContext<(ins "mlir::Type":$type), [{
99+
return $_get(type.getContext(), type);
100+
}]>
101+
];
102+
89103
let assemblyFormat = [{}];
90104
}
91105

@@ -100,7 +114,7 @@ def IntAttr : CIR_Attr<"Int", "int", [TypedAttrInterface]> {
100114
value of the specified integer type.
101115
}];
102116
let parameters = (ins AttributeSelfTypeParameter<"">:$type,
103-
"llvm::APInt":$value);
117+
APIntParameter<"">:$value);
104118
let builders = [
105119
AttrBuilderWithInferredContext<(ins "mlir::Type":$type,
106120
"const llvm::APInt &":$value), [{

0 commit comments

Comments
 (0)