Skip to content

Commit eb43d95

Browse files
committed
mir: Don't load the discriminant, it's already in immediate form.
1 parent d3a6d67 commit eb43d95

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/librustc_trans/trans/mir/rvalue.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,12 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
248248
let r_t_out = CastTy::from_ty(cast_ty).expect("bad output type for cast");
249249
let ll_t_in = type_of::immediate_type_of(bcx.ccx(), operand.ty);
250250
let ll_t_out = type_of::immediate_type_of(bcx.ccx(), cast_ty);
251-
let (llval, ll_t_in, signed) = if let CastTy::Int(IntTy::CEnum) = r_t_in {
251+
let llval = operand.immediate();
252+
let signed = if let CastTy::Int(IntTy::CEnum) = r_t_in {
252253
let repr = adt::represent_type(bcx.ccx(), operand.ty);
253-
let llval = operand.immediate();
254-
let discr = bcx.with_block(|bcx| {
255-
adt::trans_get_discr(bcx, &repr, llval, None, true)
256-
});
257-
(discr, common::val_ty(discr), adt::is_discr_signed(&repr))
254+
adt::is_discr_signed(&repr)
258255
} else {
259-
(operand.immediate(), ll_t_in, operand.ty.is_signed())
256+
operand.ty.is_signed()
260257
};
261258

262259
let newval = match (r_t_in, r_t_out) {

0 commit comments

Comments
 (0)