Explain promoted extraction for simd shuffle

This commit is contained in:
Oliver Schneider 2018-07-22 12:15:04 +02:00
parent de511438cd
commit 62581b8f0d
1 changed files with 3 additions and 0 deletions

View File

@ -507,6 +507,9 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
// promotes any complex rvalues to constants.
if i == 2 && intrinsic.unwrap().starts_with("simd_shuffle") {
match *arg {
// The shuffle array argument is usually not an explicit constant,
// but specified directly in the code. This means it gets promoted
// and we can then extract the value by evaluating the promoted.
mir::Operand::Copy(mir::Place::Promoted(box(index, ty))) |
mir::Operand::Move(mir::Place::Promoted(box(index, ty))) => {
let param_env = ty::ParamEnv::reveal_all();