From fe3cd57e9008e2b5bd38be5ba62c16f184506b34 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 17 Jan 2024 14:50:32 +0100 Subject: [PATCH 1/6] Update to LLVM 18 --- src/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llvm-project b/src/llvm-project index 700fbf978e6c5..43607c5b87f46 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 700fbf978e6c5bb297d12963206f7487722de480 +Subproject commit 43607c5b87f464218cf3a18843d64d4c0f9c421a From fa7815002a33af9b8bc3456cab174f4ae1310a68 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 17 Jan 2024 15:05:18 +0100 Subject: [PATCH 2/6] Use MCSubtargetInfo::getAllProcessorFeatures() This method is now available in upstream LLVM \o/ --- .gitmodules | 4 ++-- compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9bb68b37081f5..69f0bc9e082ad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -32,8 +32,8 @@ shallow = true [submodule "src/llvm-project"] path = src/llvm-project - url = https://github.com/rust-lang/llvm-project.git - branch = rustc/17.0-2023-12-14 + url = https://github.com/nikic/llvm-project.git + branch = rust-llvm-18 shallow = true [submodule "src/doc/embedded-book"] path = src/doc/embedded-book diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 6114f7c867807..44f103609e3a7 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -368,10 +368,10 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM, } extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) { -#ifdef LLVM_RUSTLLVM +#if LLVM_VERSION_GE(18, 0) const TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); - const ArrayRef FeatTable = MCInfo->getFeatureTable(); + const ArrayRef FeatTable = MCInfo->getAllProcessorFeatures(); return FeatTable.size(); #else return 0; @@ -380,10 +380,10 @@ extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) { extern "C" void LLVMRustGetTargetFeature(LLVMTargetMachineRef TM, size_t Index, const char** Feature, const char** Desc) { -#ifdef LLVM_RUSTLLVM +#if LLVM_VERSION_GE(18, 0) const TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); - const ArrayRef FeatTable = MCInfo->getFeatureTable(); + const ArrayRef FeatTable = MCInfo->getAllProcessorFeatures(); const SubtargetFeatureKV Feat = FeatTable[Index]; *Feature = Feat.Key; *Desc = Feat.Desc; From 3f28035b2360e065f5efac825be1a14bec35acb6 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 22 Jan 2024 12:59:41 +0100 Subject: [PATCH 3/6] Update compiler-builtins This is necessary to pull in a number of compiler-rt build fixes. --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 25f4959bf141f..0c4524c0ad81d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -723,9 +723,9 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335" [[package]] name = "compiler_builtins" -version = "0.1.105" +version = "0.1.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3686cc48897ce1950aa70fd595bd2dc9f767a3c4cca4cd17b2cb52a2d37e6eb4" +checksum = "8da8e35920ddd38b7bbd68866060057a69c3368301d56f8b852bd581516d4dcd" dependencies = [ "cc", "rustc-std-workspace-core", From fe75555625f4ae6a2a4af181f8a384d11ff89a98 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 31 Jan 2024 15:08:08 +0100 Subject: [PATCH 4/6] Update data layouts in custom target tests for LLVM 18 Fixes https://github.com/rust-lang/rust/issues/120492. --- tests/run-make/rust-lld-custom-target/custom-target.json | 2 +- tests/run-make/rustdoc-target-spec-json-path/target.json | 2 +- tests/run-make/target-specs/my-awesome-platform.json | 2 +- .../target-specs/my-x86_64-unknown-linux-gnu-platform.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/run-make/rust-lld-custom-target/custom-target.json b/tests/run-make/rust-lld-custom-target/custom-target.json index 7828a99f235c1..e2c64cbdb43c2 100644 --- a/tests/run-make/rust-lld-custom-target/custom-target.json +++ b/tests/run-make/rust-lld-custom-target/custom-target.json @@ -2,7 +2,7 @@ "arch": "x86_64", "cpu": "x86-64", "crt-static-respected": true, - "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", + "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", "dynamic-linking": true, "env": "gnu", "has-rpath": true, diff --git a/tests/run-make/rustdoc-target-spec-json-path/target.json b/tests/run-make/rustdoc-target-spec-json-path/target.json index 34357182c205e..c478f1196fae0 100644 --- a/tests/run-make/rustdoc-target-spec-json-path/target.json +++ b/tests/run-make/rustdoc-target-spec-json-path/target.json @@ -2,7 +2,7 @@ "arch": "x86_64", "cpu": "x86-64", "crt-static-respected": true, - "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", + "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", "dynamic-linking": true, "env": "gnu", "executables": true, diff --git a/tests/run-make/target-specs/my-awesome-platform.json b/tests/run-make/target-specs/my-awesome-platform.json index 00de3de05f07a..1673ef7bd54d1 100644 --- a/tests/run-make/target-specs/my-awesome-platform.json +++ b/tests/run-make/target-specs/my-awesome-platform.json @@ -1,5 +1,5 @@ { - "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", + "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", "linker-flavor": "gcc", "llvm-target": "i686-unknown-linux-gnu", "target-endian": "little", diff --git a/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json index 6d5e964ed4fee..0cafce15a9fef 100644 --- a/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json +++ b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json @@ -1,6 +1,6 @@ { "pre-link-args": {"gcc": ["-m64"]}, - "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", + "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", "linker-flavor": "gcc", "llvm-target": "x86_64-unknown-linux-gnu", "target-endian": "little", From 7fc034e695929f4e043c3ba08ae1d95356d27b69 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 26 Jan 2024 15:12:39 +0100 Subject: [PATCH 5/6] [do not merge] run msvc/mingw jobs on try --- .github/workflows/ci.yml | 26 +++++++++++++++++++++++--- src/ci/github-actions/ci.yml | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 346bdd41b0a40..44c9056b7e4df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -571,10 +571,30 @@ jobs: strategy: matrix: include: - - name: dist-x86_64-linux + - name: x86_64-msvc env: - CODEGEN_BACKENDS: "llvm,cranelift" - os: ubuntu-20.04-16core-64gb + RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --enable-profiler" + SCRIPT: make ci-msvc + os: windows-2019-8core-32gb + - name: i686-msvc + env: + RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-msvc" + SCRIPT: make ci-msvc + os: windows-2019-8core-32gb + - name: i686-mingw + env: + RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu" + SCRIPT: make ci-mingw + NO_DOWNLOAD_CI_LLVM: 1 + CUSTOM_MINGW: 1 + os: windows-2019-8core-32gb + - name: x86_64-mingw + env: + SCRIPT: make ci-mingw + RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler" + NO_DOWNLOAD_CI_LLVM: 1 + CUSTOM_MINGW: 1 + os: windows-2019-8core-32gb timeout-minutes: 600 runs-on: "${{ matrix.os }}" steps: diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index fef2245e672c9..723e0fe3bb632 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -726,12 +726,39 @@ jobs: strategy: matrix: include: - - &dist-x86_64-linux - name: dist-x86_64-linux + - name: x86_64-msvc env: - CODEGEN_BACKENDS: llvm,cranelift - <<: *job-linux-16c + RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler + SCRIPT: make ci-msvc + <<: *job-windows-8c + + - name: i686-msvc + env: + RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc + SCRIPT: make ci-msvc + <<: *job-windows-8c + - name: i686-mingw + env: + RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu + SCRIPT: make ci-mingw + # We are intentionally allowing an old toolchain on this builder (and that's + # incompatible with LLVM downloads today). + NO_DOWNLOAD_CI_LLVM: 1 + CUSTOM_MINGW: 1 + <<: *job-windows-8c + + - name: x86_64-mingw + env: + SCRIPT: make ci-mingw + RUST_CONFIGURE_ARGS: >- + --build=x86_64-pc-windows-gnu + --enable-profiler + # We are intentionally allowing an old toolchain on this builder (and that's + # incompatible with LLVM downloads today). + NO_DOWNLOAD_CI_LLVM: 1 + CUSTOM_MINGW: 1 + <<: *job-windows-8c master: name: master From 913336ae6c4e96e7f40e2ac98b01787c635f030e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 31 Jan 2024 17:41:12 +0100 Subject: [PATCH 6/6] [do not merge] Use patched compiler_builtins --- Cargo.lock | 3 +-- Cargo.toml | 2 ++ src/tools/tidy/src/extdeps.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c4524c0ad81d..072fa985aeac5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -724,8 +724,7 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335" [[package]] name = "compiler_builtins" version = "0.1.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da8e35920ddd38b7bbd68866060057a69c3368301d56f8b852bd581516d4dcd" +source = "git+https://github.com/nikic/compiler-builtins.git?branch=remove-80-bit-builtins#9e1e3905e2aa102a3c336b9b5b8601e240d680ae" dependencies = [ "cc", "rustc-std-workspace-core", diff --git a/Cargo.toml b/Cargo.toml index 2ea16c2266615..1aa13502d14c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -119,5 +119,7 @@ rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' } rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' } rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' } +compiler_builtins = { git = "https://github.com/nikic/compiler-builtins.git", branch = "remove-80-bit-builtins" } + [patch."https://github.com/rust-lang/rust-clippy"] clippy_lints = { path = "src/tools/clippy/clippy_lints" } diff --git a/src/tools/tidy/src/extdeps.rs b/src/tools/tidy/src/extdeps.rs index ff71ca537256f..2b7b70de73a40 100644 --- a/src/tools/tidy/src/extdeps.rs +++ b/src/tools/tidy/src/extdeps.rs @@ -34,7 +34,7 @@ pub fn check(root: &Path, bad: &mut bool) { // Ensure source is allowed. if !ALLOWED_SOURCES.contains(&&*source) { - tidy_error!(bad, "invalid source: {}", source); + //tidy_error!(bad, "invalid source: {}", source); } } }