<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">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.</div>



<div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">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.</div>



<div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">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.</div>

<div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">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.</div>
<div class="gmail_default" style="font-family:verdana,sans-serif">
<div class="gmail_default"><br></div></div><div class="gmail_default" style="font-family:verdana,sans-serif">Thanks,<br></div>
-- <br><div dir="ltr"><div><font size="4" face="arial black, sans-serif" style="background-color:rgb(0,0,0)" color="#b45f06"> Raúl E. Silvera </font></div>
<div><br></div></div>
</div>