-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ICE with mir-opt-level=2 in program with scalar pair value #67019
Comments
#67015 improves the situation a little bit but it's still not enough. The problem is (as accurately identified by @tmiasko in #67015) when we have something like Two options:
Either way, this will effect resolution of #66971 too. @oli-obk says in the issue:
I don't know how to fix this while also doing what @oli-obk says above. Currently I use types so in PR #67015 the MIR we generate for @oli-obk @wesleywiser does this make sense? How should I proceed here? I think first option would allow more constant propagation. Both options would change logical type of values in some cases. |
It's a bit hacky because the ICE from rust-lang/rust#67019 needs compiler flags and I don't know of a way to provide that from within a .rs file.
Ok, so there are multiple things at play here. We have a total of 3 representations that
Our current situation is that we convert scalarpairs directly to two element aggregates. This is wrong though, because while the memory representation of a value may be a scalar pair, the MIR needs to build all levels of a value irrelevant of its memory representation. The MIR just looks at the fields that are there, not at the layout. Side note: the correct way to get a field from an So... My suggestion is to instead always create an
And the fun thing about it, you don't have to write any code. You can just make rust/src/librustc_mir/const_eval.rs Line 54 in 7b482cd
read_immediate in rust/src/librustc_mir/transform/const_prop.rs Lines 624 to 627 in 7b482cd
op_to_const there.
Now this may cause two other problems:
|
It's a bit hacky because the ICE from rust-lang/rust#67019 needs compiler flags and I don't know of a way to provide that from within a .rs file.
Fix constant propagation for scalar pairs We now only propagate a scalar pair if the Rvalue is a tuple with two scalars. This for example avoids propagating a (u8, u8) value when Rvalue has type `((), u8, u8)` (see the regression test). While this is a correct thing to do, implementation is tricky and will be done later. Fixes rust-lang#66971 Fixes rust-lang#66339 Fixes rust-lang#67019
Build:
ICE:
The text was updated successfully, but these errors were encountered: