From 62581b8f0d92304914310640a91dc6f919502daf Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Sun, 22 Jul 2018 12:15:04 +0200 Subject: [PATCH] Explain promoted extraction for simd shuffle --- src/librustc_codegen_llvm/mir/block.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librustc_codegen_llvm/mir/block.rs b/src/librustc_codegen_llvm/mir/block.rs index 92313d69810a..dc4b9e0ae99d 100644 --- a/src/librustc_codegen_llvm/mir/block.rs +++ b/src/librustc_codegen_llvm/mir/block.rs @@ -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();