You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MIR] simd_shuffle codegen uses self.instance as const_eval_promoted source #67557
let c = bx.tcx().const_eval_promoted(self.instance, promoted);
It should use Instance::new(def_is, self.monomorphize(substs). (substs is the second field of StaticKind::Promoted.) While both instances are normally equal, they can differ after running the mir inliner. In that case the promoted will refer to the inlined function.
Wow, that's hilarious. With just the changes @bjorn3 suggested, the inlining still doesn't work properly, but doesn't seem to break any existing stuff. But I've just tried this and yeah, putting ret_slice below main has made the MIR inliner work.
This does inline, but somehow no assertion fires with current rustc. The printed MIR doesn't seem to show the the def_id from which the promoted originates, so I don't know what the problem is.
Unless I'm misunderstanding something, isn't this the correct behaviour? Both of those assertions are true, and swapping slice and promoted around in the assertions correctly triggers an assertion failure.
Activity
Centril commentedon Dec 23, 2019
cc @oli-obk
jumbatm commentedon Dec 23, 2019
Can I give this a go?
@rustbot claim
jumbatm commentedon Dec 23, 2019
Do you have any specific tests in mind I should add to check for the correct behaviour?
bjorn3 commentedon Dec 23, 2019
should be a test if the mir inliner would to inline
ret_slice. Somehow it doesn't though.wesleywiser commentedon Dec 24, 2019
@bjorn3 You might be running into this unfortunate check
rust/src/librustc_mir/transform/inline.rs
Line 106 in 6253754
Try moving
ret_slicebelowmain.jumbatm commentedon Dec 24, 2019
Wow, that's hilarious. With just the changes @bjorn3 suggested, the inlining still doesn't work properly, but doesn't seem to break any existing stuff. But I've just tried this and yeah, putting ret_slice below main has made the MIR inliner work.
bjorn3 commentedon Dec 24, 2019
This does inline, but somehow no assertion fires with current rustc. The printed MIR doesn't seem to show the the def_id from which the promoted originates, so I don't know what the problem is.
jumbatm commentedon Dec 24, 2019
Unless I'm misunderstanding something, isn't this the correct behaviour? Both of those assertions are true, and swapping
sliceandpromotedaround in the assertions correctly triggers an assertion failure.bjorn3 commentedon Dec 24, 2019
I forgot that this problem was only with
simd_shuffle.bjorn3 commentedon Dec 24, 2019
I got a working test:
jumbatm commentedon Dec 25, 2019
Ah, that's a good test case. Yeah, that's definitely not the expected behaviour.
While messing about with your example, I also managed to come across an ICE with this slightly shorter version:
causes an ICE currently due to an internal index out of range.
The good news is that the changes you suggested fixes both of these test cases. Good spot :) I'm putting up the PR now.
Rollup merge of rust-lang#67598 - jumbatm:issue67557_simd_shuffle, r=…
Rollup merge of rust-lang#67598 - jumbatm:issue67557_simd_shuffle, r=…
Rollup merge of rust-lang#67598 - jumbatm:issue67557_simd_shuffle, r=…
Auto merge of #67598 - jumbatm:issue67557_simd_shuffle, r=oli-obk