Skip to content

Commit bd14d78

Browse files
committed
merge main into amd-staging
xfails new test: flang/test/Lower/volatile-openmp.f90
2 parents 00325e4 + c3715ec commit bd14d78

File tree

653 files changed

+13236
-3989
lines changed

Some content is hidden

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

653 files changed

+13236
-3989
lines changed

.github/workflows/libc-fullbuild-tests.yml

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,23 @@ jobs:
1919
include:
2020
- os: ubuntu-24.04
2121
ccache-variant: sccache
22-
c_compiler: clang-20
23-
cpp_compiler: clang++-20
22+
c_compiler: clang-21
23+
cpp_compiler: clang++-21
24+
target: x86_64-unknown-linux-llvm
25+
include_scudo: ON
2426
# TODO: remove ccache logic when https://github.com/hendrikmuhs/ccache-action/issues/279 is resolved.
2527
- os: ubuntu-24.04-arm
2628
ccache-variant: ccache
27-
c_compiler: clang-20
28-
cpp_compiler: clang++-20
29+
c_compiler: clang-21
30+
cpp_compiler: clang++-21
31+
target: aarch64-unknown-linux-llvm
32+
include_scudo: ON
33+
- os: ubuntu-24.04
34+
ccache-variant: ccache
35+
c_compiler: clang-21
36+
cpp_compiler: clang++-21
37+
target: x86_64-unknown-uefi-llvm
38+
include_scudo: OFF
2939
# TODO: add back gcc build when it is fixed
3040
# - c_compiler: gcc
3141
# cpp_compiler: g++
@@ -53,7 +63,7 @@ jobs:
5363
run: |
5464
wget https://apt.llvm.org/llvm.sh
5565
chmod +x llvm.sh
56-
sudo ./llvm.sh 20
66+
sudo ./llvm.sh 21
5767
sudo apt-get update
5868
sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-libc-dev
5969
sudo ln -sf /usr/include/$(uname -p)-linux-gnu/asm /usr/include/asm
@@ -68,22 +78,31 @@ jobs:
6878
# Configure libc fullbuild with scudo.
6979
# Use MinSizeRel to reduce the size of the build.
7080
- name: Configure CMake
71-
run: >
72-
cmake -B ${{ steps.strings.outputs.build-output-dir }}
73-
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
74-
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
75-
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
76-
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
77-
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
78-
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }}
79-
-DLLVM_ENABLE_RUNTIMES="libc;compiler-rt"
80-
-DLLVM_LIBC_FULL_BUILD=ON
81-
-DLLVM_LIBC_INCLUDE_SCUDO=ON
82-
-DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON
83-
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF
84-
-DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF
85-
-G Ninja
86-
-S ${{ github.workspace }}/runtimes
81+
run: |
82+
export RUNTIMES="libc"
83+
84+
if [[ ${{ matrix.include_scudo}} == "ON" ]]; then
85+
export RUNTIMES="$RUNTIMES;compiler-rt"
86+
export CMAKE_FLAGS="
87+
-DLLVM_LIBC_INCLUDE_SCUDO=ON
88+
-DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON
89+
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF
90+
-DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF"
91+
fi
92+
93+
cmake -B ${{ steps.strings.outputs.build-output-dir }} \
94+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
95+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
96+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
97+
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }} \
98+
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }} \
99+
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }} \
100+
-DLLVM_RUNTIMES_TARGET=${{ matrix.target }} \
101+
-DLLVM_ENABLE_RUNTIMES="$RUNTIMES" \
102+
-DLLVM_LIBC_FULL_BUILD=ON \
103+
-G Ninja \
104+
-S ${{ github.workspace }}/runtimes \
105+
$CMAKE_FLAGS
87106
88107
- name: Build
89108
run: >
@@ -93,6 +112,8 @@ jobs:
93112
--target install
94113
95114
- name: Test
115+
# Skip UEFI tests until we have testing set up.
116+
if: ${{ ! endsWith(matrix.target, '-uefi-llvm') }}
96117
run: >
97118
cmake
98119
--build ${{ steps.strings.outputs.build-output-dir }}

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ New Compiler Flags
261261
The feature has `existed <https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#running-the-instrumented-program>`_)
262262
for a while and this is just a user facing option.
263263

264+
- New option ``-ftime-report-json`` added which outputs the same timing data as `-ftime-report` but formatted as JSON.
265+
264266
Deprecated Compiler Flags
265267
-------------------------
266268

@@ -527,6 +529,9 @@ Bug Fixes in This Version
527529
evaluation. The crashes were happening during diagnostics emission due to
528530
unimplemented statement printer. (#GH132641)
529531
- Fixed visibility calculation for template functions. (#GH103477)
532+
- Fixed a bug where an attribute before a ``pragma clang attribute`` or
533+
``pragma clang __debug`` would cause an assertion. Instead, this now diagnoses
534+
the invalid attribute location appropriately. (#GH137861)
530535

531536
Bug Fixes to Compiler Builtins
532537
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/Mangle.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ struct ThisAdjustment;
4040
struct ThunkInfo;
4141
class VarDecl;
4242

43+
/// Extract mangling function name from MangleContext such that swift can call
44+
/// it to prepare for ObjCDirect in swift.
45+
void mangleObjCMethodName(raw_ostream &OS, bool includePrefixByte,
46+
bool isInstanceMethod, StringRef ClassName,
47+
std::optional<StringRef> CategoryName,
48+
StringRef MethodName);
49+
4350
/// MangleContext - Context for tracking state which persists across multiple
4451
/// calls to the C++ name mangler.
4552
class MangleContext {

clang/include/clang/Basic/Attr.td

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3856,6 +3856,7 @@ def AssertCapability : InheritableAttr {
38563856
let ParseArgumentsAsUnevaluated = 1;
38573857
let InheritEvenIfAlreadyPresent = 1;
38583858
let Args = [VariadicExprArgument<"Args">];
3859+
let AcceptsExprPack = 1;
38593860
let Accessors = [Accessor<"isShared",
38603861
[Clang<"assert_shared_capability", 0>,
38613862
GNU<"assert_shared_lock">]>];
@@ -3873,6 +3874,7 @@ def AcquireCapability : InheritableAttr {
38733874
let ParseArgumentsAsUnevaluated = 1;
38743875
let InheritEvenIfAlreadyPresent = 1;
38753876
let Args = [VariadicExprArgument<"Args">];
3877+
let AcceptsExprPack = 1;
38763878
let Accessors = [Accessor<"isShared",
38773879
[Clang<"acquire_shared_capability", 0>,
38783880
GNU<"shared_lock_function">]>];
@@ -3890,6 +3892,7 @@ def TryAcquireCapability : InheritableAttr {
38903892
let ParseArgumentsAsUnevaluated = 1;
38913893
let InheritEvenIfAlreadyPresent = 1;
38923894
let Args = [ExprArgument<"SuccessValue">, VariadicExprArgument<"Args">];
3895+
let AcceptsExprPack = 1;
38933896
let Accessors = [Accessor<"isShared",
38943897
[Clang<"try_acquire_shared_capability", 0>,
38953898
GNU<"shared_trylock_function">]>];
@@ -3907,6 +3910,7 @@ def ReleaseCapability : InheritableAttr {
39073910
let ParseArgumentsAsUnevaluated = 1;
39083911
let InheritEvenIfAlreadyPresent = 1;
39093912
let Args = [VariadicExprArgument<"Args">];
3913+
let AcceptsExprPack = 1;
39103914
let Accessors = [Accessor<"isShared",
39113915
[Clang<"release_shared_capability", 0>]>,
39123916
Accessor<"isGeneric",
@@ -3921,6 +3925,7 @@ def RequiresCapability : InheritableAttr {
39213925
Clang<"requires_shared_capability", 0>,
39223926
Clang<"shared_locks_required", 0>];
39233927
let Args = [VariadicExprArgument<"Args">];
3928+
let AcceptsExprPack = 1;
39243929
let LateParsed = LateAttrParseStandard;
39253930
let TemplateDependent = 1;
39263931
let ParseArgumentsAsUnevaluated = 1;
@@ -3963,6 +3968,7 @@ def PtGuardedBy : InheritableAttr {
39633968
def AcquiredAfter : InheritableAttr {
39643969
let Spellings = [GNU<"acquired_after">];
39653970
let Args = [VariadicExprArgument<"Args">];
3971+
let AcceptsExprPack = 1;
39663972
let LateParsed = LateAttrParseExperimentalExt;
39673973
let TemplateDependent = 1;
39683974
let ParseArgumentsAsUnevaluated = 1;
@@ -3974,6 +3980,7 @@ def AcquiredAfter : InheritableAttr {
39743980
def AcquiredBefore : InheritableAttr {
39753981
let Spellings = [GNU<"acquired_before">];
39763982
let Args = [VariadicExprArgument<"Args">];
3983+
let AcceptsExprPack = 1;
39773984
let LateParsed = LateAttrParseExperimentalExt;
39783985
let TemplateDependent = 1;
39793986
let ParseArgumentsAsUnevaluated = 1;
@@ -3995,6 +4002,7 @@ def LockReturned : InheritableAttr {
39954002
def LocksExcluded : InheritableAttr {
39964003
let Spellings = [GNU<"locks_excluded">];
39974004
let Args = [VariadicExprArgument<"Args">];
4005+
let AcceptsExprPack = 1;
39984006
let LateParsed = LateAttrParseStandard;
39994007
let TemplateDependent = 1;
40004008
let ParseArgumentsAsUnevaluated = 1;
@@ -4752,20 +4760,25 @@ def HLSLResourceBinding: InheritableAttr {
47524760

47534761
private:
47544762
RegisterType RegType;
4755-
unsigned SlotNumber;
4763+
std::optional<unsigned> SlotNumber;
47564764
unsigned SpaceNumber;
47574765

47584766
public:
4759-
void setBinding(RegisterType RT, unsigned SlotNum, unsigned SpaceNum) {
4767+
void setBinding(RegisterType RT, std::optional<unsigned> SlotNum, unsigned SpaceNum) {
47604768
RegType = RT;
47614769
SlotNumber = SlotNum;
47624770
SpaceNumber = SpaceNum;
47634771
}
4772+
bool isImplicit() const {
4773+
return !SlotNumber.has_value();
4774+
}
47644775
RegisterType getRegisterType() const {
4776+
assert(!isImplicit() && "binding does not have register slot");
47654777
return RegType;
47664778
}
47674779
unsigned getSlotNumber() const {
4768-
return SlotNumber;
4780+
assert(!isImplicit() && "binding does not have register slot");
4781+
return SlotNumber.value();
47694782
}
47704783
unsigned getSpaceNumber() const {
47714784
return SpaceNumber;

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ CODEGENOPT(SpeculativeLoadHardening, 1, 0) ///< Enable speculative load hardenin
318318
CODEGENOPT(FineGrainedBitfieldAccesses, 1, 0) ///< Enable fine-grained bitfield accesses.
319319
CODEGENOPT(StrictEnums , 1, 0) ///< Optimize based on strict enum definition.
320320
CODEGENOPT(StrictVTablePointers, 1, 0) ///< Optimize based on the strict vtable pointers
321-
CODEGENOPT(TimePasses , 1, 0) ///< Set when -ftime-report or -ftime-report= is enabled.
321+
CODEGENOPT(TimePasses , 1, 0) ///< Set when -ftime-report or -ftime-report= or -ftime-report-json is enabled.
322322
CODEGENOPT(TimePassesPerRun , 1, 0) ///< Set when -ftime-report=per-pass-run is enabled.
323+
CODEGENOPT(TimePassesJson , 1, 0) ///< Set when -ftime-report-json is enabled.
323324
CODEGENOPT(TimeTrace , 1, 0) ///< Set when -ftime-trace is enabled.
324325
VALUE_CODEGENOPT(TimeTraceGranularity, 32, 500) ///< Minimum time granularity (in microseconds),
325326
///< traced by time profiler

clang/include/clang/Basic/TargetOSMacros.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@ TARGET_OS(TARGET_OS_NANO, Triple.isWatchOS())
5353
TARGET_OS(TARGET_IPHONE_SIMULATOR, Triple.isSimulatorEnvironment())
5454
TARGET_OS(TARGET_OS_UIKITFORMAC, Triple.isMacCatalystEnvironment())
5555

56+
// UEFI target.
57+
TARGET_OS(TARGET_OS_UEFI, Triple.isUEFI())
58+
5659
#undef TARGET_OS

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

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,9 @@ def ConditionOp : CIR_Op<"condition", [
610610
//===----------------------------------------------------------------------===//
611611

612612
def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator,
613-
ParentOneOf<["IfOp", "ScopeOp", "SwitchOp",
614-
"WhileOp", "ForOp", "CaseOp",
615-
"DoWhileOp"]>]> {
613+
ParentOneOf<["CaseOp", "DoWhileOp", "ForOp",
614+
"IfOp", "ScopeOp", "SwitchOp",
615+
"TernaryOp", "WhileOp"]>]> {
616616
let summary = "Represents the default branching behaviour of a region";
617617
let description = [{
618618
The `cir.yield` operation terminates regions on different CIR operations,
@@ -1462,6 +1462,63 @@ def SelectOp : CIR_Op<"select", [Pure,
14621462
}];
14631463
}
14641464

1465+
//===----------------------------------------------------------------------===//
1466+
// TernaryOp
1467+
//===----------------------------------------------------------------------===//
1468+
1469+
def TernaryOp : CIR_Op<"ternary",
1470+
[DeclareOpInterfaceMethods<RegionBranchOpInterface>,
1471+
RecursivelySpeculatable, AutomaticAllocationScope, NoRegionArguments]> {
1472+
let summary = "The `cond ? a : b` C/C++ ternary operation";
1473+
let description = [{
1474+
The `cir.ternary` operation represents C/C++ ternary, much like a `select`
1475+
operation. The first argument is a `cir.bool` condition to evaluate, followed
1476+
by two regions to execute (true or false). This is different from `cir.if`
1477+
since each region is one block sized and the `cir.yield` closing the block
1478+
scope should have one argument.
1479+
1480+
`cir.ternary` also represents the GNU binary conditional operator ?: which
1481+
reuses the parent operation for both the condition and the true branch to
1482+
evaluate it only once.
1483+
1484+
Example:
1485+
1486+
```mlir
1487+
// cond = a && b;
1488+
1489+
%x = cir.ternary (%cond, true_region {
1490+
...
1491+
cir.yield %a : i32
1492+
}, false_region {
1493+
...
1494+
cir.yield %b : i32
1495+
}) -> i32
1496+
```
1497+
}];
1498+
let arguments = (ins CIR_BoolType:$cond);
1499+
let regions = (region AnyRegion:$trueRegion,
1500+
AnyRegion:$falseRegion);
1501+
let results = (outs Optional<CIR_AnyType>:$result);
1502+
1503+
let skipDefaultBuilders = 1;
1504+
let builders = [
1505+
OpBuilder<(ins "mlir::Value":$cond,
1506+
"llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)>":$trueBuilder,
1507+
"llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)>":$falseBuilder)
1508+
>
1509+
];
1510+
1511+
// All constraints already verified elsewhere.
1512+
let hasVerifier = 0;
1513+
1514+
let assemblyFormat = [{
1515+
`(` $cond `,`
1516+
`true` $trueRegion `,`
1517+
`false` $falseRegion
1518+
`)` `:` functional-type(operands, results) attr-dict
1519+
}];
1520+
}
1521+
14651522
//===----------------------------------------------------------------------===//
14661523
// GlobalOp
14671524
//===----------------------------------------------------------------------===//

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ def CIR_RecordType : CIR_Type<"Record", "record",
531531
bool isComplete() const { return !isIncomplete(); };
532532
bool isIncomplete() const;
533533

534+
mlir::Type getLargestMember(const mlir::DataLayout &dataLayout) const;
534535
size_t getNumElements() const { return getMembers().size(); };
535536
std::string getKindAsStr() {
536537
switch (getKind()) {

clang/include/clang/Driver/Options.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4195,6 +4195,11 @@ defm ms_tls_guards : BoolFOption<"ms-tls-guards",
41954195
def ftime_report : Flag<["-"], "ftime-report">, Group<f_Group>,
41964196
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
41974197
MarshallingInfoFlag<CodeGenOpts<"TimePasses">>;
4198+
def ftime_report_json
4199+
: Flag<["-"], "ftime-report-json">,
4200+
Group<f_Group>,
4201+
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
4202+
MarshallingInfoFlag<CodeGenOpts<"TimePassesJson">>;
41984203
def ftime_report_EQ: Joined<["-"], "ftime-report=">, Group<f_Group>,
41994204
Visibility<[ClangOption, CC1Option]>, Values<"per-pass,per-pass-run">,
42004205
MarshallingInfoFlag<CodeGenOpts<"TimePassesPerRun">>,

clang/include/clang/Lex/HLSLRootSignatureTokenKinds.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
TOK(invalid, "invalid identifier")
5656
TOK(end_of_stream, "end of stream")
5757
TOK(int_literal, "integer literal")
58+
TOK(float_literal, "float literal")
5859

5960
// Register Tokens:
6061
TOK(bReg, "b register")

0 commit comments

Comments
 (0)