[llvm-commits] [llvm] r48170 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Chris Lattner clattner at apple.com
Mon Mar 10 13:49:26 PDT 2008


On Mar 10, 2008, at 1:37 PM, Dale Johannesen wrote:

>>
> While you're at it,
>
>>  // fold (sub x, x) -> 0
>
> is unsafe for IEEE floating point (x==NaN).  There's a comment in gcc
> saying
>
>          This is unsafe for certain floats even in non-IEEE formats.
>
> but it does not say what these might be.  However, gcc requires the
> maximally aggressive -funsafe-math-optimizations to do this one, not
> just the more specific "do not worry about NaNs" flag.

This only happens in SUB, not FSUB, so I think it's ok.

> It is also unsafe if x is volatile.

These are decomposed expressions, so x is a a register, not a value in  
memory.

-Chris



More information about the llvm-commits mailing list