Skip to content

Commit 3933bd9

Browse files
authored
Merge branch 'main' into review/fix-apple-clang-localization
2 parents 61a2b3b + 60ab8c8 commit 3933bd9

File tree

1,440 files changed

+202966
-13409
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,440 files changed

+202966
-13409
lines changed

.ci/monolithic-windows.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ runtimes_targets="${4}"
2323
start-group "CMake"
2424
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
2525

26-
export CC=cl
27-
export CXX=cl
26+
export CC=C:/clang/clang-msvc/bin/clang-cl.exe
27+
export CXX=C:/clang/clang-msvc/bin/clang-cl.exe
2828
export LD=link
2929

3030
# The CMAKE_*_LINKER_FLAGS to disable the manifest come from research
@@ -49,6 +49,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
4949
-D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \
5050
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
5151
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO" \
52+
-D CMAKE_CXX_FLAGS="-Wno-c++98-compat -Wno-c++14-compat -Wno-unsafe-buffer-usage -Wno-old-style-cast" \
5253
-D LLVM_ENABLE_RUNTIMES="${runtimes}"
5354

5455
start-group "ninja"

.ci/premerge_advisor_upload.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212

1313
import generate_test_report_lib
1414

15-
PREMERGE_ADVISOR_URL = (
16-
"http://premerge-advisor.premerge-advisor.svc.cluster.local:5000/upload"
17-
)
15+
# These are IP addresses of the two premerge advisor instances. They should
16+
# eventually be updated to domain names.
17+
PREMERGE_ADVISOR_URLS = [
18+
"http://34.82.126.63:5000/upload",
19+
"http://136.114.125.23:5000/upload",
20+
]
1821

1922

2023
def main(commit_sha, workflow_run_number, build_log_files):
@@ -41,7 +44,8 @@ def main(commit_sha, workflow_run_number, build_log_files):
4144
ninja_failures = generate_test_report_lib.find_failure_in_ninja_logs(ninja_logs)
4245
for name, failure_message in ninja_failures:
4346
failure_info["failures"].append({"name": name, "message": failure_message})
44-
requests.post(PREMERGE_ADVISOR_URL, json=failure_info)
47+
for premerge_advisor_url in PREMERGE_ADVISOR_URLS:
48+
requests.post(premerge_advisor_url, json=failure_info)
4549

4650

4751
if __name__ == "__main__":

.ci/utils.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ function at-exit {
4040
fi
4141

4242
if [[ "$retcode" != "0" ]]; then
43-
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
44-
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
45-
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
4643
if [[ "$GITHUB_ACTIONS" != "" ]]; then
4744
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
4845
$(git rev-parse HEAD~1) "${BUILD_DIR}"/test-results.*.xml \
4946
"${MONOREPO_ROOT}"/ninja*.log
47+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
48+
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
49+
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
50+
else
51+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
52+
$(git rev-parse HEAD) $BUILDBOT_BUILDNUMBER \
53+
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
5054
fi
5155
fi
5256
}

.github/workflows/containers/github-action-ci-tooling/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ RUN apt-get update && \
3737
apt-get clean && \
3838
rm -rf /var/lib/apt/lists/*
3939

40+
# Create a new user with id 1001 as that is the user id that
41+
# Github Actions uses to perform the checkout action.
42+
RUN useradd gha -u 1001 -m -s /bin/bash
43+
RUN adduser gha sudo
44+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
45+
# Don't set USER gha right away because we still need to install packages
46+
# as root in 'ci-container-code-format' and 'ci-container-code-lint' containers
47+
4048

4149
FROM base AS ci-container-code-format
4250
ARG LLVM_VERSION
@@ -51,6 +59,8 @@ ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
5159
COPY llvm/utils/git/requirements_formatting.txt requirements_formatting.txt
5260
RUN pip install -r requirements_formatting.txt --break-system-packages && \
5361
rm requirements_formatting.txt
62+
USER gha
63+
WORKDIR /home/gha
5464

5565

5666
FROM base AS ci-container-code-lint
@@ -80,3 +90,5 @@ RUN apt-get update && \
8090
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
8191
RUN pip install -r requirements_linting.txt --break-system-packages && \
8292
rm requirements_linting.txt
93+
USER gha
94+
WORKDIR /home/gha

.github/workflows/pr-code-format.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ jobs:
2525
with:
2626
fetch-depth: 2
2727

28-
# We need to set the repo checkout as safe, otherwise tj-actions/changed-files
29-
# will fail due to the changed ownership inside the container.
30-
# TODO(boomanaiden154): We should probably fix this by having the default user
31-
# in the container have the same ID as the GHA user on the host.
32-
- name: Set Safe Directory
33-
run: |
34-
chown -R root $(pwd)
35-
3628
- name: Get changed files
3729
id: changed-files
3830
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5

.github/workflows/pr-code-lint.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ jobs:
3131
with:
3232
fetch-depth: 2
3333

34-
# FIXME: same as in ".github/workflows/pr-code-format.yml"
35-
- name: Set Safe Directory
36-
run: |
37-
chown -R root $(pwd)
38-
3934
- name: Get changed files
4035
id: changed-files
4136
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5

.github/workflows/release-binaries.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@ jobs:
132132
arches=arm64
133133
else
134134
arches=x86_64
135-
# Disable Flang builds on macOS x86_64. The FortranLower library takes
136-
# 2-3 hours to build on macOS, much slower than on Linux.
137-
# The long build time causes the release build to time out on x86_64,
138-
# so we need to disable flang there.
139-
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS='clang;lld;lldb;clang-tools-extra;polly;mlir'"
140135
fi
141136
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
142137
fi

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,13 +620,11 @@ class BinaryFunction {
620620
}
621621

622622
/// Return a label at a given \p Address in the function. If the label does
623-
/// not exist - create it. Assert if the \p Address does not belong to
624-
/// the function. If \p CreatePastEnd is true, then return the function
625-
/// end label when the \p Address points immediately past the last byte
626-
/// of the function.
623+
/// not exist - create it.
624+
///
627625
/// NOTE: the function always returns a local (temp) symbol, even if there's
628626
/// a global symbol that corresponds to an entry at this address.
629-
MCSymbol *getOrCreateLocalLabel(uint64_t Address, bool CreatePastEnd = false);
627+
MCSymbol *getOrCreateLocalLabel(uint64_t Address);
630628

631629
/// Register an data entry at a given \p Offset into the function.
632630
void markDataAtOffset(uint64_t Offset) {

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,13 +1035,9 @@ BinaryFunction::processIndirectBranch(MCInst &Instruction, unsigned Size,
10351035
return BranchType;
10361036
}
10371037

1038-
MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address,
1039-
bool CreatePastEnd) {
1038+
MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address) {
10401039
const uint64_t Offset = Address - getAddress();
10411040

1042-
if ((Offset == getSize()) && CreatePastEnd)
1043-
return getFunctionEndLabel();
1044-
10451041
auto LI = Labels.find(Offset);
10461042
if (LI != Labels.end())
10471043
return LI->second;
@@ -1052,6 +1048,9 @@ MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address,
10521048
return IslandSym;
10531049
}
10541050

1051+
if (Offset == getSize())
1052+
return getFunctionEndLabel();
1053+
10551054
MCSymbol *Label = BC.Ctx->createNamedTempSymbol();
10561055
Labels[Offset] = Label;
10571056

@@ -1994,7 +1993,7 @@ void BinaryFunction::postProcessJumpTables() {
19941993
if (IsBuiltinUnreachable) {
19951994
BinaryFunction *TargetBF = BC.getBinaryFunctionAtAddress(EntryAddress);
19961995
MCSymbol *Label = TargetBF ? TargetBF->getSymbol()
1997-
: getOrCreateLocalLabel(EntryAddress, true);
1996+
: getOrCreateLocalLabel(EntryAddress);
19981997
JT.Entries.push_back(Label);
19991998
continue;
20001999
}
@@ -2005,7 +2004,7 @@ void BinaryFunction::postProcessJumpTables() {
20052004
BC.getBinaryFunctionContainingAddress(EntryAddress);
20062005
MCSymbol *Label;
20072006
if (HasOneParent && TargetBF == this) {
2008-
Label = getOrCreateLocalLabel(EntryAddress, true);
2007+
Label = getOrCreateLocalLabel(EntryAddress);
20092008
} else {
20102009
const uint64_t Offset = EntryAddress - TargetBF->getAddress();
20112010
Label = Offset ? TargetBF->addEntryPointAtOffset(Offset)

bolt/lib/Passes/BinaryPasses.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,16 @@ void EliminateUnreachableBlocks::runOnFunction(BinaryFunction &Function) {
346346
uint64_t Bytes;
347347
Function.markUnreachableBlocks();
348348
LLVM_DEBUG({
349+
bool HasInvalidBB = false;
349350
for (BinaryBasicBlock &BB : Function) {
350351
if (!BB.isValid()) {
352+
HasInvalidBB = true;
351353
dbgs() << "BOLT-INFO: UCE found unreachable block " << BB.getName()
352354
<< " in function " << Function << "\n";
353-
Function.dump();
354355
}
355356
}
357+
if (HasInvalidBB)
358+
Function.dump();
356359
});
357360
BinaryContext::IndependentCodeEmitter Emitter =
358361
BC.createIndependentMCCodeEmitter();

0 commit comments

Comments
 (0)