@@ -103,7 +103,7 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
103
103
// empty set, which is impossible, or the entire range of the
104
104
// type, which is pointless).
105
105
match scalar. value {
106
- layout:: Int ( ..) if max_next & mask != min & mask => {
106
+ layout:: Int ( ..) if !scalar . is_bool ( ) && max_next & mask != min & mask => {
107
107
// llvm::ConstantRange can deal with ranges that wrap around,
108
108
// so an overflow on (max + 1) is fine.
109
109
bx. range_metadata ( load, min..max_next) ;
@@ -133,21 +133,13 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
133
133
}
134
134
load
135
135
} ;
136
- OperandValue :: Immediate ( base :: to_immediate ( bx , llval, self . layout ) )
136
+ OperandValue :: Immediate ( llval)
137
137
} else if let layout:: Abi :: ScalarPair ( ref a, ref b) = self . layout . abi {
138
138
let load = |i, scalar : & layout:: Scalar | {
139
- let mut llptr = bx. struct_gep ( self . llval , i as u64 ) ;
140
- // Make sure to always load i1 as i8.
141
- if scalar. is_bool ( ) {
142
- llptr = bx. pointercast ( llptr, Type :: i8p ( bx. cx ) ) ;
143
- }
139
+ let llptr = bx. struct_gep ( self . llval , i as u64 ) ;
144
140
let load = bx. load ( llptr, self . align ) ;
145
141
scalar_load_metadata ( load, scalar) ;
146
- if scalar. is_bool ( ) {
147
- bx. trunc ( load, Type :: i1 ( bx. cx ) )
148
- } else {
149
- load
150
- }
142
+ load
151
143
} ;
152
144
OperandValue :: Pair ( load ( 0 , a) , load ( 1 , b) )
153
145
} else {
@@ -263,7 +255,7 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
263
255
264
256
/// Obtain the actual discriminant of a value.
265
257
pub fn trans_get_discr ( self , bx : & Builder < ' a , ' tcx > , cast_to : Ty < ' tcx > ) -> ValueRef {
266
- let cast_to = bx. cx . layout_of ( cast_to) . immediate_llvm_type ( bx. cx ) ;
258
+ let cast_to = bx. cx . layout_of ( cast_to) . llvm_type ( bx. cx ) ;
267
259
if self . layout . abi == layout:: Abi :: Uninhabited {
268
260
return C_undef ( cast_to) ;
269
261
}
@@ -295,7 +287,7 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
295
287
niche_start,
296
288
..
297
289
} => {
298
- let niche_llty = discr. layout . immediate_llvm_type ( bx. cx ) ;
290
+ let niche_llty = discr. layout . llvm_type ( bx. cx ) ;
299
291
if niche_variants. start == niche_variants. end {
300
292
// FIXME(eddyb) Check the actual primitive type here.
301
293
let niche_llval = if niche_start == 0 {
@@ -360,7 +352,7 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
360
352
}
361
353
362
354
let niche = self . project_field ( bx, 0 ) ;
363
- let niche_llty = niche. layout . immediate_llvm_type ( bx. cx ) ;
355
+ let niche_llty = niche. layout . llvm_type ( bx. cx ) ;
364
356
let niche_value = ( ( variant_index - niche_variants. start ) as u128 )
365
357
. wrapping_add ( niche_start) ;
366
358
// FIXME(eddyb) Check the actual primitive type here.
0 commit comments