Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore mir tests on big-endian #77413

Closed
wants to merge 1 commit into from

Conversation

infinity0
Copy link
Contributor

Other mir tests are already ignored on big-endian, e.g. const_allocation*.rs

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 1, 2020
@camelid camelid added A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-testsuite Area: The testsuite used to check the correctness of rustc labels Oct 1, 2020
+ // ty::Const
+ // + ty: (u32, u32)
+ // + val: Value(ByRef { alloc: Allocation { bytes: [1, 0, 0, 0, 2, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } })
+ // mir::Constant
+ // + span: $DIR/tuple_literal_propagation.rs:5:13: 5:14
+ // + span: $DIR/tuple_literal_propagation.rs:6:13: 6:14
+ // + literal: Const { ty: (u32, u32), val: Value(ByRef { alloc: Allocation { bytes: [1, 0, 0, 0, 2, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a "significant" diff -- i.e., not just line numbers changing. Maybe a bug in how github is showing it or a rebase error?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just line numbers changing AFAICT. Diffs of diffs are hard to parse for me also.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things like these can be avoided by adding new comment lines in existing empty lines or just adding them at the end of the file. We have no policy on this though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is just line numbers changing - the existing file didn't have an empty line to fit a comment into, and I thought putting it at the end of the file would be inconsistent with everything else.

@Mark-Simulacrum
Copy link
Member

I assume these are failing on big endian platforms?

I think the const allocation ones are ignored because the output contains printed allocations (e.g.,

0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc8──╼ 00 00 00 00 │ ....░░░░╾──╼....
0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc12─╼ 02 00 00 00 │ ....░░░░╾──╼....
0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc19─╼ 03 00 00 00 │ ....*...╾──╼....
) which are not normalized to a particular endian-ness currently (probably no need to do so either).

But the tests here, aside from the one comment I left, don't seem to contain such allocations. I am a bit worried that we could accidentally mask some real difference in const prop or whatever on big endian systems. If we expect to just ignore all of the MIR tests then maybe doing that in compiletest makes more sense.

cc @oli-obk @ecstatic-morse (not sure who all to cc on const prop/MIR, would be good to get a team)

@ecstatic-morse
Copy link
Contributor

cc @rust-lang/wg-mir-opt

@ecstatic-morse
Copy link
Contributor

ecstatic-morse commented Oct 3, 2020

@infinity0 It's helpful to reviewers to give some motivation for a PR. I assume you're running on a big-endian system and that these tests are failing due to blessed MIR like:

+         _1 = const (4_u32, false);       // scope 0 at $DIR/return_place.rs:6:5: 6:10
+                                          // ty::Const
+                                          // + ty: (u32, bool)
+                                          // + val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [31], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } })
+                                          // mir::Constant
+                                          // + span: $DIR/return_place.rs:6:5: 6:10
+                                          // + literal: Const { ty: (u32, bool), val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [31], len: Size { raw: 8 } }, size: Size { raw: 8 }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) }

Do we not have any big-endian systems on CI? Normally I would request that we normalize MIR dumps across different systems, but this is a) kind of hard and b) not the precedent (as you note in the OP). I defer to Oli on this one.

r? @oli-obk

@@ -1,3 +1,4 @@
// ignore-endian-big
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of ignoring this test we should add tuples and arrays to the "don't verbosely print the constant" list if all tuple fields or the array element type are on the "don't verbosely print constants of this type" list.

@@ -1,5 +1,5 @@
// compile-flags: -O

// ignore-endian-big
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is odd, so I think it's ok to ignore here

@oli-obk
Copy link
Contributor

oli-obk commented Oct 5, 2020

So imo only src/test/mir-opt/const_prop/mutable_variable_no_prop.rs should be ignored, everything else can be fixed

@infinity0
Copy link
Contributor Author

we should add tuples and arrays to the "don't verbosely print the constant" list if all tuple fields or the array element type are on the "don't verbosely print constants of this type" list.

Shall I file an issue for this then? I'm not sufficiently involved with MIR to make this change myself. In the meantime do you want to keep the tests failing?

@oli-obk
Copy link
Contributor

oli-obk commented Oct 6, 2020

Oh, this is not related to MIR, just pretty printing. All you have to do is to pull out

match ty.kind() {
ty::Int(_) | ty::Uint(_) | ty::Bool | ty::Char | ty::Float(_) => {}
// Unit type
ty::Tuple(tys) if tys.is_empty() => {}
ty::FnDef(..) => {}
into a separate function that returns true if the verbose printing should be used and then make it recurse on ty::Tuple and ty::Array elements

The only gotcha is that you need to rerun tests separately for 64bit and 32bit via --target i686-unknown-linux-gnu.

@camelid camelid added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 23, 2020
@oli-obk oli-obk added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 3, 2020
@crlf0710
Copy link
Member

@infinity0 Ping from triage! Any updates on this?

@JohnCSimon
Copy link
Member

@infinity0 Pinging again from triage! Any updates on this?

@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 7, 2020
@infinity0
Copy link
Contributor Author

Sorry, I don't have the time to do the alternative. But the underlying problem exists and should be fixed.

@oli-obk
Copy link
Contributor

oli-obk commented Dec 7, 2020

I'll open an issue and see if someone picks it up. Thanks for bringing up the issue!

@oli-obk oli-obk closed this Dec 7, 2020
@Dylan-DPC-zz Dylan-DPC-zz added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html A-testsuite Area: The testsuite used to check the correctness of rustc S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants