Skip to content

Commit 664fec0

Browse files
committed
put back const_struct()
1 parent da92e81 commit 664fec0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_codegen_ssa/src/mir/constant.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
6666
constant: &mir::ConstOperand<'tcx>,
6767
) -> (Bx::Value, Ty<'tcx>) {
6868
let ty = self.monomorphize(constant.ty());
69+
let ty_is_simd = ty.is_simd();
6970
// FIXME: ideally we'd assert that this is a SIMD type, but simd_shuffle
7071
// in its current form relies on a regular array being passed as an
7172
// immediate argument. This hack can be removed once that is fixed.
72-
let field_ty = if ty.is_simd() {
73+
let field_ty = if ty_is_simd {
7374
ty.simd_size_and_type(bx.tcx()).1
7475
} else {
7576
ty.builtin_index().unwrap()
@@ -106,7 +107,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
106107
}
107108
})
108109
.collect();
109-
bx.const_vector(&values)
110+
if ty_is_simd { bx.const_vector(&values) } else { bx.const_struct(&values, false) }
110111
})
111112
.unwrap_or_else(|| {
112113
bx.tcx().dcx().emit_err(errors::ShuffleIndicesEvaluation { span: constant.span });

0 commit comments

Comments
 (0)