[PATCH] D28929: [ConstantFolding] Constant-fold llvm.sqrt(x) like other intrinsics.

Justin Lebar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 17:47:44 PST 2017

jlebar added inline comments.

Comment at: llvm/test/Transforms/InstCombine/constant-fold-math.ll:54
-  ret double %x
efriedma wrote:
> jlebar wrote:
> > efriedma wrote:
> > > Leave the test, and just update the CHECK line?
> > The CHECK in this case would be checking that the sqrt is not constant-folded.  (sqrt(-2) raises an fp exception, and we don't currently constant-fold intrinsics whose libm equivalents raise exceptions.)  I didn't think this was an interesting test, because it's a limitation of the compiler that we don't currently constant-fold it, not a correctness issue.
> Well, we'd like to know if the compiler is doing something unexpected.  We can update the test when we teach the compiler that `sqrt(-1) == NaN`.
OK, done.


More information about the llvm-commits mailing list