(cast_enum, cast_float) => {
let bcx = bcx;
let repr = adt::represent_type(ccx, t_in);
- let slot = Alloca(bcx, ll_t_in, "");
- Store(bcx, llexpr, slot);
- let lldiscrim_a = adt::trans_get_discr(bcx, repr, slot, Some(Type::i64()));
+ let llexpr_ptr;
+ if type_is_immediate(ccx, t_in) {
+ llexpr_ptr = Alloca(bcx, ll_t_in, "");
+ Store(bcx, llexpr, llexpr_ptr);
+ } else {
+ llexpr_ptr = llexpr;
+ }
+ let lldiscrim_a = adt::trans_get_discr(bcx, repr, llexpr_ptr, Some(Type::i64()));
match k_out {
cast_integral => int_cast(bcx, ll_t_out,
val_ty(lldiscrim_a),