[LLVMdev] Optimization of sqrt() with invalid argument

Tim Northover t.p.northover at gmail.com
Fri Sep 26 12:06:26 PDT 2014


> At the least, we should constant-fold to NaN for the non fast-math sqrt
> calls...there's no point in going through the libcall overhead when we
> know the answer in advance.  I can prepare a patch for that if everyone
> agrees.

I thought we already did that, but apparently not. The only thing to
beware of there is make sure it only triggers when -fno-math-errno has
been passed. In the IR you'll be looking for a call to @sqrt (or
variant) with the "readnone" attribute.

Cheers.

Tim.



More information about the llvm-dev mailing list