Skip to content

Instantly share code, notes, and snippets.

@pnkfelix
Created December 4, 2019 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pnkfelix/8a5870135def2f6c46bbd37feed70e2c to your computer and use it in GitHub Desktop.
Save pnkfelix/8a5870135def2f6c46bbd37feed70e2c to your computer and use it in GitHub Desktop.
// ignore-tidy-linelength
// no-prefer-dynamic
// revisions: cfail1 cfail2 cfail3
// compile-flags: -Z query-dep-graph -O
// build-pass (FIXME(62277): could be check-pass?)
#![feature(rustc_attrs)]
// #![no_std]
// #![crate_type="rlib"]
#![crate_type="bin"]
// #![rustc_expected_cgu_reuse(module="explore-foo",
// cfg="cfail2",
// kind="no")]
// #![rustc_expected_cgu_reuse(module="explore-foo",
// cfg="cfail3",
// kind="post-lto")]
//
// #![rustc_expected_cgu_reuse(module="explore-bar",
// cfg="cfail2",
// kind="pre-lto")]
// #![rustc_expected_cgu_reuse(module="explore-bar",
// cfg="cfail3",
// kind="post-lto")]
// macro_rules! impls_4 { () => { impl Foo { } impl Foo { } impl Foo { } impl Foo { } } }
// macro_rules! impls_16 { () => { impls_4!(); impls_4!(); impls_4!(); impls_4!(); } }
// macro_rules! impls_64 { () => { impls_16!(); impls_16!(); impls_16!(); impls_16!(); } }
mod leaf_n {
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
}
mod leaf_v {
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
}
mod leaf_n2n {
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
pub fn _n2n(_x: u32) -> u32 { f_non_volatile(10) }
}
mod leaf_n2v {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
pub fn _n2v(_x: u32) -> u32 { f_volatile(_x) }
}
mod leaf_v2n {
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
pub fn _v2n<T>(_x: T) -> u32 { f_non_volatile(10) }
}
mod leaf_v2v {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
pub fn _v2v<T>(_x: T) -> u32 { f_volatile(_x) }
}
mod leaf_nv2n {
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
pub fn _n2n(_x: u32) -> u32 { f_non_volatile(10) }
pub fn _v2n<T>(_x: T) -> u32 { f_non_volatile(10) }
}
mod leaf_nv2v {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
pub fn _n2v(_x: u32) -> u32 { f_volatile(_x) }
pub fn _v2v<T>(_x: T) -> u32 { f_volatile(_x) }
}
mod leaf_n2v_v2n {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
pub fn _n2v(_x: u32) -> u32 { f_volatile(_x) }
pub fn _v2n<T>(_x: T) -> u32 { f_non_volatile(10) }
}
mod leaf_n2n2n {
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
fn _middle_nonvol_to_nonvol(_x: u32) -> u32 { f_non_volatile(10) }
pub fn _n2n2n(_x: u32) -> u32 { _middle_nonvol_to_nonvol(_x) }
}
mod leaf_n2n2v {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
fn _middle_nonvol_to_vol(_x: u32) -> u32 { f_volatile(_x) }
pub fn _n2n2v(_x: u32) -> u32 { _middle_nonvol_to_vol(_x) }
}
mod leaf_n2v2n {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
fn _middle_vol_to_non_vol<T>(_x: T) -> u32 { f_non_volatile(10) }
pub fn _n2v2n(_x: u32) -> u32 { _middle_vol_to_non_vol(_x) }
}
mod leaf_n2v2v {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
/// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
fn _middle_vol_to_vol<T>(_x: T) -> u32 { f_volatile(_x) }
pub fn _n2v2v(_x: u32) -> u32 { _middle_vol_to_vol(_x) }
}
mod leaf_v2n2n {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
fn _middle_non_vol_to_non_vol(_x: u32) -> u32 { f_non_volatile(10) }
pub fn _v2n2n<T>(_x: T) -> u32 { _middle_non_vol_to_non_vol(10u32) }
}
mod leaf_v2n2v {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
fn _middle_non_vol_to_vol(_x: u32) -> u32 { f_volatile(_x) }
pub fn _v2n2v<T>(_x: T) -> u32 { _middle_non_vol_to_vol(10u32) }
}
mod leaf_v2v2n {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
fn _middle_vol_to_non_vol<T>(_x: T) -> u32 { f_non_volatile(10) }
pub fn _v2v2n(_x: u32) -> u32 { _middle_vol_to_non_vol(_x) }
}
mod leaf_v2v2v {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { 1234 }
// In revision cfail1, this is exported (since it is called from `mod unrelated`).
// In revision cfail2, this is marked internal (since it is now only called from `mod leaf` itself).
#[inline(never)]
pub fn f_volatile<T>(_x: T) -> u32 { 1234 }
pub fn _unrelated_fn(_x: u32) -> u32 { 10 }
// pub fn _unrelated_fn(_x: u32) -> u32 { f_non_volatile(10) + f_volatile(_x) }
fn _middle_vol_to_vol<T>(_x: T) -> u32 { f_volatile(_x) }
pub fn _v2v2v(_x: u32) -> u32 { _middle_vol_to_vol(_x) }
}
mod unrelated {
#[cfg(cfail1)]
pub fn _unrelated_fn() -> u32 {
crate::leaf_n::f_non_volatile(10); crate::leaf_v::f_volatile(10_u32);
crate::leaf_n2n::f_non_volatile(10); crate::leaf_n2v::f_volatile(10_u32);
crate::leaf_n2n::_unrelated_fn(10_u32); crate::leaf_n2v::_unrelated_fn(10_u32);
crate::leaf_v2n::f_non_volatile(10); crate::leaf_v2v::f_volatile(10_u32);
crate::leaf_v2n::_unrelated_fn(10_u32); crate::leaf_v2v::_unrelated_fn(10_u32);
crate::leaf_nv2n::f_non_volatile(10); crate::leaf_nv2v::f_volatile(10_u32);
crate::leaf_nv2n::_unrelated_fn(10_u32); crate::leaf_nv2v::_unrelated_fn(10_u32);
crate::leaf_n2v_v2n::f_non_volatile(10); crate::leaf_n2v_v2n::f_volatile(10_u32);
crate::leaf_n2v_v2n::_unrelated_fn(10_u32); crate::leaf_n2v_v2n::_unrelated_fn(10_u32);
crate::leaf_n2n2n::f_non_volatile(10); crate::leaf_n2n2n::f_volatile(10_u32);
crate::leaf_n2n2n::_unrelated_fn(10_u32);
crate::leaf_n2n2v::f_non_volatile(10); crate::leaf_n2n2v::f_volatile(10_u32);
crate::leaf_n2n2v::_unrelated_fn(10_u32);
crate::leaf_n2v2n::f_non_volatile(10); crate::leaf_n2v2n::f_volatile(10_u32);
crate::leaf_n2v2n::_unrelated_fn(10_u32);
crate::leaf_n2v2v::f_non_volatile(10); crate::leaf_n2v2v::f_volatile(10_u32);
crate::leaf_n2v2v::_unrelated_fn(10_u32);
crate::leaf_v2n2n::f_non_volatile(10); crate::leaf_v2n2n::f_volatile(10_u32);
crate::leaf_v2n2n::_unrelated_fn(10_u32);
crate::leaf_v2n2v::f_non_volatile(10); crate::leaf_v2n2v::f_volatile(10_u32);
crate::leaf_v2n2v::_unrelated_fn(10_u32);
crate::leaf_v2v2n::f_non_volatile(10); crate::leaf_v2v2n::f_volatile(10_u32);
crate::leaf_v2v2n::_unrelated_fn(10_u32);
crate::leaf_v2v2v::f_non_volatile(10); crate::leaf_v2v2v::f_volatile(10_u32);
crate::leaf_v2v2v::_unrelated_fn(10_u32);
1234
}
#[cfg(not(cfail1))]
pub fn _unrelated_fn() -> u32 {
1234
}
}
pub mod l_n {
#[inline(never)]
pub fn f_non_volatile(_x: u32) -> u32 { crate::leaf_n::f_non_volatile(10) }
}
pub mod l_v {
#[inline(never)]
pub fn f_volatile(_x: u32) -> u32 { crate::leaf_v::f_volatile(10_u32) }
}
pub mod l_n2n {
#[inline(never)]
pub fn n2n(_x: u32) -> u32 { crate::leaf_n2n::_n2n(10u32) }
}
pub mod l_n2v {
#[inline(never)]
pub fn n2v(_x: u32) -> u32 { crate::leaf_n2v::_n2v(10_u32) }
}
pub mod l_v2n {
#[inline(never)]
pub fn v2n(_x: u32) -> u32 { crate::leaf_v2n::_v2n(10u32) }
}
pub mod l_v2v {
#[inline(never)]
pub fn v2v(_x: u32) -> u32 { crate::leaf_v2v::_v2v(10_u32) }
}
pub mod l_nv2n_n2n {
#[inline(never)]
pub fn n2n(_x: u32) -> u32 { crate::leaf_nv2n::_n2n(10u32) }
}
pub mod l_nv2n_v2n {
#[inline(never)]
pub fn v2n(_x: u32) -> u32 { crate::leaf_nv2n::_v2n(10_u32) }
}
pub mod l_nv2v_n2v {
#[inline(never)]
pub fn n2v(_x: u32) -> u32 { crate::leaf_nv2v::_n2v(10u32) }
}
pub mod l_nv2v_v2v {
#[inline(never)]
pub fn v2v(_x: u32) -> u32 { crate::leaf_nv2v::_v2v(10_u32) }
}
pub mod l_n2v_v2n_n2v {
#[inline(never)]
pub fn n2v(_x: u32) -> u32 { crate::leaf_n2v_v2n::_n2v(10u32) }
}
pub mod l_n2v_v2n_v2n {
#[inline(never)]
pub fn v2n(_x: u32) -> u32 { crate::leaf_n2v_v2n::_v2n(10_u32) }
}
pub mod l_n2n2n {
#[inline(never)]
pub fn n2n2n(_x: u32) -> u32 { crate::leaf_n2n2n::_n2n2n(10u32) }
}
pub mod l_n2n2v {
#[inline(never)]
pub fn n2n2v(_x: u32) -> u32 { crate::leaf_n2n2v::_n2n2v(10u32) }
}
pub mod l_n2v2n {
#[inline(never)]
pub fn n2v2n(_x: u32) -> u32 { crate::leaf_n2v2n::_n2v2n(10_u32) }
}
pub mod l_n2v2v {
#[inline(never)]
pub fn n2v2v(_x: u32) -> u32 { crate::leaf_n2v2v::_n2v2v(10_u32) }
}
pub mod l_v2n2n {
#[inline(never)]
pub fn v2n2n(_x: u32) -> u32 { crate::leaf_v2n2n::_v2n2n(10_u32) }
}
pub mod l_v2n2v {
#[inline(never)]
pub fn v2n2v(_x: u32) -> u32 { crate::leaf_v2n2v::_v2n2v(10_u32) }
}
pub mod l_v2v2n {
#[inline(never)]
pub fn v2v2n(_x: u32) -> u32 { crate::leaf_v2v2n::_v2v2n(10_u32) }
}
pub mod l_v2v2v {
#[inline(never)]
pub fn v2v2v(_x: u32) -> u32 { crate::leaf_v2v2v::_v2v2v(10_u32) }
}
pub mod outermost_1 {
#[inline(never)]
pub fn caller() -> u32 {
crate::l_n::f_non_volatile(10) + crate::l_v::f_volatile(10_u32) +
crate::l_n2n::n2n(10u32) + crate::l_n2v::n2v(10_u32) +
crate::l_v2n::v2n(10u32) + crate::l_v2v::v2v(10_u32) +
crate::l_nv2n_n2n::n2n(10u32) + crate::l_nv2n_v2n::v2n(10_u32) +
crate::l_nv2v_n2v::n2v(10u32) + crate::l_nv2v_v2v::v2v(10_u32) +
crate::l_n2v_v2n_n2v::n2v(10u32) + crate::l_n2v_v2n_v2n::v2n(10_u32) +
crate::l_n2n2n::n2n2n(10u32) + crate::l_n2n2v::n2n2v(10u32) +
crate::l_n2v2n::n2v2n(10_u32) + crate::l_n2v2v::n2v2v(10_u32) +
crate::l_v2n2n::v2n2n(10_u32) + crate::l_v2n2v::v2n2v(10_u32) +
crate::l_v2v2n::v2v2n(10_u32) + crate::l_v2v2v::v2v2v(10_u32)
}
}
pub mod outermost_2 {
pub fn f_outermost_call_unrelated() {
crate::unrelated::_unrelated_fn();
}
}
pub fn main() {
outermost_1::caller();
outermost_2::f_outermost_call_unrelated();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment