mir: Don't load the discriminant, it's already in immediate form.

This commit is contained in:
Eduard Burtescu 2016-03-08 14:21:11 +02:00
parent d3a6d67fb8
commit eb43d95211

View File

@ -248,15 +248,12 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
let r_t_out = CastTy::from_ty(cast_ty).expect("bad output type for cast");
let ll_t_in = type_of::immediate_type_of(bcx.ccx(), operand.ty);
let ll_t_out = type_of::immediate_type_of(bcx.ccx(), cast_ty);
let (llval, ll_t_in, signed) = if let CastTy::Int(IntTy::CEnum) = r_t_in {
let llval = operand.immediate();
let signed = if let CastTy::Int(IntTy::CEnum) = r_t_in {
let repr = adt::represent_type(bcx.ccx(), operand.ty);
let llval = operand.immediate();
let discr = bcx.with_block(|bcx| {
adt::trans_get_discr(bcx, &repr, llval, None, true)
});
(discr, common::val_ty(discr), adt::is_discr_signed(&repr))
adt::is_discr_signed(&repr)
} else {
(operand.immediate(), ll_t_in, operand.ty.is_signed())
operand.ty.is_signed()
};
let newval = match (r_t_in, r_t_out) {