Migrate bfail/build-pass tests to bpass (1/2)

This is the subset of incremental tests that should continue to use `bpass`
even after `cpass` is supported, because they (presumably) involve codegen.
This commit is contained in:
Zalathar
2026-04-21 17:03:08 +10:00
parent 9ec5d5f32e
commit 793c646b7b
19 changed files with 131 additions and 150 deletions
@@ -2,37 +2,36 @@
// via ThinLTO and that imported thing changes while the definition of the CGU
// stays untouched.
//@ revisions: bfail1 bfail2 bfail3
//@ revisions: bpass1 bpass2 bpass3
//@ compile-flags: -Z query-dep-graph -O
//@ build-pass
//@ ignore-backends: gcc
#![feature(rustc_attrs)]
#![crate_type="rlib"]
#![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-foo",
cfg="bfail2",
cfg="bpass2",
kind="no")]
#![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-foo",
cfg="bfail3",
cfg="bpass3",
kind="pre-lto")] // Should be "post-lto", see issue #119076
#![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-bar",
cfg="bfail2",
cfg="bpass2",
kind="pre-lto")]
#![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-bar",
cfg="bfail3",
cfg="bpass3",
kind="pre-lto")] // Should be "post-lto", see issue #119076
mod foo {
// Trivial functions like this one are imported very reliably by ThinLTO.
#[cfg(bfail1)]
#[cfg(bpass1)]
pub fn inlined_fn() -> u32 {
1234
}
#[cfg(not(bfail1))]
#[cfg(not(bpass1))]
pub fn inlined_fn() -> u32 {
// See `cgu_keeps_identical_fn.rs` for why this is different
// from the other version of this function.
@@ -1,5 +1,4 @@
//@ revisions: bfail1 bfail2
//@ build-pass
//@ revisions: bpass1 bpass2
//@ ignore-backends: gcc
// rust-lang/rust#69798:
@@ -18,7 +17,7 @@ fn drop(&mut self) {
pub extern "C" fn run() {
thread_local! { pub static FOO : Foo = Foo { } ; }
#[cfg(bfail2)]
#[cfg(bpass2)]
{
FOO.with(|_f| ())
}
@@ -1,5 +1,4 @@
//@ revisions: bfail1 bfail2
//@ build-pass
//@ revisions: bpass1 bpass2
//@ ignore-backends: gcc
// rust-lang/rust#69798:
@@ -18,7 +17,7 @@ fn drop(&mut self) {
pub extern "C" fn run() {
thread_local! { pub static FOO : Foo = Foo { } ; }
#[cfg(bfail1)]
#[cfg(bpass1)]
{
FOO.with(|_f| ())
}
@@ -1,6 +1,5 @@
//@ revisions: bfail1 bfail2
//@ revisions: bpass1 bpass2
//@ compile-flags: -O -Zhuman-readable-cgu-names -Cllvm-args=-import-instr-limit=10
//@ build-pass
//@ ignore-backends: gcc
// rust-lang/rust#59535:
@@ -28,16 +27,16 @@ fn main() {
mod foo {
// In bfail1, ThinLTO decides that foo() does not get inlined into main, and
// In bpass1, ThinLTO decides that foo() does not get inlined into main, and
// instead bar() gets inlined into foo().
// In bfail2, foo() gets inlined into main.
// In bpass2, foo() gets inlined into main.
pub fn foo(){
bar()
}
// This function needs to be big so that it does not get inlined by ThinLTO
// but *does* get inlined into foo() when it is declared `internal` in
// bfail1 (alone).
// bpass1 (alone).
pub fn bar(){
println!("quux1");
println!("quux2");
@@ -55,7 +54,7 @@ mod bar {
#[inline(never)]
pub fn baz() {
#[cfg(bfail2)]
#[cfg(bpass2)]
{
crate::foo::bar();
}
@@ -1,6 +1,5 @@
//@ revisions: bfail1 bfail2
//@ revisions: bpass1 bpass2
//@ compile-flags: -O -Zhuman-readable-cgu-names -Cllvm-args=-import-instr-limit=10
//@ build-pass
//@ ignore-backends: gcc
// rust-lang/rust#59535:
@@ -38,8 +37,8 @@ fn main() {
mod foo {
// In bfail1, foo() gets inlined into main.
// In bfail2, ThinLTO decides that foo() does not get inlined into main, and
// In bpass1, foo() gets inlined into main.
// In bpass2, ThinLTO decides that foo() does not get inlined into main, and
// instead bar() gets inlined into foo(). But faulty logic in our incr.
// ThinLTO implementation thought that `main()` is unchanged and thus reused
// the object file still containing a call to the now non-existent bar().
@@ -49,7 +48,7 @@ pub fn foo(){
// This function needs to be big so that it does not get inlined by ThinLTO
// but *does* get inlined into foo() once it is declared `internal` in
// bfail2.
// bpass2.
pub fn bar(){
println!("quux1");
println!("quux2");
@@ -67,7 +66,7 @@ mod bar {
#[inline(never)]
pub fn baz() {
#[cfg(bfail1)]
#[cfg(bpass1)]
{
crate::foo::bar();
}
@@ -3,43 +3,42 @@
// ends up with any spans in its LLVM bitecode, so LLVM is able to skip
// re-building any modules which import 'inlined_fn'
//@ revisions: bfail1 bfail2 bfail3
//@ revisions: bpass1 bpass2 bpass3
//@ compile-flags: -Z query-dep-graph -O
//@ build-pass
//@ ignore-backends: gcc
#![feature(rustc_attrs)]
#![crate_type = "rlib"]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-foo",
cfg = "bfail2",
cfg = "bpass2",
kind = "pre-lto"
)]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-foo",
cfg = "bfail3",
cfg = "bpass3",
kind = "pre-lto" // Should be "post-lto", see issue #119076
)]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-bar",
cfg = "bfail2",
cfg = "bpass2",
kind = "pre-lto" // Should be "post-lto", see issue #119076
)]
#![rustc_expected_cgu_reuse(
module = "cgu_keeps_identical_fn-bar",
cfg = "bfail3",
cfg = "bpass3",
kind = "pre-lto" // Should be "post-lto", see issue #119076
)]
mod foo {
// Trivial functions like this one are imported very reliably by ThinLTO.
#[cfg(bfail1)]
#[cfg(bpass1)]
pub fn inlined_fn() -> u32 {
1234
}
#[cfg(not(bfail1))]
#[cfg(not(bpass1))]
pub fn inlined_fn() -> u32 {
1234
}
@@ -1,42 +1,41 @@
// This test checks that a change in a CGU does not invalidate an unrelated CGU
// during incremental ThinLTO.
//@ revisions: bfail1 bfail2 bfail3
//@ revisions: bpass1 bpass2 bpass3
//@ compile-flags: -Z query-dep-graph -O
//@ build-pass
//@ ignore-backends: gcc
#![feature(rustc_attrs)]
#![crate_type="rlib"]
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-foo",
cfg="bfail2",
cfg="bpass2",
kind="no")]
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-foo",
cfg="bfail3",
cfg="bpass3",
kind="pre-lto")] // Should be "post-lto", see issue #119076
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
cfg="bfail2",
cfg="bpass2",
kind="pre-lto")]
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
cfg="bfail3",
cfg="bpass3",
kind="pre-lto")] // Should be "post-lto", see issue #119076
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz",
cfg="bfail2",
cfg="bpass2",
kind="pre-lto")] // Should be "post-lto", see issue #119076
#![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz",
cfg="bfail3",
cfg="bpass3",
kind="pre-lto")] // Should be "post-lto", see issue #119076
mod foo {
#[cfg(bfail1)]
#[cfg(bpass1)]
pub fn inlined_fn() -> u32 {
1234
}
#[cfg(not(bfail1))]
#[cfg(not(bpass1))]
pub fn inlined_fn() -> u32 {
// See `cgu_keeps_identical_fn.rs` for why this is different
// from the other version of this function.