@@ -242,13 +242,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
242242                if  let  OperandValueKind :: Immediate ( to_scalar)  = cast_kind
243243                    && from_scalar. size ( self . cx )  == to_scalar. size ( self . cx ) 
244244                { 
245-                     let  from_backend_ty = bx. backend_type ( operand. layout ) ; 
246245                    let  to_backend_ty = bx. backend_type ( cast) ; 
247246                    Some ( OperandValue :: Immediate ( self . transmute_immediate ( 
248247                        bx, 
249248                        imm, 
250249                        from_scalar, 
251-                         from_backend_ty, 
252250                        to_scalar, 
253251                        to_backend_ty, 
254252                    ) ) ) 
@@ -264,13 +262,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
264262                    && in_a. size ( self . cx )  == out_a. size ( self . cx ) 
265263                    && in_b. size ( self . cx )  == out_b. size ( self . cx ) 
266264                { 
267-                     let  in_a_ibty = bx. scalar_pair_element_backend_type ( operand. layout ,  0 ,  false ) ; 
268-                     let  in_b_ibty = bx. scalar_pair_element_backend_type ( operand. layout ,  1 ,  false ) ; 
269265                    let  out_a_ibty = bx. scalar_pair_element_backend_type ( cast,  0 ,  false ) ; 
270266                    let  out_b_ibty = bx. scalar_pair_element_backend_type ( cast,  1 ,  false ) ; 
271267                    Some ( OperandValue :: Pair ( 
272-                         self . transmute_immediate ( bx,  imm_a,  in_a,  in_a_ibty ,   out_a,  out_a_ibty) , 
273-                         self . transmute_immediate ( bx,  imm_b,  in_b,  in_b_ibty ,   out_b,  out_b_ibty) , 
268+                         self . transmute_immediate ( bx,  imm_a,  in_a,  out_a,  out_a_ibty) , 
269+                         self . transmute_immediate ( bx,  imm_b,  in_b,  out_b,  out_b_ibty) , 
274270                    ) ) 
275271                }  else  { 
276272                    None 
@@ -294,12 +290,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
294290    )  -> Option < Bx :: Value >  { 
295291        use  abi:: Primitive :: * ; 
296292
297-         // When scalars are passed by value, there's no metadata recording their 
298-         // valid ranges. For example, `char`s are passed as just `i32`, with no 
299-         // way for LLVM to know that they're 0x10FFFF at most. Thus we assume 
300-         // the range of the input value too, not just the output range. 
301-         self . assume_scalar_range ( bx,  imm,  from_scalar,  from_backend_ty) ; 
302- 
303293        imm = match  ( from_scalar. primitive ( ) ,  to_scalar. primitive ( ) )  { 
304294            ( Int ( _,  is_signed) ,  Int ( ..) )  => bx. intcast ( imm,  to_backend_ty,  is_signed) , 
305295            ( Float ( _) ,  Float ( _) )  => { 
@@ -341,21 +331,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
341331        bx :  & mut  Bx , 
342332        mut  imm :  Bx :: Value , 
343333        from_scalar :  abi:: Scalar , 
344-         from_backend_ty :  Bx :: Type , 
345334        to_scalar :  abi:: Scalar , 
346335        to_backend_ty :  Bx :: Type , 
347336    )  -> Bx :: Value  { 
337+         use  abi:: Primitive :: * ; 
338+ 
348339        assert_eq ! ( from_scalar. size( self . cx) ,  to_scalar. size( self . cx) ) ; 
349340
350-         use  abi:: Primitive :: * ; 
351341        imm = bx. from_immediate ( imm) ; 
352342
353-         // When scalars are passed by value, there's no metadata recording their 
354-         // valid ranges. For example, `char`s are passed as just `i32`, with no 
355-         // way for LLVM to know that they're 0x10FFFF at most. Thus we assume 
356-         // the range of the input value too, not just the output range. 
357-         self . assume_scalar_range ( bx,  imm,  from_scalar,  from_backend_ty) ; 
358- 
359343        imm = match  ( from_scalar. primitive ( ) ,  to_scalar. primitive ( ) )  { 
360344            ( Int ( ..)  | Float ( _) ,  Int ( ..)  | Float ( _) )  => bx. bitcast ( imm,  to_backend_ty) , 
361345            ( Pointer ( ..) ,  Pointer ( ..) )  => bx. pointercast ( imm,  to_backend_ty) , 
@@ -370,55 +354,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
370354                bx. bitcast ( int_imm,  to_backend_ty) 
371355            } 
372356        } ; 
373-         self . assume_scalar_range ( bx,  imm,  to_scalar,  to_backend_ty) ; 
374357        imm = bx. to_immediate_scalar ( imm,  to_scalar) ; 
375358        imm
376359    } 
377360
378-     fn  assume_scalar_range ( 
379-         & self , 
380-         bx :  & mut  Bx , 
381-         imm :  Bx :: Value , 
382-         scalar :  abi:: Scalar , 
383-         backend_ty :  Bx :: Type , 
384-     )  { 
385-         if  matches ! ( self . cx. sess( ) . opts. optimize,  OptLevel :: No  | OptLevel :: Less ) 
386-             // For now, the critical niches are all over `Int`eger values. 
387-             // Should floating-point values or pointers ever get more complex 
388-             // niches, then this code will probably want to handle them too. 
389-             || !matches ! ( scalar. primitive( ) ,  abi:: Primitive :: Int ( ..) ) 
390-             || scalar. is_always_valid ( self . cx ) 
391-         { 
392-             return ; 
393-         } 
394- 
395-         let  abi:: WrappingRange  {  start,  end }  = scalar. valid_range ( self . cx ) ; 
396- 
397-         if  start <= end { 
398-             if  start > 0  { 
399-                 let  low = bx. const_uint_big ( backend_ty,  start) ; 
400-                 let  cmp = bx. icmp ( IntPredicate :: IntUGE ,  imm,  low) ; 
401-                 bx. assume ( cmp) ; 
402-             } 
403- 
404-             let  type_max = scalar. size ( self . cx ) . unsigned_int_max ( ) ; 
405-             if  end < type_max { 
406-                 let  high = bx. const_uint_big ( backend_ty,  end) ; 
407-                 let  cmp = bx. icmp ( IntPredicate :: IntULE ,  imm,  high) ; 
408-                 bx. assume ( cmp) ; 
409-             } 
410-         }  else  { 
411-             let  low = bx. const_uint_big ( backend_ty,  start) ; 
412-             let  cmp_low = bx. icmp ( IntPredicate :: IntUGE ,  imm,  low) ; 
413- 
414-             let  high = bx. const_uint_big ( backend_ty,  end) ; 
415-             let  cmp_high = bx. icmp ( IntPredicate :: IntULE ,  imm,  high) ; 
416- 
417-             let  or = bx. or ( cmp_low,  cmp_high) ; 
418-             bx. assume ( or) ; 
419-         } 
420-     } 
421- 
422361    pub  fn  codegen_rvalue_unsized ( 
423362        & mut  self , 
424363        bx :  & mut  Bx , 
0 commit comments