[llvm-commits] [llvm-gcc-4.2] r55796 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Chris Lattner clattner at apple.com
Sun Sep 21 15:54:55 PDT 2008


On Sep 9, 2008, at 12:38 PM, Duncan Sands wrote:

>> Whether an implementation sets errno (as Darwin does not) is a target
>> dependency.  c99 does not require it.  Again a target may do target-
>> dependent optimizations if it wants.  (Of course this property may be
>> shared by many targets so some abstraction would be useful; I am not
>> saying these optimizations belong in the X86-specific code, for
>> example.)
>>
>> So, I don't think it's necessary to represent either of these
>> properties in the IR as such;
>
> I don't follow you.  On linux the "pow" standard library function
> sets errno.  If my program calls "pow" and uses errno, you can't
> just ignore that property of "pow".  If I'm doing careful numerics
> that relies on the rounding mode, the fact that the result of "pow"
> depends on the rounding mode is important and can't just be ignored.
> (People who want to ignore it can use -ffast-math, which results in
> a "readnone" pow).

OTOH, a flavor of this is also a front-end issue: fortran code never  
uses errno, so it is safe (in fortran) to optimize to a representation  
that doesn't generate errno.

-Chris



More information about the llvm-commits mailing list