Skip to content

rustbuild: rustc_codegen_llvm is recompiled when any rustc crate is changed #54008

@arielb1

Description

@arielb1

STR

$ ../x.py test --incremental src/test/{compile-fail,ui,run-pass} Updating only changed submodules Submodules updated in 0.03 seconds Finished dev [unoptimized] target(s) in 0.24s Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 0.25s Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu) Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 0.23s Copying stage0 test from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu) Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Compiling rustc_typeck v0.0.0 (file:///home/ariel/Rust/rust-master/src/librustc_typeck) Compiling rustc_save_analysis v0.0.0 (file:///home/ariel/Rust/rust-master/src/librustc_save_analysis) Compiling rustc_privacy v0.0.0 (file:///home/ariel/Rust/rust-master/src/librustc_privacy) Compiling rustc_driver v0.0.0 (file:///home/ariel/Rust/rust-master/src/librustc_driver) Compiling rustc-main v0.0.0 (file:///home/ariel/Rust/rust-master/src/rustc) Finished release [optimized] target(s) in 24.95s Copying stage0 rustc from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu) Building stage0 codegen artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu, llvm) Compiling libc v0.2.43 Compiling rustc-demangle v0.1.9 Compiling cc v1.0.22 Compiling rustc_codegen_llvm v0.0.0 (file:///home/ariel/Rust/rust-master/src/librustc_codegen_llvm) Compiling rustc_llvm v0.0.0 (file:///home/ariel/Rust/rust-master/src/librustc_llvm) warning: In file included from /home/ariel/Rust/rust-master/src/llvm/include/llvm/CodeGen/TargetSubtargetInfo.h:22, warning: from ../rustllvm/PassWrapper.cpp:29: warning: /home/ariel/Rust/rust-master/src/llvm/include/llvm/CodeGen/SchedulerRegistry.h: In constructor ‘llvm::RegisterScheduler::RegisterScheduler(const char*, const char*, llvm::RegisterScheduler::FunctionPassCtor)’: warning: /home/ariel/Rust/rust-master/src/llvm/include/llvm/CodeGen/SchedulerRegistry.h:40:52: warning: cast between incompatible function types from ‘llvm::RegisterScheduler::FunctionPassCtor’ {aka ‘llvm::ScheduleDAGSDNodes* (*)(llvm::SelectionDAGISel*, llvm::CodeGenOpt::Level)’} to ‘llvm::MachinePassCtor’ {aka ‘void* (*)()’} [-Wcast-function-type] warning: : MachinePassRegistryNode(N, D, (MachinePassCtor)C) warning: ^ Compiling num_cpus v1.8.0 Finished release [optimized] target(s) in 1m 02s Assembling stage1 compiler (x86_64-unknown-linux-gnu) Building stage1 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) ... 

This also occurs with keep-stage0 etc.

Expected result

Changing librustc_typeck requires only the reverse dependencies of librustc_typeck to be recompiled.

Actual result

librustc_codegen_llvm is also recompiled. As you can see, this takes twice as much as compiling the reverse dependencies of librustc_typeck alone, leading to compilation being 3x slower.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-compiletimeIssue: Problems and improvements with respect to compile times.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions