@@ -39,6 +39,8 @@ pub fn lvalue_temps<'bcx,'tcx>(bcx: Block<'bcx,'tcx>,
39
39
// in an ValueRef without an alloca.
40
40
assert ! ( common:: type_is_immediate( bcx. ccx( ) , ty) ||
41
41
common:: type_is_fat_ptr( bcx. tcx( ) , ty) ) ;
42
+ } else if common:: type_is_imm_pair ( bcx. ccx ( ) , ty) {
43
+ // We allow pairs and uses of any of their 2 fields.
42
44
} else {
43
45
// These sorts of types require an alloca. Note that
44
46
// type_is_immediate() may *still* be true, particularly
@@ -111,6 +113,21 @@ impl<'mir, 'bcx, 'tcx> Visitor<'tcx> for TempAnalyzer<'mir, 'bcx, 'tcx> {
111
113
context : LvalueContext ) {
112
114
debug ! ( "visit_lvalue(lvalue={:?}, context={:?})" , lvalue, context) ;
113
115
116
+ // Allow uses of projections of immediate pair fields.
117
+ if let mir:: Lvalue :: Projection ( ref proj) = * lvalue {
118
+ if let mir:: Lvalue :: Temp ( index) = proj. base {
119
+ let ty = self . mir . temp_decls [ index as usize ] . ty ;
120
+ let ty = self . bcx . monomorphize ( & ty) ;
121
+ if common:: type_is_imm_pair ( self . bcx . ccx ( ) , ty) {
122
+ if let mir:: ProjectionElem :: Field ( ..) = proj. elem {
123
+ if let LvalueContext :: Consume = context {
124
+ return ;
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+
114
131
match * lvalue {
115
132
mir:: Lvalue :: Temp ( index) => {
116
133
match context {
0 commit comments