[LLVMdev] Removing ReadOnly from math intrinsics

Raul Silvera rsilvera at google.com
Fri Jan 24 15:52:10 PST 2014

In include/llvm/IR/Intrinsics.td there is code to mark sqrt and several
other math intrinsics as "ReadOnly", even though they do not read memory.

According to the comments this was done as an attempt to model changes to
the FP rounding mode. This is too conservative, and unnecessarily blocks
transformations such as commoning and vectorization.

I have heard from others that FP environment changes are not well modeled
on LLVM anyway, so perhaps it is appropriate to just change these from
ReadOnly to ReadNone. Any opinions on this? If there are no objections I'll
prepare a patch.

The alternative would be to develop a mechanism to finely model FP
environment changes; even further, it might be possible to come up with a
unified model of library call side effects, including errno and even I/O.

 Raúl E. Silvera
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140124/8df1de3c/attachment.html>

More information about the llvm-dev mailing list