Closed nikic closed 4 days ago
Something peculiar about many of these tests is that transforms seem to create ALLOCs that are not actually referenced by MIR. Is that expected?
In terms of fixing this, the existing approach of picking constants that are endianness-independent doesn't seem very scalable. Maybe it would make sense to have a flag that disables dumping the contents of allocations? I think that for most of these tests they are not relevant (especially as the allocations are unused in the first place).
Something peculiar about many of these tests is that transforms seem to create ALLOCs that are not actually referenced by MIR. Is that expected?
This appears to be an intermediate result of the optimization process, such as: https://rust.godbolt.org/z/ohz1YMqez (tests/mir-opt/const_prop/slice_len.rs).
In terms of fixing this, the existing approach of picking constants that are endianness-independent doesn't seem very scalable. Maybe it would make sense to have a flag that disables dumping the contents of allocations? I think that for most of these tests they are not relevant (especially as the allocations are unused in the first place).
There is an option ignore-endian-big
to skip these tests, but I like another option to change the output to be uniformly little-endian.
If these tests don't actually care about the raw bytes in their UI comparisons, then they can use normalize-stderr-test
to hide the bytes. There are quite a few tests that already normalize to the string "HEX_DUMP".
Rather than trying to normalize output, I'm proposing an option in #126502 to skip the raw bytes altogether.
Huh, looks like a new instance has crept in just as the PR was merged. I'm now seeing a new test fail:
---- [mir-opt] tests/mir-opt/dataflow-const-prop/aggregate_copy.rs stdout ----
60 + }
61 +
62 + ALLOC0 (size: 8, align: 4) {
- + 05 00 00 00 03 00 00 00 │ ........
+ + 00 00 00 05 00 00 00 03 │ ........
64 }
A number of mir-opt tests fail on s390x, which is a big endian architecture. Failures for 1.79:
Some previous fixes for such failures were https://github.com/rust-lang/rust/pull/115167 and https://github.com/rust-lang/rust/pull/106046.