@@ -42,7 +42,10 @@ pub fn bridge_llvm_instruction(instruction: MIRBlockHeldInstruction, func: usize
4242 let res = llvm_to_base ! ( bridge. builder. build_int_add( l. into_int_value( ) , r. into_int_value( ) , "" ) ) ;
4343
4444 if fast {
45- llvm_to_base_returnless ! ( res. as_instruction_value( ) . unwrap( ) . set_fast_math_flags( FastMathFlags :: all( ) ) )
45+ let res2 = res. as_instruction_value ( ) . unwrap ( ) ;
46+
47+ llvm_to_base_returnless ! ( res2. set_no_signed_wrap_flag( true ) ) ;
48+ llvm_to_base_returnless ! ( res2. set_no_unsigned_wrap_flag( true ) ) ;
4649 }
4750
4851 Some ( res. into ( ) )
@@ -58,7 +61,10 @@ pub fn bridge_llvm_instruction(instruction: MIRBlockHeldInstruction, func: usize
5861 let res: IntValue < ' static > = llvm_to_base ! ( bridge. builder. build_int_sub( l. into_int_value( ) , r. into_int_value( ) , "" ) ) ;
5962
6063 if fast {
61- llvm_to_base_returnless ! ( res. as_instruction_value( ) . unwrap( ) . set_fast_math_flags( FastMathFlags :: all( ) ) )
64+ let res2 = res. as_instruction_value ( ) . unwrap ( ) ;
65+
66+ llvm_to_base_returnless ! ( res2. set_no_signed_wrap_flag( true ) ) ;
67+ llvm_to_base_returnless ! ( res2. set_no_unsigned_wrap_flag( true ) ) ;
6268 }
6369
6470 Some ( res. into ( ) )
@@ -74,7 +80,10 @@ pub fn bridge_llvm_instruction(instruction: MIRBlockHeldInstruction, func: usize
7480 let res: IntValue < ' static > = llvm_to_base ! ( bridge. builder. build_int_mul( l. into_int_value( ) , r. into_int_value( ) , "" ) ) ;
7581
7682 if fast {
77- llvm_to_base_returnless ! ( res. as_instruction_value( ) . unwrap( ) . set_fast_math_flags( FastMathFlags :: all( ) ) )
83+ let res2 = res. as_instruction_value ( ) . unwrap ( ) ;
84+
85+ llvm_to_base_returnless ! ( res2. set_no_signed_wrap_flag( true ) ) ;
86+ llvm_to_base_returnless ! ( res2. set_no_unsigned_wrap_flag( true ) ) ;
7887 }
7988
8089 Some ( res. into ( ) )
@@ -96,9 +105,12 @@ pub fn bridge_llvm_instruction(instruction: MIRBlockHeldInstruction, func: usize
96105 }
97106
98107 if fast {
99- llvm_to_base_returnless ! ( res. as_instruction_value( ) . unwrap( ) . set_fast_math_flags( FastMathFlags :: all( ) ) )
100- }
108+ let res2 = res. as_instruction_value ( ) . unwrap ( ) ;
101109
110+ llvm_to_base_returnless ! ( res2. set_no_signed_wrap_flag( true ) ) ;
111+ llvm_to_base_returnless ! ( res2. set_no_unsigned_wrap_flag( true ) ) ;
112+ llvm_to_base_returnless ! ( res2. set_exact_flag( true ) ) ;
113+ }
102114 Some ( res. into ( ) )
103115 } ,
104116
0 commit comments