Skip to content

Commit 60e0591

Browse files
authored
Merge branch 'main' into wali_target
2 parents fa82638 + c265d7a commit 60e0591

File tree

1,112 files changed

+44849
-35748
lines changed

Some content is hidden

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

1,112 files changed

+44849
-35748
lines changed

.ci/generate_test_report_github.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88

99
import generate_test_report_lib
1010

11-
PLATFORM_TITLES = {
12-
"Windows": ":window: Windows x64 Test Results",
13-
"Linux": ":penguin: Linux x64 Test Results",
14-
}
11+
def compute_platform_title() -> str:
12+
logo = ":window:" if platform.system() == "Windows" else ":penguin:"
13+
# On Linux the machine value is x86_64 on Windows it is AMD64.
14+
if platform.machine() == "x86_64" or platform.machine() == "AMD64":
15+
arch = "x64"
16+
else:
17+
arch = platform.machine()
18+
return f"{logo} {platform.system()} {arch} Test Results"
19+
1520

1621
if __name__ == "__main__":
1722
parser = argparse.ArgumentParser()
@@ -22,7 +27,7 @@
2227
args = parser.parse_args()
2328

2429
report = generate_test_report_lib.generate_report_from_files(
25-
PLATFORM_TITLES[platform.system()], args.return_code, args.build_test_logs
30+
compute_platform_title(), args.return_code, args.build_test_logs
2631
)
2732

2833
print(report)

.ci/utils.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ function start-group {
5656
export PIP_BREAK_SYSTEM_PACKAGES=1
5757
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
5858

59-
if [[ "$GITHUB_ACTIONS" != "" ]]; then
59+
# The ARM64 builders run on AWS and don't have access to the GCS cache.
60+
if [[ "$GITHUB_ACTIONS" != "" ]] && [[ "$RUNNER_ARCH" != "ARM64" ]]; then
6061
python .ci/cache_lit_timing_files.py download
6162
fi

.github/workflows/premerge.yaml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,45 @@ concurrency:
2424

2525
jobs:
2626
premerge-checks-linux:
27-
name: Build and Test Linux
27+
name: Build and Test Linux${{ (startsWith(matrix.runs-on, 'depot-ubuntu-24.04-arm') && ' AArch64') || '' }}
2828
if: >-
2929
github.repository_owner == 'llvm' &&
3030
(github.event_name != 'pull_request' || github.event.action != 'closed')
31-
runs-on: llvm-premerge-linux-runners
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
runs-on:
35+
- depot-ubuntu-24.04-arm-16
36+
- llvm-premerge-linux-runners
37+
runs-on: ${{ matrix.runs-on }}
38+
container:
39+
# The llvm-premerge agents are already containers and running the
40+
# this same image, so we can't use a container for the github action
41+
# job. The depot containers are running on VMs, so we can use a
42+
# container. This helps ensure the build environment is as close
43+
# as possible on both the depot runners and the llvm-premerge runners.
44+
image: ${{ (startsWith(matrix.runs-on, 'depot-ubuntu-24.04-arm') && format('ghcr.io/{0}/arm64v8/ci-ubuntu-24.04',github.repository_owner) ) || null }}
45+
# --privileged is needed to run the lldb tests that disable aslr.
46+
# The SCCACHE environment variables are need to be copied from the host
47+
# to the container to make sure it is configured correctly to use the
48+
# depot cache.
49+
options: >-
50+
--privileged
51+
--env SCCACHE_WEBDAV_ENDPOINT
52+
--env SCCACHE_WEBDAV_TOKEN
53+
defaults:
54+
run:
55+
# The run step defaults to using sh as the shell when running in a
56+
# container, so make bash the default to ensure consistency between
57+
# container and non-container jobs.
58+
shell: bash
3259
steps:
3360
- name: Checkout LLVM
3461
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3562
with:
3663
fetch-depth: 2
3764
- name: Build and Test
65+
continue-on-error: ${{ runner.arch == 'ARM64' }}
3866
run: |
3967
git config --global --add safe.directory '*'
4068
@@ -54,11 +82,16 @@ jobs:
5482
export CC=/opt/llvm/bin/clang
5583
export CXX=/opt/llvm/bin/clang++
5684
57-
# This environment variable is passes into the container through the
58-
# runner pod definition. This differs between our two clusters which
59-
# why we do not hardcode it.
60-
export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET
61-
export SCCACHE_GCS_RW_MODE=READ_WRITE
85+
# The linux-premerge runners are hosted on GCP and have a different
86+
# cache setup than the depot runners.
87+
if [[ "${{ matrix.runs-on }}" = "llvm-premerge-linux-runners" ]]; then
88+
# This environment variable is passes into the container through the
89+
# runner pod definition. This differs between our two clusters which
90+
# why we do not hardcode it.
91+
export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET
92+
export SCCACHE_GCS_RW_MODE=READ_WRITE
93+
fi
94+
env
6295
6396
# Set the idle timeout to zero to ensure sccache runs for the
6497
# entire duration of the job. Otherwise it might stop if we run
@@ -78,7 +111,7 @@ jobs:
78111
if: '!cancelled()'
79112
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
80113
with:
81-
name: Premerge Artifacts (Linux)
114+
name: Premerge Artifacts (Linux ${{ runner.arch }})
82115
path: artifacts/
83116
retention-days: 5
84117
include-hidden-files: 'true'

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,12 @@ void RewriteInstance::registerFragments() {
15141514
}
15151515
if (BD) {
15161516
BinaryFunction *BF = BC->getFunctionForSymbol(BD->getSymbol());
1517+
if (BF == &Function) {
1518+
BC->errs()
1519+
<< "BOLT-WARNING: fragment maps to the same function as parent: "
1520+
<< Function << '\n';
1521+
continue;
1522+
}
15171523
if (BF) {
15181524
BC->registerFragment(Function, *BF);
15191525
continue;
@@ -4005,10 +4011,12 @@ void RewriteInstance::mapCodeSections(BOLTLinker::SectionMapper MapSection) {
40054011
BC->outs() << '\n';
40064012
AllocationDone = true;
40074013
} else {
4008-
BC->errs() << "BOLT-WARNING: original .text too small to fit the new code"
4009-
<< " using 0x" << Twine::utohexstr(opts::AlignText)
4010-
<< " alignment. " << CodeSize << " bytes needed, have "
4011-
<< BC->OldTextSectionSize << " bytes available.\n";
4014+
BC->errs() << "BOLT-WARNING: --use-old-text failed. The original .text "
4015+
"too small to fit the new code using 0x"
4016+
<< Twine::utohexstr(opts::AlignText) << " alignment. "
4017+
<< CodeSize << " bytes needed, have " << BC->OldTextSectionSize
4018+
<< " bytes available. Rebuilding without --use-old-text may "
4019+
"produce a smaller binary\n";
40124020
opts::UseOldText = false;
40134021
}
40144022
}

bolt/test/X86/fragment-alias.s

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## This test reproduces the issue where a fragment has the same address as
2+
## parent function.
3+
# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o
4+
# RUN: %clang %cflags %t.o -o %t
5+
# RUN: llvm-bolt %t -o %t.out 2>&1 | FileCheck %s
6+
# CHECK: BOLT-WARNING: fragment maps to the same function as parent: main/1(*2)
7+
.type main, @function
8+
.type main.cold, @function
9+
main.cold:
10+
main:
11+
ret
12+
.size main, .-main
13+
.size main.cold, .-main.cold

clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,22 @@ class MustacheHTMLGenerator : public Generator {
4646
const ClangDocContext &CDCtx) override;
4747
};
4848

49-
class MustacheTemplateFile : public Template {
49+
class MustacheTemplateFile {
50+
BumpPtrAllocator Allocator;
51+
StringSaver Saver;
52+
MustacheContext Ctx;
53+
Template T;
54+
std::unique_ptr<MemoryBuffer> Buffer;
55+
5056
public:
5157
static Expected<std::unique_ptr<MustacheTemplateFile>>
5258
createMustacheFile(StringRef FileName) {
5359
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrError =
5460
MemoryBuffer::getFile(FileName);
5561
if (auto EC = BufferOrError.getError())
5662
return createFileOpenError(FileName, EC);
57-
58-
std::unique_ptr<MemoryBuffer> Buffer = std::move(BufferOrError.get());
59-
StringRef FileContent = Buffer->getBuffer();
60-
return std::make_unique<MustacheTemplateFile>(FileContent);
63+
return std::make_unique<MustacheTemplateFile>(
64+
std::move(BufferOrError.get()));
6165
}
6266

6367
Error registerPartialFile(StringRef Name, StringRef FileName) {
@@ -68,11 +72,15 @@ class MustacheTemplateFile : public Template {
6872

6973
std::unique_ptr<MemoryBuffer> Buffer = std::move(BufferOrError.get());
7074
StringRef FileContent = Buffer->getBuffer();
71-
registerPartial(Name.str(), FileContent.str());
75+
T.registerPartial(Name.str(), FileContent.str());
7276
return Error::success();
7377
}
7478

75-
MustacheTemplateFile(StringRef TemplateStr) : Template(TemplateStr) {}
79+
void render(json::Value &V, raw_ostream &OS) { T.render(V, OS); }
80+
81+
MustacheTemplateFile(std::unique_ptr<MemoryBuffer> &&B)
82+
: Saver(Allocator), Ctx(Allocator, Saver), T(B->getBuffer(), Ctx),
83+
Buffer(std::move(B)) {}
7684
};
7785

7886
static std::unique_ptr<MustacheTemplateFile> NamespaceTemplate = nullptr;

clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void InitVariablesCheck::check(const MatchFinder::MatchResult &Result) {
108108
<< MatchedDecl;
109109
if (*InitializationString != nullptr)
110110
Diagnostic << FixItHint::CreateInsertion(
111-
utils::lexer::findNextTerminator(MatchedDecl->getLocation(),
111+
utils::lexer::findNextTerminator(MatchedDecl->getEndLoc(),
112112
*Result.SourceManager,
113113
Result.Context->getLangOpts()),
114114
*InitializationString);

clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) {
249249
CheckValue();
250250
if (WarnPointersAsPointers) {
251251
if (const auto *PT = dyn_cast<PointerType>(VT)) {
252-
if (!PT->getPointeeType().isConstQualified())
252+
if (!PT->getPointeeType().isConstQualified() &&
253+
!PT->getPointeeType()->isFunctionType())
253254
CheckPointee();
254255
}
255256
if (const auto *AT = dyn_cast<ArrayType>(VT)) {

clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp

Lines changed: 33 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ namespace {
2424
class IncludeModernizePPCallbacks : public PPCallbacks {
2525
public:
2626
explicit IncludeModernizePPCallbacks(
27-
std::vector<IncludeMarker> &IncludesToBeProcessed, LangOptions LangOpts,
28-
const SourceManager &SM, bool CheckHeaderFile);
27+
std::vector<IncludeMarker> &IncludesToBeProcessed,
28+
const LangOptions &LangOpts, const SourceManager &SM,
29+
bool CheckHeaderFile);
2930

3031
void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
3132
StringRef FileName, bool IsAngled,
@@ -37,8 +38,7 @@ class IncludeModernizePPCallbacks : public PPCallbacks {
3738

3839
private:
3940
std::vector<IncludeMarker> &IncludesToBeProcessed;
40-
LangOptions LangOpts;
41-
llvm::StringMap<std::string> CStyledHeaderToCxx;
41+
llvm::StringMap<StringRef> CStyledHeaderToCxx;
4242
llvm::StringSet<> DeleteHeaders;
4343
const SourceManager &SM;
4444
bool CheckHeaderFile;
@@ -131,48 +131,35 @@ void DeprecatedHeadersCheck::check(
131131
}
132132

133133
IncludeModernizePPCallbacks::IncludeModernizePPCallbacks(
134-
std::vector<IncludeMarker> &IncludesToBeProcessed, LangOptions LangOpts,
135-
const SourceManager &SM, bool CheckHeaderFile)
136-
: IncludesToBeProcessed(IncludesToBeProcessed), LangOpts(LangOpts), SM(SM),
134+
std::vector<IncludeMarker> &IncludesToBeProcessed,
135+
const LangOptions &LangOpts, const SourceManager &SM, bool CheckHeaderFile)
136+
: IncludesToBeProcessed(IncludesToBeProcessed), SM(SM),
137137
CheckHeaderFile(CheckHeaderFile) {
138-
for (const auto &KeyValue :
139-
std::vector<std::pair<llvm::StringRef, std::string>>(
140-
{{"assert.h", "cassert"},
141-
{"complex.h", "complex"},
142-
{"ctype.h", "cctype"},
143-
{"errno.h", "cerrno"},
144-
{"float.h", "cfloat"},
145-
{"limits.h", "climits"},
146-
{"locale.h", "clocale"},
147-
{"math.h", "cmath"},
148-
{"setjmp.h", "csetjmp"},
149-
{"signal.h", "csignal"},
150-
{"stdarg.h", "cstdarg"},
151-
{"stddef.h", "cstddef"},
152-
{"stdio.h", "cstdio"},
153-
{"stdlib.h", "cstdlib"},
154-
{"string.h", "cstring"},
155-
{"time.h", "ctime"},
156-
{"wchar.h", "cwchar"},
157-
{"wctype.h", "cwctype"}})) {
158-
CStyledHeaderToCxx.insert(KeyValue);
159-
}
160-
// Add C++11 headers.
161-
if (LangOpts.CPlusPlus11) {
162-
for (const auto &KeyValue :
163-
std::vector<std::pair<llvm::StringRef, std::string>>(
164-
{{"fenv.h", "cfenv"},
165-
{"stdint.h", "cstdint"},
166-
{"inttypes.h", "cinttypes"},
167-
{"tgmath.h", "ctgmath"},
168-
{"uchar.h", "cuchar"}})) {
169-
CStyledHeaderToCxx.insert(KeyValue);
170-
}
171-
}
172-
for (const auto &Key :
173-
std::vector<std::string>({"stdalign.h", "stdbool.h", "iso646.h"})) {
174-
DeleteHeaders.insert(Key);
175-
}
138+
139+
static constexpr std::pair<StringRef, StringRef> CXX98Headers[] = {
140+
{"assert.h", "cassert"}, {"complex.h", "complex"},
141+
{"ctype.h", "cctype"}, {"errno.h", "cerrno"},
142+
{"float.h", "cfloat"}, {"limits.h", "climits"},
143+
{"locale.h", "clocale"}, {"math.h", "cmath"},
144+
{"setjmp.h", "csetjmp"}, {"signal.h", "csignal"},
145+
{"stdarg.h", "cstdarg"}, {"stddef.h", "cstddef"},
146+
{"stdio.h", "cstdio"}, {"stdlib.h", "cstdlib"},
147+
{"string.h", "cstring"}, {"time.h", "ctime"},
148+
{"wchar.h", "cwchar"}, {"wctype.h", "cwctype"},
149+
};
150+
CStyledHeaderToCxx.insert(std::begin(CXX98Headers), std::end(CXX98Headers));
151+
152+
static constexpr std::pair<StringRef, StringRef> CXX11Headers[] = {
153+
{"fenv.h", "cfenv"}, {"stdint.h", "cstdint"},
154+
{"inttypes.h", "cinttypes"}, {"tgmath.h", "ctgmath"},
155+
{"uchar.h", "cuchar"},
156+
};
157+
if (LangOpts.CPlusPlus11)
158+
CStyledHeaderToCxx.insert(std::begin(CXX11Headers), std::end(CXX11Headers));
159+
160+
static constexpr StringRef HeadersToDelete[] = {"stdalign.h", "stdbool.h",
161+
"iso646.h"};
162+
DeleteHeaders.insert_range(HeadersToDelete);
176163
}
177164

178165
void IncludeModernizePPCallbacks::InclusionDirective(
@@ -205,7 +192,7 @@ void IncludeModernizePPCallbacks::InclusionDirective(
205192
} else if (DeleteHeaders.contains(FileName)) {
206193
IncludesToBeProcessed.emplace_back(
207194
// NOLINTNEXTLINE(modernize-use-emplace) - false-positive
208-
IncludeMarker{std::string{}, FileName,
195+
IncludeMarker{StringRef{}, FileName,
209196
SourceRange{HashLoc, FilenameRange.getEnd()}, DiagLoc});
210197
}
211198
}

clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class DeprecatedHeadersCheck : public ClangTidyCheck {
4444
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
4545

4646
struct IncludeMarker {
47-
std::string Replacement;
47+
StringRef Replacement;
4848
StringRef FileName;
4949
SourceRange ReplacementRange;
5050
SourceLocation DiagLoc;

0 commit comments

Comments
 (0)