@@ -8,7 +8,7 @@ use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
8
8
use rustc_middle:: { bug, mir, span_bug} ;
9
9
use rustc_session:: config:: OptLevel ;
10
10
use rustc_span:: { DUMMY_SP , Span } ;
11
- use tracing:: { debug, instrument} ;
11
+ use tracing:: { debug, instrument, trace } ;
12
12
13
13
use super :: FunctionCx ;
14
14
use super :: operand:: { OperandRef , OperandValue } ;
@@ -117,13 +117,33 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
117
117
false
118
118
} ;
119
119
120
+ trace ! ( ?cg_elem. val) ;
120
121
match cg_elem. val {
121
122
OperandValue :: Immediate ( v) => {
122
123
if try_init_all_same ( bx, v) {
123
124
return ;
124
125
}
125
126
}
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 ( ..) => { }
127
147
}
128
148
129
149
let count = self
0 commit comments