[LLVMdev] Additional Optimization I'm Missing?
me22.ca at gmail.com
Mon Mar 31 17:08:10 PDT 2008
On Mon, Mar 31, 2008 at 7:46 PM, Bobby Powers <bobbypowers at gmail.com> wrote:
> The thing is, in forbody it is still doing:
> subtmp = population + (population * .3) - (population * .1)
> ideally I would love to see it reduced to:
> subtmp = 1.2 * population
I expect that such a transformation is not safe in general thanks to
rounding errors, and as such isn't applied. AFAIK, compilers usually
don't reorganize floating point operations.
Have you tried it on other compilers? I expect it'll never happen
without some imprecise math option (like gcc's -ffast-math).
More information about the llvm-dev