Skip to content

Commit fe22f45

Browse files
authored
Merge branch 'main' into nfc-matmul
2 parents 1758aa2 + e7e5541 commit fe22f45

File tree

709 files changed

+26664
-11797
lines changed

Some content is hidden

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

709 files changed

+26664
-11797
lines changed

.ci/generate_test_report.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,8 @@ def test_report_size_limit(self):
309309
# If include failures is False, total number of test will be reported but their names
310310
# and output will not be.
311311
def _generate_report(title, junit_objects, size_limit=1024 * 1024, list_failures=True):
312-
style = None
313-
314312
if not junit_objects:
315-
return ("", style)
313+
return ("", "success")
316314

317315
failures = {}
318316
tests_run = 0
@@ -403,22 +401,23 @@ def generate_report(title, junit_files):
403401

404402
report, style = generate_report(args.title, args.junit_files)
405403

406-
p = subprocess.Popen(
407-
[
408-
"buildkite-agent",
409-
"annotate",
410-
"--context",
411-
args.context,
412-
"--style",
413-
style,
414-
],
415-
stdin=subprocess.PIPE,
416-
stderr=subprocess.PIPE,
417-
universal_newlines=True,
418-
)
404+
if report:
405+
p = subprocess.Popen(
406+
[
407+
"buildkite-agent",
408+
"annotate",
409+
"--context",
410+
args.context,
411+
"--style",
412+
style,
413+
],
414+
stdin=subprocess.PIPE,
415+
stderr=subprocess.PIPE,
416+
universal_newlines=True,
417+
)
419418

420-
# The report can be larger than the buffer for command arguments so we send
421-
# it over stdin instead.
422-
_, err = p.communicate(input=report)
423-
if p.returncode:
424-
raise RuntimeError(f"Failed to send report to buildkite-agent:\n{err}")
419+
# The report can be larger than the buffer for command arguments so we send
420+
# it over stdin instead.
421+
_, err = p.communicate(input=report)
422+
if p.returncode:
423+
raise RuntimeError(f"Failed to send report to buildkite-agent:\n{err}")

.github/new-issues-labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@
2727

2828
'bolt':
2929
- '/\bbolt(?!\-)\b/i'
30+
31+
'infra:commit-access-request':
32+
- '/Request Commit Access/'

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ env:
4545
LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-19"
4646
CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
4747

48-
4948
jobs:
5049
stage1:
5150
if: github.repository_owner == 'llvm'
5251
runs-on: libcxx-self-hosted-linux
53-
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
52+
container: ghcr.io/llvm/libcxx-linux-builder:0fd6f684b9c84c32d6cbfd9742402e788b2879f1
5453
continue-on-error: false
5554
strategy:
5655
fail-fast: false
@@ -87,7 +86,7 @@ jobs:
8786
stage2:
8887
if: github.repository_owner == 'llvm'
8988
runs-on: libcxx-self-hosted-linux
90-
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
89+
container: ghcr.io/llvm/libcxx-linux-builder:0fd6f684b9c84c32d6cbfd9742402e788b2879f1
9190
needs: [ stage1 ]
9291
continue-on-error: false
9392
strategy:
@@ -175,7 +174,7 @@ jobs:
175174
- config: 'generic-msan'
176175
machine: libcxx-self-hosted-linux
177176
runs-on: ${{ matrix.machine }}
178-
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
177+
container: ghcr.io/llvm/libcxx-linux-builder:0fd6f684b9c84c32d6cbfd9742402e788b2879f1
179178
steps:
180179
- uses: actions/checkout@v4
181180
- name: ${{ matrix.config }}

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5791,42 +5791,64 @@ void RewriteInstance::writeEHFrameHeader() {
57915791
LLVM_DEBUG(dbgs() << "BOLT: writing a new " << getEHFrameHdrSectionName()
57925792
<< '\n');
57935793

5794-
NextAvailableAddress =
5795-
appendPadding(Out->os(), NextAvailableAddress, EHFrameHdrAlign);
5794+
// Try to overwrite the original .eh_frame_hdr if the size permits.
5795+
uint64_t EHFrameHdrOutputAddress = 0;
5796+
uint64_t EHFrameHdrFileOffset = 0;
5797+
std::vector<char> NewEHFrameHdr;
5798+
BinarySection *OldEHFrameHdrSection = getSection(getEHFrameHdrSectionName());
5799+
if (OldEHFrameHdrSection) {
5800+
NewEHFrameHdr = CFIRdWrt->generateEHFrameHeader(
5801+
RelocatedEHFrame, NewEHFrame, OldEHFrameHdrSection->getAddress());
5802+
if (NewEHFrameHdr.size() <= OldEHFrameHdrSection->getSize()) {
5803+
BC->outs() << "BOLT-INFO: rewriting " << getEHFrameHdrSectionName()
5804+
<< " in-place\n";
5805+
EHFrameHdrOutputAddress = OldEHFrameHdrSection->getAddress();
5806+
EHFrameHdrFileOffset = OldEHFrameHdrSection->getInputFileOffset();
5807+
} else {
5808+
OldEHFrameHdrSection->setOutputName(getOrgSecPrefix() +
5809+
getEHFrameHdrSectionName());
5810+
OldEHFrameHdrSection = nullptr;
5811+
}
5812+
}
57965813

5797-
const uint64_t EHFrameHdrOutputAddress = NextAvailableAddress;
5798-
const uint64_t EHFrameHdrFileOffset =
5799-
getFileOffsetForAddress(NextAvailableAddress);
5814+
// If there was not enough space, allocate more memory for .eh_frame_hdr.
5815+
if (!OldEHFrameHdrSection) {
5816+
NextAvailableAddress =
5817+
appendPadding(Out->os(), NextAvailableAddress, EHFrameHdrAlign);
58005818

5801-
std::vector<char> NewEHFrameHdr = CFIRdWrt->generateEHFrameHeader(
5802-
RelocatedEHFrame, NewEHFrame, EHFrameHdrOutputAddress);
5819+
EHFrameHdrOutputAddress = NextAvailableAddress;
5820+
EHFrameHdrFileOffset = getFileOffsetForAddress(NextAvailableAddress);
5821+
5822+
NewEHFrameHdr = CFIRdWrt->generateEHFrameHeader(
5823+
RelocatedEHFrame, NewEHFrame, EHFrameHdrOutputAddress);
5824+
5825+
NextAvailableAddress += NewEHFrameHdr.size();
5826+
if (!BC->BOLTReserved.empty() &&
5827+
(NextAvailableAddress > BC->BOLTReserved.end())) {
5828+
BC->errs() << "BOLT-ERROR: unable to fit " << getEHFrameHdrSectionName()
5829+
<< " into reserved space\n";
5830+
exit(1);
5831+
}
5832+
5833+
// Create a new entry in the section header table.
5834+
const unsigned Flags = BinarySection::getFlags(/*IsReadOnly=*/true,
5835+
/*IsText=*/false,
5836+
/*IsAllocatable=*/true);
5837+
BinarySection &EHFrameHdrSec = BC->registerOrUpdateSection(
5838+
getNewSecPrefix() + getEHFrameHdrSectionName(), ELF::SHT_PROGBITS,
5839+
Flags, nullptr, NewEHFrameHdr.size(), /*Alignment=*/1);
5840+
EHFrameHdrSec.setOutputFileOffset(EHFrameHdrFileOffset);
5841+
EHFrameHdrSec.setOutputAddress(EHFrameHdrOutputAddress);
5842+
EHFrameHdrSec.setOutputName(getEHFrameHdrSectionName());
5843+
}
58035844

58045845
Out->os().seek(EHFrameHdrFileOffset);
58055846
Out->os().write(NewEHFrameHdr.data(), NewEHFrameHdr.size());
58065847

5807-
const unsigned Flags = BinarySection::getFlags(/*IsReadOnly=*/true,
5808-
/*IsText=*/false,
5809-
/*IsAllocatable=*/true);
5810-
BinarySection *OldEHFrameHdrSection = getSection(getEHFrameHdrSectionName());
5848+
// Pad the contents if overwriting in-place.
58115849
if (OldEHFrameHdrSection)
5812-
OldEHFrameHdrSection->setOutputName(getOrgSecPrefix() +
5813-
getEHFrameHdrSectionName());
5814-
5815-
BinarySection &EHFrameHdrSec = BC->registerOrUpdateSection(
5816-
getNewSecPrefix() + getEHFrameHdrSectionName(), ELF::SHT_PROGBITS, Flags,
5817-
nullptr, NewEHFrameHdr.size(), /*Alignment=*/1);
5818-
EHFrameHdrSec.setOutputFileOffset(EHFrameHdrFileOffset);
5819-
EHFrameHdrSec.setOutputAddress(EHFrameHdrOutputAddress);
5820-
EHFrameHdrSec.setOutputName(getEHFrameHdrSectionName());
5821-
5822-
NextAvailableAddress += EHFrameHdrSec.getOutputSize();
5823-
5824-
if (!BC->BOLTReserved.empty() &&
5825-
(NextAvailableAddress > BC->BOLTReserved.end())) {
5826-
BC->errs() << "BOLT-ERROR: unable to fit " << getEHFrameHdrSectionName()
5827-
<< " into reserved space\n";
5828-
exit(1);
5829-
}
5850+
Out->os().write_zeros(OldEHFrameHdrSection->getSize() -
5851+
NewEHFrameHdr.size());
58305852

58315853
// Merge new .eh_frame with the relocated original so that gdb can locate all
58325854
// FDEs.

bolt/test/eh-frame-hdr.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Check that llvm-bolt overwrites .eh_frame_hdr in-place.
2+
3+
REQUIRES: system-linux
4+
5+
RUN: %clang %cflags %p/Inputs/hello.c -o %t -Wl,-q
6+
RUN: llvm-bolt %t -o %t.bolt --use-old-text \
7+
RUN: | FileCheck %s --check-prefix=CHECK-BOLT
8+
RUN: llvm-readelf -WS %t.bolt | FileCheck %s
9+
10+
CHECK-BOLT: rewriting .eh_frame_hdr in-place
11+
12+
CHECK-NOT: .bolt.org.eh_frame_hdr

clang-tools-extra/clangd/Protocol.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,35 @@ bool fromJSON(const llvm::json::Value &Params, ClientCapabilities &R,
511511
if (auto EditsNearCursor = Completion->getBoolean("editsNearCursor"))
512512
R.CompletionFixes |= *EditsNearCursor;
513513
}
514+
if (auto *References = TextDocument->getObject("references")) {
515+
if (auto ContainerSupport = References->getBoolean("container")) {
516+
R.ReferenceContainer |= *ContainerSupport;
517+
}
518+
}
519+
if (auto *Diagnostics = TextDocument->getObject("publishDiagnostics")) {
520+
if (auto CodeActions = Diagnostics->getBoolean("codeActionsInline")) {
521+
R.DiagnosticFixes |= *CodeActions;
522+
}
523+
}
524+
if (auto *InactiveRegions =
525+
TextDocument->getObject("inactiveRegionsCapabilities")) {
526+
if (auto InactiveRegionsSupport =
527+
InactiveRegions->getBoolean("inactiveRegions")) {
528+
R.InactiveRegions |= *InactiveRegionsSupport;
529+
}
530+
}
531+
}
532+
if (auto *Window = Experimental->getObject("window")) {
533+
if (auto Implicit =
534+
Window->getBoolean("implicitWorkDoneProgressCreate")) {
535+
R.ImplicitProgressCreation |= *Implicit;
536+
}
537+
}
538+
if (auto *OffsetEncoding = Experimental->get("offsetEncoding")) {
539+
R.offsetEncoding.emplace();
540+
if (!fromJSON(*OffsetEncoding, *R.offsetEncoding,
541+
P.field("offsetEncoding")))
542+
return false;
514543
}
515544
}
516545

clang-tools-extra/clangd/Protocol.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ struct ClientCapabilities {
452452
std::optional<SymbolKindBitset> WorkspaceSymbolKinds;
453453

454454
/// Whether the client accepts diagnostics with codeActions attached inline.
455+
/// This is a clangd extension.
455456
/// textDocument.publishDiagnostics.codeActionsInline.
456457
bool DiagnosticFixes = false;
457458

@@ -475,6 +476,7 @@ struct ClientCapabilities {
475476

476477
/// Client supports displaying a container string for results of
477478
/// textDocument/reference (clangd extension)
479+
/// textDocument.references.container
478480
bool ReferenceContainer = false;
479481

480482
/// Client supports hierarchical document symbols.
@@ -563,6 +565,7 @@ struct ClientCapabilities {
563565

564566
/// Whether the client supports the textDocument/inactiveRegions
565567
/// notification. This is a clangd extension.
568+
/// textDocument.inactiveRegionsCapabilities.inactiveRegions
566569
bool InactiveRegions = false;
567570
};
568571
bool fromJSON(const llvm::json::Value &, ClientCapabilities &,

clang-tools-extra/clangd/XRefs.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include "llvm/ADT/StringRef.h"
6464
#include "llvm/Support/Casting.h"
6565
#include "llvm/Support/Error.h"
66+
#include "llvm/Support/ErrorHandling.h"
6667
#include "llvm/Support/Path.h"
6768
#include "llvm/Support/raw_ostream.h"
6869
#include <optional>
@@ -2275,7 +2276,7 @@ incomingCalls(const CallHierarchyItem &Item, const SymbolIndex *Index) {
22752276
// Initially store the ranges in a map keyed by SymbolID of the caller.
22762277
// This allows us to group different calls with the same caller
22772278
// into the same CallHierarchyIncomingCall.
2278-
llvm::DenseMap<SymbolID, std::vector<Range>> CallsIn;
2279+
llvm::DenseMap<SymbolID, std::vector<Location>> CallsIn;
22792280
// We can populate the ranges based on a refs request only. As we do so, we
22802281
// also accumulate the container IDs into a lookup request.
22812282
LookupRequest ContainerLookup;
@@ -2285,7 +2286,7 @@ incomingCalls(const CallHierarchyItem &Item, const SymbolIndex *Index) {
22852286
elog("incomingCalls failed to convert location: {0}", Loc.takeError());
22862287
return;
22872288
}
2288-
CallsIn[R.Container].push_back(Loc->range);
2289+
CallsIn[R.Container].push_back(*Loc);
22892290

22902291
ContainerLookup.IDs.insert(R.Container);
22912292
});
@@ -2294,9 +2295,21 @@ incomingCalls(const CallHierarchyItem &Item, const SymbolIndex *Index) {
22942295
Index->lookup(ContainerLookup, [&](const Symbol &Caller) {
22952296
auto It = CallsIn.find(Caller.ID);
22962297
assert(It != CallsIn.end());
2297-
if (auto CHI = symbolToCallHierarchyItem(Caller, Item.uri.file()))
2298+
if (auto CHI = symbolToCallHierarchyItem(Caller, Item.uri.file())) {
2299+
std::vector<Range> FromRanges;
2300+
for (const Location &L : It->second) {
2301+
if (L.uri != CHI->uri) {
2302+
// Call location not in same file as caller.
2303+
// This can happen in some edge cases. There's not much we can do,
2304+
// since the protocol only allows returning ranges interpreted as
2305+
// being in the caller's file.
2306+
continue;
2307+
}
2308+
FromRanges.push_back(L.range);
2309+
}
22982310
Results.push_back(
2299-
CallHierarchyIncomingCall{std::move(*CHI), std::move(It->second)});
2311+
CallHierarchyIncomingCall{std::move(*CHI), std::move(FromRanges)});
2312+
}
23002313
});
23012314
// Sort results by name of container.
23022315
llvm::sort(Results, [](const CallHierarchyIncomingCall &A,

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,35 @@ TEST(CallHierarchy, HierarchyOnVar) {
491491
fromRanges(Source.range("Callee")))));
492492
}
493493

494+
TEST(CallHierarchy, CallInDifferentFileThanCaller) {
495+
Annotations Header(R"cpp(
496+
#define WALDO void caller() {
497+
)cpp");
498+
Annotations Source(R"cpp(
499+
void call^ee();
500+
WALDO
501+
callee();
502+
}
503+
)cpp");
504+
auto TU = TestTU::withCode(Source.code());
505+
TU.HeaderCode = Header.code();
506+
auto AST = TU.build();
507+
auto Index = TU.index();
508+
509+
std::vector<CallHierarchyItem> Items =
510+
prepareCallHierarchy(AST, Source.point(), testPath(TU.Filename));
511+
ASSERT_THAT(Items, ElementsAre(withName("callee")));
512+
513+
auto Incoming = incomingCalls(Items[0], Index.get());
514+
515+
// The only call site is in the source file, which is a different file from
516+
// the declaration of the function containing the call, which is in the
517+
// header. The protocol does not allow us to represent such calls, so we drop
518+
// them. (The call hierarchy item itself is kept.)
519+
EXPECT_THAT(Incoming,
520+
ElementsAre(AllOf(from(withName("caller")), fromRanges())));
521+
}
522+
494523
} // namespace
495524
} // namespace clangd
496525
} // namespace clang

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ Non-comprehensive list of changes in this release
355355
The flexible array member (FAM) can now be accessed immediately without causing
356356
issues with the sanitizer because the counter is automatically set.
357357

358+
- ``__builtin_reduce_add`` function can now be used in constant expressions.
359+
358360
New Compiler Flags
359361
------------------
360362

@@ -710,6 +712,8 @@ Target Specific Changes
710712
AMDGPU Support
711713
^^^^^^^^^^^^^^
712714

715+
- Initial support for gfx950
716+
713717
- Added headers ``gpuintrin.h`` and ``amdgpuintrin.h`` that contains common
714718
definitions for GPU builtin functions. This header can be included for OpenMP,
715719
CUDA, HIP, OpenCL, and C/C++.

0 commit comments

Comments
 (0)