[llvm-commits] [PATCH] Instcombine: Don't optimize pow(2.0, x) -> exp2(x) if exp2 is unavailable

Meador Inge meadori at codesourcery.com
Mon Nov 26 12:37:08 PST 2012


On Nov 26, 2012, at 1:17 PM, Derek Schuff wrote:

> Hi,
> Attached is a patch to check that exp2 is available using the usual
> TLI mechanism before optimizing pow(2.0, x) to exp2(x). This is a
> problem if compiling a math library that implements exp2(x) as a call
> to pow(2,x).

Right now LibFunc::exp2 is available on all platforms except Win32.  Are you
building a libc for Win32?  Otherwise, I don't see how this is useful since
TLI->has(LibFunc::exp2) will always be true for non-Win32 platforms.  That
being said I still see this as a bug that should be fixed.

Once the ability to pass -fno-builtin-foo gets added to Clang, then this might be
useful on other platforms (http://llvm.org/bugs/show_bug.cgi?id=4941).

(BTW, please include a test case in the future or a justification for why one can't be
 be written.)

--
Meador Inge
CodeSourcery / Mentor Embedded
http://www.mentor.com/embedded-software





More information about the llvm-commits mailing list