Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 88d0c8e

Browse files
authored
Unrolled build for rust-lang#126502
Rollup merge of rust-lang#126502 - cuviper:dump-mir-exclude-alloc-bytes, r=estebank Ignore allocation bytes in some mir-opt tests This adds `rustc -Zdump-mir-exclude-alloc-bytes` to skip writing allocation bytes in MIR dumps, and applies it to tests that were failing on s390x due to its big-endian byte order. Fixes rust-lang#126261
2 parents c6727fc + 7c3673f commit 88d0c8e

File tree

72 files changed

+205
-390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+205
-390
lines changed

compiler/rustc_interface/src/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ fn test_unstable_options_tracking_hash() {
691691
untracked!(dump_mir, Some(String::from("abc")));
692692
untracked!(dump_mir_dataflow, true);
693693
untracked!(dump_mir_dir, String::from("abc"));
694+
untracked!(dump_mir_exclude_alloc_bytes, true);
694695
untracked!(dump_mir_exclude_pass_number, true);
695696
untracked!(dump_mir_graphviz, true);
696697
untracked!(dump_mono_stats, SwitchWithOptPath::Enabled(Some("mono-items-dir/".into())));

compiler/rustc_middle/src/mir/pretty.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,6 +1545,9 @@ impl<'a, 'tcx, Prov: Provenance, Extra, Bytes: AllocBytes> std::fmt::Display
15451545
// We are done.
15461546
return write!(w, " {{}}");
15471547
}
1548+
if tcx.sess.opts.unstable_opts.dump_mir_exclude_alloc_bytes {
1549+
return write!(w, " {{ .. }}");
1550+
}
15481551
// Write allocation bytes.
15491552
writeln!(w, " {{")?;
15501553
write_allocation_bytes(tcx, alloc, w, " ")?;

compiler/rustc_session/src/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,8 @@ options! {
16871687
(default: no)"),
16881688
dump_mir_dir: String = ("mir_dump".to_string(), parse_string, [UNTRACKED],
16891689
"the directory the MIR is dumped into (default: `mir_dump`)"),
1690+
dump_mir_exclude_alloc_bytes: bool = (false, parse_bool, [UNTRACKED],
1691+
"exclude the raw bytes of allocations when dumping MIR (used in tests) (default: no)"),
16901692
dump_mir_exclude_pass_number: bool = (false, parse_bool, [UNTRACKED],
16911693
"exclude the pass number when dumping MIR (used in tests) (default: no)"),
16921694
dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED],

tests/mir-opt/const_debuginfo.main.SingleUseConsts.diff

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,7 @@
119119
}
120120
}
121121

122-
ALLOC0 (size: 8, align: 4) {
123-
20 00 00 00 20 00 00 00 │ ... ...
124-
}
122+
ALLOC0 (size: 8, align: 4) { .. }
125123

126-
ALLOC1 (size: 4, align: 2) {
127-
01 00 63 00 │ ..c.
128-
}
124+
ALLOC1 (size: 4, align: 2) { .. }
129125

tests/mir-opt/const_debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ test-mir-pass: SingleUseConsts
2-
//@ compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN
2+
//@ compile-flags: -C overflow-checks=no -Zmir-enable-passes=+GVN -Zdump-mir-exclude-alloc-bytes
33

44
#![allow(unused)]
55

tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@
4444
StorageDead(_2);
4545
return;
4646
}
47-
+ }
48-
+
49-
+ ALLOC0 (size: 8, align: 4) {
50-
+ 01 00 00 00 00 __ __ __ │ .....░░░
5147
}
48+
+
49+
+ ALLOC0 (size: 8, align: 4) { .. }
5250

tests/mir-opt/const_prop/address_of_pair.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ test-mir-pass: GVN
2+
//@ compile-flags: -Zdump-mir-exclude-alloc-bytes
23

34
// EMIT_MIR address_of_pair.fn0.GVN.diff
45
pub fn fn0() -> bool {

tests/mir-opt/const_prop/checked_add.main.GVN.panic-abort.diff

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
StorageDead(_1);
2525
return;
2626
}
27-
+ }
28-
+
29-
+ ALLOC0 (size: 8, align: 4) {
30-
+ 02 00 00 00 00 __ __ __ │ .....░░░
3127
}
28+
+
29+
+ ALLOC0 (size: 8, align: 4) { .. }
3230

tests/mir-opt/const_prop/checked_add.main.GVN.panic-unwind.diff

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
StorageDead(_1);
2525
return;
2626
}
27-
+ }
28-
+
29-
+ ALLOC0 (size: 8, align: 4) {
30-
+ 02 00 00 00 00 __ __ __ │ .....░░░
3127
}
28+
+
29+
+ ALLOC0 (size: 8, align: 4) { .. }
3230

tests/mir-opt/const_prop/checked_add.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
22
//@ test-mir-pass: GVN
3-
//@ compile-flags: -C overflow-checks=on
3+
//@ compile-flags: -C overflow-checks=on -Zdump-mir-exclude-alloc-bytes
44

55
// EMIT_MIR checked_add.main.GVN.diff
66
fn main() {

0 commit comments

Comments
 (0)