From cbae95602f093b56ce7ed1910848553ef893486e Mon Sep 17 00:00:00 2001 From: Eduard Stefes Date: Mon, 20 Oct 2025 22:56:42 +0200 Subject: [PATCH] Fix tests for big-endian The tests fail on s390x and presumably other big-endian systems, due to check of raw alloc values in the MIR output. To fix the tests remove the raw bytes from the MIR output (via: compile-flags: -Zdump-mir-exclude-alloc-bytes) and update the matching diffs. --- .../const_prop/invalid_constant.main.GVN.diff | 14 ++++---------- tests/mir-opt/const_prop/invalid_constant.rs | 2 +- tests/mir-opt/const_prop/union.main.GVN.diff | 6 ++---- tests/mir-opt/const_prop/union.rs | 2 +- tests/mir-opt/gvn_loop.loop_deref_mut.GVN.diff | 6 ++---- tests/mir-opt/gvn_loop.rs | 1 + 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff index a4900a1ac72ea..20923d0352cd5 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff @@ -61,17 +61,11 @@ StorageDead(_1); return; } -+ } + } + -+ ALLOC0 (size: 4, align: 4) { -+ 00 00 00 00 │ .... -+ } ++ ALLOC0 (size: 4, align: 4) { .. } + -+ ALLOC1 (size: 4, align: 4) { -+ 04 00 00 00 │ .... -+ } ++ ALLOC1 (size: 4, align: 4) { .. } + -+ ALLOC2 (size: 4, align: 4) { -+ 01 00 11 00 │ .... - } ++ ALLOC2 (size: 4, align: 4) { .. } diff --git a/tests/mir-opt/const_prop/invalid_constant.rs b/tests/mir-opt/const_prop/invalid_constant.rs index b59103792bfc4..901c3721d9238 100644 --- a/tests/mir-opt/const_prop/invalid_constant.rs +++ b/tests/mir-opt/const_prop/invalid_constant.rs @@ -1,6 +1,6 @@ // skip-filecheck //@ test-mir-pass: GVN -//@ compile-flags: -Zmir-enable-passes=+RemoveZsts +//@ compile-flags: -Zmir-enable-passes=+RemoveZsts -Zdump-mir-exclude-alloc-bytes // Verify that we can pretty print invalid constants. #![feature(adt_const_params, unsized_const_params)] diff --git a/tests/mir-opt/const_prop/union.main.GVN.diff b/tests/mir-opt/const_prop/union.main.GVN.diff index 16a0432ab9013..4212a44d0a0de 100644 --- a/tests/mir-opt/const_prop/union.main.GVN.diff +++ b/tests/mir-opt/const_prop/union.main.GVN.diff @@ -34,9 +34,7 @@ StorageDead(_1); return; } -+ } -+ -+ ALLOC0 (size: 4, align: 4) { -+ 01 00 00 00 │ .... } ++ ++ ALLOC0 (size: 4, align: 4) { .. } diff --git a/tests/mir-opt/const_prop/union.rs b/tests/mir-opt/const_prop/union.rs index 9f197a1a58338..fb822ff28b2d3 100644 --- a/tests/mir-opt/const_prop/union.rs +++ b/tests/mir-opt/const_prop/union.rs @@ -1,6 +1,6 @@ //! Tests that we can propagate into places that are projections into unions //@ test-mir-pass: GVN -//@ compile-flags: -Zinline-mir +//@ compile-flags: -Zinline-mir -Zdump-mir-exclude-alloc-bytes fn val() -> u32 { 1 diff --git a/tests/mir-opt/gvn_loop.loop_deref_mut.GVN.diff b/tests/mir-opt/gvn_loop.loop_deref_mut.GVN.diff index 92e5ccabedf9e..e5d719cf3ca99 100644 --- a/tests/mir-opt/gvn_loop.loop_deref_mut.GVN.diff +++ b/tests/mir-opt/gvn_loop.loop_deref_mut.GVN.diff @@ -107,9 +107,7 @@ StorageDead(_11); goto -> bb4; } -+ } -+ -+ ALLOC0 (size: 8, align: 4) { -+ 01 00 00 00 __ __ __ __ │ ....░░░░ } ++ ++ ALLOC0 (size: 8, align: 4) { .. } diff --git a/tests/mir-opt/gvn_loop.rs b/tests/mir-opt/gvn_loop.rs index 6e9df55a968dc..4a94d516cca23 100644 --- a/tests/mir-opt/gvn_loop.rs +++ b/tests/mir-opt/gvn_loop.rs @@ -1,4 +1,5 @@ //@ test-mir-pass: GVN +//@ compile-flags: -Zdump-mir-exclude-alloc-bytes #![crate_type = "lib"] #![feature(core_intrinsics, rustc_attrs)]