<div dir="ltr">Hi,<div>Please consider the following C code snippet taken from the latest SVComp(Software Verification) Benchmark:</div><div><font face="monospace"><b>#include <fenv.h><br>#include <math.h><br>int main(void) {<br>     fesetround(FE_DOWNWARD);<br>      assert(rint(12.9) == 12.);<br>    assert(rint(-12.1) == -13.);<br>  return 0;<br>}</b></font><br></div><div><font face="arial, sans-serif" style="">The above code is marked as SAFE by the svcomp benchmark, ie, the assert can never fail.</font></div><div><font face="arial, sans-serif" style="">The corresponding LLVM-IR for the above code is:</font></div><div>define dso_local i32 @main() #0 {<br><font face="monospace"><b>entry:<br>  %retval = alloca i32, align 4<br>  store i32 0, i32* %retval, align 4<br>  %call = call i32 @fesetround(i32 1024) #4<br>  %0 = call double @llvm.rint.f64(double 1.290000e+01)<br>  %cmp = fcmp oeq double %0, 1.200000e+01<br>  %conv = zext i1 %cmp to i32<br>  %call1 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %conv)<br>  %1 = call double @llvm.rint.f64(double -1.210000e+01)<br>  %cmp2 = fcmp oeq double %1, -1.300000e+01<br>  %conv3 = zext i1 %cmp2 to i32<br>  %call4 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %conv3)<br>  ret i32 0<br>},</b></font><font face="arial, sans-serif" style=""><br></font></div><div><font face="arial, sans-serif">however on applying the <i>-ipsccp -dce, </i>optimization passes, the transformed IR is:</font></div><div><b><font face="monospace">define dso_local i32 @main() #0 {<br>entry:<br>  %retval = alloca i32, align 4<br>  store i32 0, i32* %retval, align 4<br>  %call = call i32 @fesetround(i32 1024) #4<br>  %call1 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 0)<br>  %call4 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 0)<br>  ret i32 0<br>}</font></b><font face="arial, sans-serif"><br></font></div><div>, where the assert calls have been made false.</div><div><br></div><div>Thanks,</div><div>Akash.</div></div>