Skip to content

Commit 27c583a

Browse files
authored
Merge branch 'main' into fmv-apint
2 parents b62c891 + 52737ea commit 27c583a

File tree

390 files changed

+15058
-9588
lines changed

Some content is hidden

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

390 files changed

+15058
-9588
lines changed

.github/workflows/premerge.yaml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ jobs:
3434
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3535
with:
3636
fetch-depth: 2
37-
- name: Setup ccache
38-
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
39-
with:
40-
variant: "sccache"
41-
max-size: "2000M"
4237
- name: Build and Test
4338
# Mark the job as a success even if the step fails so that people do
4439
# not get notified while the new premerge pipeline is in an
@@ -62,6 +57,13 @@ jobs:
6257
export CC=/opt/llvm/bin/clang
6358
export CXX=/opt/llvm/bin/clang++
6459
60+
# This environment variable is passes into the container through the
61+
# runner pod definition. This differs between our two clusters which
62+
# why we do not hardcode it.
63+
export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET
64+
export SCCACHE_GCS_RW_MODE=READ_WRITE
65+
sccache --start-server
66+
6567
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}" "${enable_cir}"
6668
- name: Upload Artifacts
6769
if: '!cancelled()'
@@ -86,11 +88,6 @@ jobs:
8688
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8789
with:
8890
fetch-depth: 2
89-
- name: Setup ccache
90-
uses: hendrikmuhs/ccache-action@a1209f81afb8c005c13b4296c32e363431bffea5 # v1.2.17
91-
with:
92-
variant: "sccache"
93-
max-size: "2000M"
9491
- name: Compute Projects
9592
id: vars
9693
run: |
@@ -113,7 +110,7 @@ jobs:
113110
shell: cmd
114111
run: |
115112
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
116-
bash .ci/monolithic-windows.sh "${{ steps.vars.outputs.windows-projects }}" "${{ steps.vars.outputs.windows-check-targets }}"
113+
bash -c "export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET; export SCCACHE_GCS_RW_MODE=READ_WRITE; sccache --start-server; .ci/monolithic-windows.sh \"${{ steps.vars.outputs.windows-projects }}\" \"${{ steps.vars.outputs.windows-check-targets }}\""
117114
- name: Upload Artifacts
118115
if: '!cancelled()'
119116
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0

clang/docs/LanguageExtensions.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,14 @@ of different sizes and signs is forbidden in binary and ternary builtins.
848848
semantics, see `LangRef
849849
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
850850
for the comparison.
851+
T __builtin_elementwise_maximumnum(T x, T y) return x or y, whichever is larger. Follows IEEE 754-2019 floating point types
852+
semantics, see `LangRef
853+
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
854+
for the comparison.
855+
T __builtin_elementwise_minimumnum(T x, T y) return x or y, whichever is smaller. Follows IEEE 754-2019 floating point types
856+
semantics, see `LangRef
857+
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
858+
for the comparison.
851859
============================================== ====================================================================== =========================================
852860

853861

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ Non-comprehensive list of changes in this release
344344
- Added `__builtin_elementwise_exp10`.
345345
- For AMDPGU targets, added `__builtin_v_cvt_off_f32_i4` that maps to the `v_cvt_off_f32_i4` instruction.
346346
- Added `__builtin_elementwise_minnum` and `__builtin_elementwise_maxnum`.
347+
- Added `__builtin_elementwise_minnumnum` and `__builtin_elementwise_maxnumnum`.
347348
- No longer crashing on invalid Objective-C categories and extensions when
348349
dumping the AST as JSON. (#GH137320)
349350
- Clang itself now uses split stacks instead of threads for allocating more
@@ -814,6 +815,10 @@ Bug Fixes in This Version
814815
- Fixed a failed assertion with an operator call expression which comes from a
815816
macro expansion when performing analysis for nullability attributes. (#GH138371)
816817
- Fixed a concept equivalent checking crash due to untransformed constraint expressions. (#GH146614)
818+
- Fixed a crash in `clang-scan-deps` when a module with the same name is found
819+
in different locations (#GH134404, #GH146976).
820+
- Fix a crash when marco name is empty in ``#pragma push_macro("")`` or
821+
``#pragma pop_macro("")``. (GH149762).
817822

818823
Bug Fixes to Compiler Builtins
819824
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/Builtins.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,18 @@ def ElementwiseMinimum : Builtin {
13341334
let Prototype = "void(...)";
13351335
}
13361336

1337+
def ElementwiseMaximumNum : Builtin {
1338+
let Spellings = ["__builtin_elementwise_maximumnum"];
1339+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1340+
let Prototype = "void(...)";
1341+
}
1342+
1343+
def ElementwiseMinimumNum : Builtin {
1344+
let Spellings = ["__builtin_elementwise_minimumnum"];
1345+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1346+
let Prototype = "void(...)";
1347+
}
1348+
13371349
def ElementwiseCeil : Builtin {
13381350
let Spellings = ["__builtin_elementwise_ceil"];
13391351
let Attributes = [NoThrow, Const, CustomTypeChecking];

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,10 @@ CODEGENOPT(SpeculativeLoadHardening, 1, 0, Benign) ///< Enable speculative load
313313
CODEGENOPT(FineGrainedBitfieldAccesses, 1, 0, Benign) ///< Enable fine-grained bitfield accesses.
314314
CODEGENOPT(StrictEnums , 1, 0, Benign) ///< Optimize based on strict enum definition.
315315
CODEGENOPT(StrictVTablePointers, 1, 0, Benign) ///< Optimize based on the strict vtable pointers
316-
CODEGENOPT(TimePasses , 1, 0, Benign) ///< Set when -ftime-report or -ftime-report= or -ftime-report-json is enabled.
316+
CODEGENOPT(TimePasses , 1, 0, Benign) ///< Set when -ftime-report, -ftime-report=, -ftime-report-json, or -stats-file-timers is enabled.
317317
CODEGENOPT(TimePassesPerRun , 1, 0, Benign) ///< Set when -ftime-report=per-pass-run is enabled.
318318
CODEGENOPT(TimePassesJson , 1, 0, Benign) ///< Set when -ftime-report-json is enabled.
319+
CODEGENOPT(TimePassesStatsFile , 1, 0, Benign) ///< Set when -stats-file-timers is enabled.
319320
CODEGENOPT(TimeTrace , 1, 0, Benign) ///< Set when -ftime-trace is enabled.
320321
VALUE_CODEGENOPT(TimeTraceGranularity, 32, 500, Benign) ///< Minimum time granularity (in microseconds),
321322
///< traced by time profiler

clang/include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,9 @@ def err_pragma_push_pop_macro_malformed : Error<
694694
def warn_pragma_pop_macro_no_push : Warning<
695695
"pragma pop_macro could not pop '%0', no matching push_macro">,
696696
InGroup<IgnoredPragmas>;
697+
def warn_pargma_push_pop_macro_empty_string : Warning<
698+
"'#pragma %select{push_macro|pop_macro}0' expected a non-empty string">,
699+
InGroup<IgnoredPragmas>;
697700
def warn_pragma_message : Warning<"%0">,
698701
InGroup<PoundPragmaMessage>, DefaultWarnNoWerror;
699702
def err_pragma_message : Error<"%0">;

clang/include/clang/Basic/LangOptions.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ LANGOPT(CheckConstexprFunctionBodies, 1, 1, Benign,
491491

492492
LANGOPT(BoundsSafety, 1, 0, NotCompatible, "Bounds safety extension for C")
493493

494+
LANGOPT(EnableLifetimeSafety, 1, 0, NotCompatible, "Experimental lifetime safety analysis for C++")
495+
494496
LANGOPT(PreserveVec3Type, 1, 0, NotCompatible, "Preserve 3-component vector type")
495497

496498
#undef LANGOPT

clang/include/clang/Driver/Options.td

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,6 +1904,14 @@ defm bounds_safety : BoolFOption<
19041904
BothFlags<[], [CC1Option],
19051905
" experimental bounds safety extension for C">>;
19061906

1907+
defm lifetime_safety : BoolFOption<
1908+
"experimental-lifetime-safety",
1909+
LangOpts<"EnableLifetimeSafety">, DefaultFalse,
1910+
PosFlag<SetTrue, [], [CC1Option], "Enable">,
1911+
NegFlag<SetFalse, [], [CC1Option], "Disable">,
1912+
BothFlags<[], [CC1Option],
1913+
" experimental lifetime safety for C++">>;
1914+
19071915
defm addrsig : BoolFOption<"addrsig",
19081916
CodeGenOpts<"Addrsig">, DefaultFalse,
19091917
PosFlag<SetTrue, [], [ClangOption, CC1Option], "Emit">,
@@ -8253,6 +8261,9 @@ def stats_file : Joined<["-"], "stats-file=">,
82538261
def stats_file_append : Flag<["-"], "stats-file-append">,
82548262
HelpText<"If stats should be appended to stats-file instead of overwriting it">,
82558263
MarshallingInfoFlag<FrontendOpts<"AppendStats">>;
8264+
def stats_file_timers : Flag<["-"], "stats-file-timers">,
8265+
HelpText<"If stats should include timers.">,
8266+
MarshallingInfoFlag<CodeGenOpts<"TimePassesStatsFile">>;
82568267
def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">,
82578268
HelpText<"Dump record layout information in a simple form used for testing">,
82588269
MarshallingInfoFlag<LangOpts<"DumpRecordLayoutsSimple">>;

clang/include/clang/Driver/ToolChain.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,8 @@ class ToolChain {
802802

803803
/// Get paths for device libraries.
804804
virtual llvm::SmallVector<BitCodeLibraryInfo, 12>
805-
getDeviceLibs(const llvm::opt::ArgList &Args) const;
805+
getDeviceLibs(const llvm::opt::ArgList &Args,
806+
const Action::OffloadKind DeviceOffloadingKind) const;
806807

807808
/// Add the system specific linker arguments to use
808809
/// for the given HIP runtime library type.

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,6 @@ using APSInt = llvm::APSInt;
2525
namespace clang {
2626
namespace interp {
2727

28-
static bool refersToUnion(const Expr *E) {
29-
for (;;) {
30-
if (const auto *ME = dyn_cast<MemberExpr>(E)) {
31-
if (const auto *FD = dyn_cast<FieldDecl>(ME->getMemberDecl());
32-
FD && FD->getParent()->isUnion())
33-
return true;
34-
E = ME->getBase();
35-
continue;
36-
}
37-
38-
if (const auto *ASE = dyn_cast<ArraySubscriptExpr>(E)) {
39-
E = ASE->getBase()->IgnoreImplicit();
40-
continue;
41-
}
42-
43-
if (const auto *ICE = dyn_cast<ImplicitCastExpr>(E);
44-
ICE && (ICE->getCastKind() == CK_NoOp ||
45-
ICE->getCastKind() == CK_DerivedToBase ||
46-
ICE->getCastKind() == CK_UncheckedDerivedToBase)) {
47-
E = ICE->getSubExpr();
48-
continue;
49-
}
50-
51-
break;
52-
}
53-
return false;
54-
}
55-
5628
static std::optional<bool> getBoolValue(const Expr *E) {
5729
if (const auto *CE = dyn_cast_if_present<ConstantExpr>(E);
5830
CE && CE->hasAPValueResult() &&
@@ -5401,6 +5373,53 @@ bool Compiler<Emitter>::maybeEmitDeferredVarInit(const VarDecl *VD) {
54015373
return true;
54025374
}
54035375

5376+
static bool hasTrivialDefaultCtorParent(const FieldDecl *FD) {
5377+
assert(FD);
5378+
assert(FD->getParent()->isUnion());
5379+
const auto *CXXRD = dyn_cast<CXXRecordDecl>(FD->getParent());
5380+
return !CXXRD || CXXRD->hasTrivialDefaultConstructor();
5381+
}
5382+
5383+
template <class Emitter> bool Compiler<Emitter>::refersToUnion(const Expr *E) {
5384+
for (;;) {
5385+
if (const auto *ME = dyn_cast<MemberExpr>(E)) {
5386+
if (const auto *FD = dyn_cast<FieldDecl>(ME->getMemberDecl());
5387+
FD && FD->getParent()->isUnion() && hasTrivialDefaultCtorParent(FD))
5388+
return true;
5389+
E = ME->getBase();
5390+
continue;
5391+
}
5392+
5393+
if (const auto *ASE = dyn_cast<ArraySubscriptExpr>(E)) {
5394+
E = ASE->getBase()->IgnoreImplicit();
5395+
continue;
5396+
}
5397+
5398+
if (const auto *ICE = dyn_cast<ImplicitCastExpr>(E);
5399+
ICE && (ICE->getCastKind() == CK_NoOp ||
5400+
ICE->getCastKind() == CK_DerivedToBase ||
5401+
ICE->getCastKind() == CK_UncheckedDerivedToBase)) {
5402+
E = ICE->getSubExpr();
5403+
continue;
5404+
}
5405+
5406+
if (const auto *This = dyn_cast<CXXThisExpr>(E)) {
5407+
const auto *ThisRecord =
5408+
This->getType()->getPointeeType()->getAsRecordDecl();
5409+
if (!ThisRecord->isUnion())
5410+
return false;
5411+
// Otherwise, always activate if we're in the ctor.
5412+
if (const auto *Ctor =
5413+
dyn_cast_if_present<CXXConstructorDecl>(CompilingFunction))
5414+
return Ctor->getParent() == ThisRecord;
5415+
return false;
5416+
}
5417+
5418+
break;
5419+
}
5420+
return false;
5421+
}
5422+
54045423
template <class Emitter>
54055424
bool Compiler<Emitter>::visitDeclStmt(const DeclStmt *DS,
54065425
bool EvaluateConditionDecl) {
@@ -5933,16 +5952,15 @@ bool Compiler<Emitter>::compileConstructor(const CXXConstructorDecl *Ctor) {
59335952
return false;
59345953

59355954
if (OptPrimType T = this->classify(InitExpr)) {
5955+
if (Activate && !this->emitActivateThisField(FieldOffset, InitExpr))
5956+
return false;
5957+
59365958
if (!this->visit(InitExpr))
59375959
return false;
59385960

59395961
bool BitField = F->isBitField();
5940-
if (BitField && Activate)
5941-
return this->emitInitThisBitFieldActivate(*T, F, FieldOffset, InitExpr);
59425962
if (BitField)
59435963
return this->emitInitThisBitField(*T, F, FieldOffset, InitExpr);
5944-
if (Activate)
5945-
return this->emitInitThisFieldActivate(*T, FieldOffset, InitExpr);
59465964
return this->emitInitThisField(*T, FieldOffset, InitExpr);
59475965
}
59485966
// Non-primitive case. Get a pointer to the field-to-initialize

0 commit comments

Comments
 (0)