add crate name to mir dumps
This commit is contained in:
parent
0dd362ec17
commit
86be22ebcd
7
fuckyou.rb
Normal file
7
fuckyou.rb
Normal file
@ -0,0 +1,7 @@
|
||||
Dir.glob('src/test/mir-opt/**/*.rs').each do |f|
|
||||
puts f
|
||||
t = File.read(f)
|
||||
b = File.basename(f, ".rs")
|
||||
t.gsub!(/\/\/ EMIT_MIR rustc/, "// EMIT_MIR " + b)
|
||||
File.open(f, "w") { |f| f.puts t }
|
||||
end
|
@ -177,6 +177,7 @@ fn dump_path(
|
||||
let mut file_path = PathBuf::new();
|
||||
file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir));
|
||||
|
||||
let crate_name = tcx.crate_name(source.def_id().krate);
|
||||
let item_name = tcx.def_path(source.def_id()).to_filename_friendly_no_crate();
|
||||
// All drop shims have the same DefId, so we have to add the type
|
||||
// to get unique file names.
|
||||
@ -196,7 +197,7 @@ fn dump_path(
|
||||
};
|
||||
|
||||
let file_name = format!(
|
||||
"rustc.{}{}{}{}.{}.{}.{}",
|
||||
"{}.{}{}{}{}.{}.{}.{}", crate_name,
|
||||
item_name, shim_disambiguator, promotion_id, pass_num, pass_name, disambiguator, extension,
|
||||
);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// EMIT_MIR rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
|
||||
// EMIT_MIR address_of.address_of_reborrow.SimplifyCfg-initial.after.mir
|
||||
|
||||
fn address_of_reborrow() {
|
||||
let y = &[0; 10];
|
||||
@ -37,7 +37,7 @@ fn address_of_reborrow() {
|
||||
}
|
||||
|
||||
// The normal borrows here should be preserved
|
||||
// EMIT_MIR rustc.borrow_and_cast.SimplifyCfg-initial.after.mir
|
||||
// EMIT_MIR address_of.borrow_and_cast.SimplifyCfg-initial.after.mir
|
||||
fn borrow_and_cast(mut x: i32) {
|
||||
let p = &x as *const i32;
|
||||
let q = &mut x as *const i32;
|
||||
|
@ -8,7 +8,7 @@ unsafe fn foo(z: *mut usize) -> u32 {
|
||||
}
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
|
||||
// EMIT_MIR array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
|
||||
fn main() {
|
||||
let mut x = [42, 43, 44];
|
||||
let mut y = 1;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// this tests move up progration, which is not yet implemented
|
||||
|
||||
// EMIT_MIR rustc.main.SimplifyCfg-initial.after.mir
|
||||
// EMIT_MIR basic_assignment.main.SimplifyCfg-initial.after.mir
|
||||
|
||||
// Check codegen for assignments (`a = b`) where the left-hand-side is
|
||||
// not yet initialized. Assignments tend to be absent in simple code,
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#![feature(box_syntax)]
|
||||
|
||||
// EMIT_MIR rustc.main.ElaborateDrops.before.mir
|
||||
// EMIT_MIR box_expr.main.ElaborateDrops.before.mir
|
||||
fn main() {
|
||||
let x = box S::new();
|
||||
drop(x);
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -Z mir-opt-level=0
|
||||
|
||||
// EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
|
||||
// EMIT_MIR byte_slice.main.SimplifyCfg-elaborate-drops.after.mir
|
||||
fn main() {
|
||||
let x = b"foo";
|
||||
let y = [5u8, b'x'];
|
||||
|
@ -1,5 +1,5 @@
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR rustc.norm2.InstCombine.diff
|
||||
// EMIT_MIR combine_array_len.norm2.InstCombine.diff
|
||||
|
||||
fn norm2(x: [f32; 2]) -> f32 {
|
||||
let a = x[0];
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
static Y: i32 = 42;
|
||||
|
||||
// EMIT_MIR rustc.BAR.PromoteTemps.diff
|
||||
// EMIT_MIR rustc.BAR-promoted[0].ConstProp.after.mir
|
||||
// EMIT_MIR const_promotion_extern_static.BAR.PromoteTemps.diff
|
||||
// EMIT_MIR const_promotion_extern_static.BAR-promoted[0].ConstProp.after.mir
|
||||
static mut BAR: *const &i32 = [&Y].as_ptr();
|
||||
|
||||
// EMIT_MIR rustc.FOO.PromoteTemps.diff
|
||||
// EMIT_MIR rustc.FOO-promoted[0].ConstProp.after.mir
|
||||
// EMIT_MIR const_promotion_extern_static.FOO.PromoteTemps.diff
|
||||
// EMIT_MIR const_promotion_extern_static.FOO-promoted[0].ConstProp.after.mir
|
||||
static mut FOO: *const &i32 = [unsafe { &X }].as_ptr();
|
||||
|
||||
fn main() {}
|
||||
|
@ -3,7 +3,7 @@
|
||||
static FOO: &[(Option<i32>, &[&str])] =
|
||||
&[(None, &[]), (None, &["foo", "bar"]), (Some(42), &["meh", "mop", "möp"])];
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.after.mir
|
||||
// EMIT_MIR const_allocation.main.ConstProp.after.mir
|
||||
fn main() {
|
||||
FOO;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.after.mir
|
||||
// EMIT_MIR const_allocation2.main.ConstProp.after.mir
|
||||
fn main() {
|
||||
FOO;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.after.mir
|
||||
// EMIT_MIR const_allocation3.main.ConstProp.after.mir
|
||||
fn main() {
|
||||
FOO;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR aggregate.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = (0, 1, 2).1 + 0;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR array_index.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x: u32 = [0, 1, 2, 3][2];
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR bad_op_div_by_zero.main.ConstProp.diff
|
||||
#[allow(unconditional_panic)]
|
||||
fn main() {
|
||||
let y = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR bad_op_mod_by_zero.main.ConstProp.diff
|
||||
#[allow(unconditional_panic)]
|
||||
fn main() {
|
||||
let y = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR bad_op_unsafe_oob_for_slices.main.ConstProp.diff
|
||||
#[allow(unconditional_panic)]
|
||||
fn main() {
|
||||
let a: *const [_] = &[1, 2, 3];
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -O -Zmir-opt-level=3
|
||||
|
||||
// EMIT_MIR rustc.test.ConstProp.diff
|
||||
// EMIT_MIR boolean_identities.test.ConstProp.diff
|
||||
pub fn test(x: bool, y: bool) -> bool {
|
||||
(y | true) & (x & false)
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
// Note: this test verifies that we, in fact, do not const prop `box`
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR boxes.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = *(box 42) + 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR cast.main.ConstProp.diff
|
||||
|
||||
fn main() {
|
||||
let x = 42u8 as u32;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR checked_add.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x: u32 = 1 + 1;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#[inline(never)]
|
||||
fn read(_: usize) { }
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR const_prop_fails_gracefully.main.ConstProp.diff
|
||||
fn main() {
|
||||
const FOO: &i32 = &1;
|
||||
let x = FOO as *const i32 as usize;
|
||||
|
@ -6,8 +6,8 @@ trait NeedsDrop:Sized{
|
||||
|
||||
impl<This> NeedsDrop for This{}
|
||||
|
||||
// EMIT_MIR rustc.hello.ConstProp.diff
|
||||
// EMIT_MIR rustc.hello.PreCodegen.before.mir
|
||||
// EMIT_MIR control_flow_simplification.hello.ConstProp.diff
|
||||
// EMIT_MIR control_flow_simplification.hello.PreCodegen.before.mir
|
||||
fn hello<T>(){
|
||||
if <bool>::NEEDS {
|
||||
panic!()
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Fixing either of those will allow us to const-prop this away.
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR discriminant.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = (if let Some(true) = Some(true) { 42 } else { 10 }) + 0;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR indirect.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = (2u32 as u8) + 1;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ fn encode(this: ((), u8, u8)) {
|
||||
assert!(this.2 == 0);
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR issue_66971.main.ConstProp.diff
|
||||
fn main() {
|
||||
encode(((), 0, 0));
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ fn test(this: ((u8, u8),)) {
|
||||
assert!((this.0).0 == 1);
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR issue_67019.main.ConstProp.diff
|
||||
fn main() {
|
||||
test(((1, 2),));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -O -Zmir-opt-level=3
|
||||
|
||||
// EMIT_MIR rustc.test.ConstProp.diff
|
||||
// EMIT_MIR mult_by_zero.test.ConstProp.diff
|
||||
fn test(x : i32) -> i32 {
|
||||
x * 0
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR mutable_variable.main.ConstProp.diff
|
||||
fn main() {
|
||||
let mut x = 42;
|
||||
x = 99;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR mutable_variable_aggregate.main.ConstProp.diff
|
||||
fn main() {
|
||||
let mut x = (42, 43);
|
||||
x.1 = 99;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR mutable_variable_aggregate_mut_ref.main.ConstProp.diff
|
||||
fn main() {
|
||||
let mut x = (42, 43);
|
||||
let z = &mut x;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR mutable_variable_aggregate_partial_read.main.ConstProp.diff
|
||||
fn main() {
|
||||
let mut x: (i32, i32) = foo();
|
||||
x.1 = 99;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
static mut STATIC: u32 = 42;
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR mutable_variable_no_prop.main.ConstProp.diff
|
||||
fn main() {
|
||||
let mut x = 42;
|
||||
unsafe {
|
||||
|
@ -1,6 +1,6 @@
|
||||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR mutable_variable_unprop_assign.main.ConstProp.diff
|
||||
fn main() {
|
||||
let a = foo();
|
||||
let mut x: (i32, i32) = (1, 2);
|
||||
|
@ -6,8 +6,8 @@ struct Point {
|
||||
}
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR rustc.main.SimplifyLocals.after.mir
|
||||
// EMIT_MIR optimizes_into_variable.main.ConstProp.diff
|
||||
// EMIT_MIR optimizes_into_variable.main.SimplifyLocals.after.mir
|
||||
fn main() {
|
||||
let x = 2 + 2;
|
||||
let y = [0, 1, 2, 3, 4, 5][3];
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
static FOO: u8 = 2;
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR read_immutable_static.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = FOO + FOO;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// EMIT_MIR rustc.main.PromoteTemps.diff
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR ref_deref.main.PromoteTemps.diff
|
||||
// EMIT_MIR ref_deref.main.ConstProp.diff
|
||||
|
||||
fn main() {
|
||||
*(&4);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// EMIT_MIR rustc.main.PromoteTemps.diff
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR ref_deref_project.main.PromoteTemps.diff
|
||||
// EMIT_MIR ref_deref_project.main.ConstProp.diff
|
||||
|
||||
fn main() {
|
||||
*(&(4, 5).1); // This does not currently propagate (#67862)
|
||||
|
@ -1,4 +1,4 @@
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR reify_fn_ptr.main.ConstProp.diff
|
||||
|
||||
fn main() {
|
||||
let _ = main as usize as *const fn();
|
||||
|
@ -1,7 +1,7 @@
|
||||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR repeat.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x: u32 = [42; 8][2] + 0;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
// EMIT_MIR rustc.add.ConstProp.diff
|
||||
// EMIT_MIR rustc.add.PreCodegen.before.mir
|
||||
// EMIT_MIR return_place.add.ConstProp.diff
|
||||
// EMIT_MIR return_place.add.PreCodegen.before.mir
|
||||
fn add() -> u32 {
|
||||
2 + 2
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR scalar_literal_propagation.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = 1;
|
||||
consume(x);
|
||||
|
@ -1,6 +1,6 @@
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR slice_len.main.ConstProp.diff
|
||||
fn main() {
|
||||
(&[1u32, 2, 3] as &[u32])[1];
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#[inline(never)]
|
||||
fn foo(_: i32) { }
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR rustc.main.SimplifyBranches-after-const-prop.diff
|
||||
// EMIT_MIR switch_int.main.ConstProp.diff
|
||||
// EMIT_MIR switch_int.main.SimplifyBranches-after-const-prop.diff
|
||||
fn main() {
|
||||
match 1 {
|
||||
1 => foo(0),
|
||||
|
@ -1,4 +1,4 @@
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR tuple_literal_propagation.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = (1, 2);
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
// EMIT_MIR rustc.foo.ConstProp.diff
|
||||
// EMIT_MIR const_prop_miscompile.foo.ConstProp.diff
|
||||
fn foo() {
|
||||
let mut u = (1,);
|
||||
*&mut u.0 = 5;
|
||||
let y = { u.0 } == 5;
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.bar.ConstProp.diff
|
||||
// EMIT_MIR const_prop_miscompile.bar.ConstProp.diff
|
||||
fn bar() {
|
||||
let mut v = (1,);
|
||||
unsafe {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user