[PATCH] D28797: [LangRef] Make @llvm.sqrt(x) return undef, rather than have UB, for negative x.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 11:44:09 PST 2017


efriedma requested changes to this revision.
efriedma added a comment.
This revision now requires changes to proceed.

> Nothing in LLVM takes advantage of this undefined behavior, as far as we can tell, and the fact that llvm.sqrt has UB dates from its initial addition to the LangRef.

This is false: we take advantage of this to lower @llvm.sqrt() to libm sqrt() on platforms which don't have a native sqrt instruction, and that can have side-effects.  See also https://reviews.llvm.org/D28335 .


https://reviews.llvm.org/D28797





More information about the llvm-commits mailing list