@@ -8,7 +8,7 @@ use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
88use rustc_middle:: { bug, mir, span_bug} ;
99use rustc_session:: config:: OptLevel ;
1010use rustc_span:: { DUMMY_SP , Span } ;
11- use tracing:: { debug, instrument} ;
11+ use tracing:: { debug, instrument, trace } ;
1212
1313use super :: FunctionCx ;
1414use super :: operand:: { OperandRef , OperandValue } ;
@@ -117,13 +117,33 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
117117 false
118118 } ;
119119
120+ trace ! ( ?cg_elem. val) ;
120121 match cg_elem. val {
121122 OperandValue :: Immediate ( v) => {
122123 if try_init_all_same ( bx, v) {
123124 return ;
124125 }
125126 }
126- _ => ( ) ,
127+ OperandValue :: Pair ( a, b) => {
128+ let a_is_undef = bx. cx ( ) . is_undef ( a) ;
129+ match ( a_is_undef, bx. cx ( ) . is_undef ( b) ) {
130+ // Can happen for uninit unions
131+ ( true , true ) => {
132+ // FIXME: can we produce better output here?
133+ }
134+ ( false , true ) | ( true , false ) => {
135+ let val = if a_is_undef { b } else { b } ;
136+ if try_init_all_same ( bx, val) {
137+ return ;
138+ }
139+ }
140+ ( false , false ) => {
141+ // FIXME: if both are the same value, use try_init_all_same
142+ }
143+ }
144+ }
145+ OperandValue :: ZeroSized => unreachable ! ( "checked above" ) ,
146+ OperandValue :: Ref ( ..) => { }
127147 }
128148
129149 let count = self
0 commit comments