Skip to content

Commit 8b51f11

Browse files
committed
Merge from 'main' to 'sycl-web' (179 commits)
2 parents 8a15845 + d92bac8 commit 8b51f11

File tree

1,114 files changed

+40927
-26398
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,114 files changed

+40927
-26398
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ if [[ "${windows_projects}" != "" ]]; then
128128
limit: 2
129129
timeout_in_minutes: 150
130130
env:
131-
CC: 'cl'
132-
CXX: 'cl'
133-
LD: 'link'
131+
MAX_PARALLEL_COMPILE_JOBS: '16'
132+
MAX_PARALLEL_LINK_JOBS: '4'
134133
commands:
135134
- 'C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64'
136135
- 'bash .ci/monolithic-windows.sh "$(echo ${windows_projects} | tr ' ' ';')" "$(echo ${windows_check_targets})"'

.ci/monolithic-windows.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ echo "--- cmake"
5050
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
5151
pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
5252

53+
export CC=cl
54+
export CXX=cl
55+
export LD=link
56+
5357
# The CMAKE_*_LINKER_FLAGS to disable the manifest come from research
5458
# on fixing a build reliability issue on the build server, please
5559
# see https://github.com/llvm/llvm-project/pull/82393 and
@@ -72,8 +76,8 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
7276
-D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \
7377
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
7478
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO" \
75-
-D LLVM_PARALLEL_COMPILE_JOBS=16 \
76-
-D LLVM_PARALLEL_LINK_JOBS=4
79+
-D LLVM_PARALLEL_COMPILE_JOBS=${MAX_PARALLEL_COMPILE_JOBS} \
80+
-D LLVM_PARALLEL_LINK_JOBS=${MAX_PARALLEL_LINK_JOBS}
7781

7882
echo "--- ninja"
7983
# Targets are not escaped as they are passed as separate arguments.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ RUN choco install -y handle
108108
109109
RUN pip3 install pywin32 buildbot-worker==2.8.4
110110
111-
ARG RUNNER_VERSION=2.321.0
111+
ARG RUNNER_VERSION=2.322.0
112112
ENV RUNNER_VERSION=$RUNNER_VERSION
113113
114114
RUN powershell -Command \

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ WORKDIR /home/gha
9696

9797
FROM ci-container as ci-container-agent
9898

99-
ENV GITHUB_RUNNER_VERSION=2.321.0
99+
ENV GITHUB_RUNNER_VERSION=2.322.0
100100

101101
RUN mkdir actions-runner && \
102102
cd actions-runner && \

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ on:
1111

1212
jobs:
1313
build:
14-
runs-on: ubuntu-24.04
14+
runs-on: ${{ matrix.os }}
1515
strategy:
1616
fail-fast: false
1717
matrix:
1818
include:
19-
- c_compiler: clang
19+
- os: ubuntu-24.04
20+
ccache-variant: sccache
21+
c_compiler: clang
22+
cpp_compiler: clang++
23+
# TODO: remove ccache logic when https://github.com/hendrikmuhs/ccache-action/issues/279 is resolved.
24+
- os: ubuntu-24.04-arm
25+
ccache-variant: ccache
26+
c_compiler: clang
2027
cpp_compiler: clang++
2128
# TODO: add back gcc build when it is fixed
2229
# - c_compiler: gcc
@@ -35,7 +42,7 @@ jobs:
3542
with:
3643
max-size: 1G
3744
key: libc_fullbuild_${{ matrix.c_compiler }}
38-
variant: sccache
45+
variant: ${{ matrix.ccache-variant }}
3946

4047
# Notice:
4148
# - MPFR is required by some of the mathlib tests.
@@ -62,8 +69,8 @@ jobs:
6269
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
6370
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
6471
-DCMAKE_BUILD_TYPE=MinSizeRel
65-
-DCMAKE_C_COMPILER_LAUNCHER=sccache
66-
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
72+
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
73+
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
6774
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }}
6875
-DLLVM_ENABLE_RUNTIMES="libc;compiler-rt"
6976
-DLLVM_LIBC_FULL_BUILD=ON

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,28 @@ jobs:
1919
include:
2020
# TODO: add linux gcc when it is fixed
2121
- os: ubuntu-24.04
22+
ccache-variant: sccache
23+
compiler:
24+
c_compiler: clang
25+
cpp_compiler: clang++
26+
# TODO: remove ccache logic when https://github.com/hendrikmuhs/ccache-action/issues/279 is resolved.
27+
- os: ubuntu-24.04-arm
28+
ccache-variant: ccache
2229
compiler:
2330
c_compiler: clang
2431
cpp_compiler: clang++
2532
- os: windows-2022
33+
ccache-variant: sccache
34+
compiler:
35+
c_compiler: clang-cl
36+
cpp_compiler: clang-cl
37+
- os: windows-2025
38+
ccache-variant: sccache
2639
compiler:
2740
c_compiler: clang-cl
2841
cpp_compiler: clang-cl
2942
- os: macos-14
43+
ccache-variant: sccache
3044
compiler:
3145
c_compiler: clang
3246
cpp_compiler: clang++
@@ -46,7 +60,7 @@ jobs:
4660
with:
4761
max-size: 1G
4862
key: libc_overlay_build_${{ matrix.os }}_${{ matrix.compiler.c_compiler }}
49-
variant: sccache
63+
variant: ${{ matrix.ccache-variant }}
5064

5165
# MPFR is required by some of the mathlib tests.
5266
- name: Prepare dependencies (Ubuntu)
@@ -82,8 +96,8 @@ jobs:
8296
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }}
8397
-DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }}
8498
-DCMAKE_BUILD_TYPE=MinSizeRel
85-
-DCMAKE_C_COMPILER_LAUNCHER=sccache
86-
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
99+
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
100+
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
87101
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW
88102
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded
89103
-DLLVM_ENABLE_RUNTIMES=libc

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,11 +1426,12 @@ class MCPlusBuilder {
14261426
}
14271427

14281428
/// Creates an indirect call to the function within the \p DirectCall PLT
1429-
/// stub. The function's memory location is pointed by the \p TargetLocation
1429+
/// stub. The function's address location is pointed by the \p TargetLocation
14301430
/// symbol.
1431+
/// Move instruction annotations from \p DirectCall to the indirect call.
14311432
virtual InstructionListType
1432-
createIndirectPltCall(const MCInst &DirectCall,
1433-
const MCSymbol *TargetLocation, MCContext *Ctx) {
1433+
createIndirectPLTCall(MCInst &&DirectCall, const MCSymbol *TargetLocation,
1434+
MCContext *Ctx) {
14341435
llvm_unreachable("not implemented");
14351436
return {};
14361437
}

bolt/lib/Passes/PLTCall.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ Error PLTCall::runOnFunctions(BinaryContext &BC) {
7070
const BinaryFunction *CalleeBF = BC.getFunctionForSymbol(CallSymbol);
7171
if (!CalleeBF || !CalleeBF->isPLTFunction())
7272
continue;
73-
const InstructionListType NewCode = BC.MIB->createIndirectPltCall(
74-
*II, CalleeBF->getPLTSymbol(), BC.Ctx.get());
73+
const InstructionListType NewCode = BC.MIB->createIndirectPLTCall(
74+
std::move(*II), CalleeBF->getPLTSymbol(), BC.Ctx.get());
7575
II = BB.replaceInstruction(II, NewCode);
7676
assert(!NewCode.empty() && "PLT Call replacement must be non-empty");
7777
std::advance(II, NewCode.size() - 1);

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,8 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
834834
/// # of this BB)
835835
/// br x0 # Indirect jump instruction
836836
///
837+
/// Return true on successful jump table instruction sequence match, false
838+
/// otherwise.
837839
bool analyzeIndirectBranchFragment(
838840
const MCInst &Inst,
839841
DenseMap<const MCInst *, SmallVector<MCInst *, 4>> &UDChain,
@@ -842,6 +844,8 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
842844
// Expect AArch64 BR
843845
assert(Inst.getOpcode() == AArch64::BR && "Unexpected opcode");
844846

847+
JumpTable = nullptr;
848+
845849
// Match the indirect branch pattern for aarch64
846850
SmallVector<MCInst *, 4> &UsesRoot = UDChain[&Inst];
847851
if (UsesRoot.size() == 0 || UsesRoot[0] == nullptr)
@@ -879,8 +883,8 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
879883
// Parsed as ADDXrs reg:x8 reg:x8 reg:x12 imm:0
880884
return false;
881885
}
882-
assert(DefAdd->getOpcode() == AArch64::ADDXrx &&
883-
"Failed to match indirect branch!");
886+
if (DefAdd->getOpcode() != AArch64::ADDXrx)
887+
return false;
884888

885889
// Validate ADD operands
886890
int64_t OperandExtension = DefAdd->getOperand(3).getImm();
@@ -897,8 +901,8 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
897901
// ldr w7, [x6]
898902
// add x6, x6, w7, sxtw => no shift amount
899903
// br x6
900-
errs() << "BOLT-WARNING: "
901-
"Failed to match indirect branch: ShiftVAL != 2 \n";
904+
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: "
905+
"failed to match indirect branch: ShiftVAL != 2\n");
902906
return false;
903907
}
904908

@@ -909,7 +913,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
909913
else if (ExtendType == AArch64_AM::SXTW)
910914
ScaleValue = 4LL;
911915
else
912-
llvm_unreachable("Failed to match indirect branch! (fragment 3)");
916+
return false;
913917

914918
// Match an ADR to load base address to be used when addressing JT targets
915919
SmallVector<MCInst *, 4> &UsesAdd = UDChain[DefAdd];
@@ -920,18 +924,15 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
920924
return false;
921925
}
922926
MCInst *DefBaseAddr = UsesAdd[1];
923-
assert(DefBaseAddr->getOpcode() == AArch64::ADR &&
924-
"Failed to match indirect branch pattern! (fragment 3)");
927+
if (DefBaseAddr->getOpcode() != AArch64::ADR)
928+
return false;
925929

926930
PCRelBase = DefBaseAddr;
927931
// Match LOAD to load the jump table (relative) target
928932
const MCInst *DefLoad = UsesAdd[2];
929-
assert(mayLoad(*DefLoad) &&
930-
"Failed to match indirect branch load pattern! (1)");
931-
assert((ScaleValue != 1LL || isLDRB(*DefLoad)) &&
932-
"Failed to match indirect branch load pattern! (2)");
933-
assert((ScaleValue != 2LL || isLDRH(*DefLoad)) &&
934-
"Failed to match indirect branch load pattern! (3)");
933+
if (!mayLoad(*DefLoad) || (ScaleValue == 1LL && !isLDRB(*DefLoad)) ||
934+
(ScaleValue == 2LL && !isLDRH(*DefLoad)))
935+
return false;
935936

936937
// Match ADD that calculates the JumpTable Base Address (not the offset)
937938
SmallVector<MCInst *, 4> &UsesLoad = UDChain[DefLoad];
@@ -941,7 +942,6 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
941942
isRegToRegMove(*DefJTBaseAdd, From, To)) {
942943
// Sometimes base address may have been defined in another basic block
943944
// (hoisted). Return with no jump table info.
944-
JumpTable = nullptr;
945945
return true;
946946
}
947947

@@ -953,24 +953,27 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
953953
// adr x12, 0x247b30 <__gettextparse+0x5b0>
954954
// add x13, x12, w13, sxth #2
955955
// br x13
956-
errs() << "BOLT-WARNING: Failed to match indirect branch: "
957-
"nop/adr instead of adrp/add \n";
956+
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: failed to match indirect branch: "
957+
"nop/adr instead of adrp/add\n");
958958
return false;
959959
}
960960

961-
assert(DefJTBaseAdd->getOpcode() == AArch64::ADDXri &&
962-
"Failed to match jump table base address pattern! (1)");
961+
if (DefJTBaseAdd->getOpcode() != AArch64::ADDXri) {
962+
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: failed to match jump table base "
963+
"address pattern! (1)\n");
964+
return false;
965+
}
963966

964967
if (DefJTBaseAdd->getOperand(2).isImm())
965968
Offset = DefJTBaseAdd->getOperand(2).getImm();
966969
SmallVector<MCInst *, 4> &UsesJTBaseAdd = UDChain[DefJTBaseAdd];
967970
const MCInst *DefJTBasePage = UsesJTBaseAdd[1];
968971
if (DefJTBasePage == nullptr || isLoadFromStack(*DefJTBasePage)) {
969-
JumpTable = nullptr;
970972
return true;
971973
}
972-
assert(DefJTBasePage->getOpcode() == AArch64::ADRP &&
973-
"Failed to match jump table base page pattern! (2)");
974+
if (DefJTBasePage->getOpcode() != AArch64::ADRP)
975+
return false;
976+
974977
if (DefJTBasePage->getOperand(1).isExpr())
975978
JumpTable = DefJTBasePage->getOperand(1).getExpr();
976979
return true;
@@ -1263,7 +1266,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
12631266
return true;
12641267
}
12651268

1266-
InstructionListType createIndirectPltCall(const MCInst &DirectCall,
1269+
InstructionListType createIndirectPLTCall(MCInst &&DirectCall,
12671270
const MCSymbol *TargetLocation,
12681271
MCContext *Ctx) override {
12691272
const bool IsTailCall = isTailCall(DirectCall);
@@ -1297,8 +1300,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
12971300
MCInst InstCall;
12981301
InstCall.setOpcode(IsTailCall ? AArch64::BR : AArch64::BLR);
12991302
InstCall.addOperand(MCOperand::createReg(AArch64::X17));
1300-
if (IsTailCall)
1301-
setTailCall(InstCall);
1303+
moveAnnotations(std::move(DirectCall), InstCall);
13021304
Code.emplace_back(InstCall);
13031305

13041306
return Code;

bolt/lib/Target/X86/X86MCPlusBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ class X86MCPlusBuilder : public MCPlusBuilder {
16051605
return true;
16061606
}
16071607

1608-
InstructionListType createIndirectPltCall(const MCInst &DirectCall,
1608+
InstructionListType createIndirectPLTCall(MCInst &&DirectCall,
16091609
const MCSymbol *TargetLocation,
16101610
MCContext *Ctx) override {
16111611
assert((DirectCall.getOpcode() == X86::CALL64pcrel32 ||

0 commit comments

Comments
 (0)