[llvm-commits] [PATCH] Ensure log2/exp2 are only intrinsic-ified if declared readnone

Chris Lattner clattner at apple.com
Thu Mar 1 05:39:10 PST 2012


On Mar 1, 2012, at 4:06 AM, James Molloy wrote:

> Hi,
> 
> The attached patch fixes a codegen fault in which log2 and exp2 were being
> converted to intrinsic when they weren't declared as "readnone".
> 
> The problem is that these functions can set errno, and the intrinsics don't
> model sideeffects so can be dead-code eliminated if not used.
> 
> Sinf/cosf have similar sideeffects, and this is already modelled by an extra
> check to see if they are declared "readnone" before conversion to
> intrinsics. I've added this check to log2/exp2.
> 
> It's pretty simple (and comes with testcases) - am I OK to commit?

Looks good to me, please do!

-Chris



More information about the llvm-commits mailing list