Skip to content

Commit 1d5839f

Browse files
committed
use monomorphize method on type and only have one call site for eval_mir_constant_to_operand
1 parent cd363c8 commit 1d5839f

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

compiler/rustc_codegen_ssa/src/mir/operand.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -636,23 +636,19 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
636636
}
637637

638638
mir::Operand::Constant(ref constant) => {
639-
let constant_ty = constant.ty();
639+
let constant_ty = self.monomorphize(constant.ty());
640640
// Make sure this type is actually passed as an immediate vector.
641641
// (In particular, this excludes packed SIMD vectors.)
642642
if constant_ty.is_simd() {
643643
let layout = bx.layout_of(constant_ty);
644-
return match layout.abi {
645-
Abi::Vector { .. } => {
646-
let (llval, ty) = self.immediate_const_vector(bx, constant);
647-
OperandRef {
648-
val: OperandValue::Immediate(llval),
649-
layout: bx.layout_of(ty),
650-
}
651-
}
652-
_ => self.eval_mir_constant_to_operand(bx, constant),
653-
};
644+
if let Abi::Vector { .. } = layout.abi {
645+
let (llval, ty) = self.immediate_const_vector(bx, constant);
646+
return OperandRef {
647+
val: OperandValue::Immediate(llval),
648+
layout: bx.layout_of(ty),
649+
};
650+
}
654651
}
655-
656652
self.eval_mir_constant_to_operand(bx, constant)
657653
}
658654
}

0 commit comments

Comments
 (0)