# Investigating numerical change in function return value between v1.4 vs v1.5

**URL:** <https://discourse.julialang.org/t/investigating-numerical-change-in-function-return-value-between-v1-4-vs-v1-5/41332>\
**Category:** Numerics\
**Tags:** llvm, fast-math\
**Created:** [June 13, 2020, 5:12pm UTC](https://discourse.julialang.org/t/investigating-numerical-change-in-function-return-value-between-v1-4-vs-v1-5/41332 "2020-06-13T17:12:07Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [June 13, 2020, 9:53pm UTC](https://discourse.julialang.org/t/investigating-numerical-change-in-function-return-value-between-v1-4-vs-v1-5/41332/5 "2020-06-13T21:53:58Z")

</div>

> [@jmert](#):
>
> At any rate, I’d still be interested in knowing if my mental model of the LLVM `fast` annotations is wrong or not, and thankfully my function is simple enough that digging into how the optimization passes transform the code is probably feasible (currently, for someone else, but I’d be happy to learn how to dig into the internals more).

I’m curious about this as well.  
FWIW, you don’t need `-O3`, [all you need](https://godbolt.org/z/r-cNuL) is `-instcombine` to get the `fdiv fast`. So it seems to have been a change with the `instcombine` pass between versions.

I also recently [encountered an issue with fdiv and instcombine that started with LLVM 9](https://github.com/JuliaLang/julia/issues/36084) where the instcombine moves an `fdiv` inside a loop, dramatically worsening performance.  
My issue on LLVM was closed because that was intended behavior; you’re supposed to place a `licm` at some point after the last `instcombine` to move the division back out of the loop.

Maybe you could file this as an instcombine issue with LLVM. It seems reasonably likely they’re connected (instcombine getting more aggressive with divisions from LLVM 8 to 9), but your example seems harder to close as a Julia issue / shows up with the default `-O3` optimization pipeline.

---

_[View the full topic](https://discourse.julialang.org/t/investigating-numerical-change-in-function-return-value-between-v1-4-vs-v1-5/41332)._
