@@ -103,7 +103,7 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
103103 // empty set, which is impossible, or the entire range of the
104104 // type, which is pointless).
105105 match scalar. value {
106- layout:: Int ( ..) if max_next & mask != min & mask => {
106+ layout:: Int ( ..) if !scalar . is_bool ( ) && max_next & mask != min & mask => {
107107 // llvm::ConstantRange can deal with ranges that wrap around,
108108 // so an overflow on (max + 1) is fine.
109109 bx. range_metadata ( load, min..max_next) ;
@@ -133,21 +133,13 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
133133 }
134134 load
135135 } ;
136- OperandValue :: Immediate ( base :: to_immediate ( bx , llval, self . layout ) )
136+ OperandValue :: Immediate ( llval)
137137 } else if let layout:: Abi :: ScalarPair ( ref a, ref b) = self . layout . abi {
138138 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 ) ;
144140 let load = bx. load ( llptr, self . align ) ;
145141 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
151143 } ;
152144 OperandValue :: Pair ( load ( 0 , a) , load ( 1 , b) )
153145 } else {
@@ -263,7 +255,7 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
263255
264256 /// Obtain the actual discriminant of a value.
265257 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 ) ;
267259 if self . layout . abi == layout:: Abi :: Uninhabited {
268260 return C_undef ( cast_to) ;
269261 }
@@ -295,7 +287,7 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
295287 niche_start,
296288 ..
297289 } => {
298- let niche_llty = discr. layout . immediate_llvm_type ( bx. cx ) ;
290+ let niche_llty = discr. layout . llvm_type ( bx. cx ) ;
299291 if niche_variants. start == niche_variants. end {
300292 // FIXME(eddyb) Check the actual primitive type here.
301293 let niche_llval = if niche_start == 0 {
@@ -360,7 +352,7 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
360352 }
361353
362354 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 ) ;
364356 let niche_value = ( ( variant_index - niche_variants. start ) as u128 )
365357 . wrapping_add ( niche_start) ;
366358 // FIXME(eddyb) Check the actual primitive type here.
0 commit comments