[PATCH] D28928: [ValueTracking] Implement SignBitMustBeZero correctly for sqrt.

Justin Lebar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 15:06:47 PST 2017


jlebar added inline comments.


================
Comment at: llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll:237
+  %sqrt = call nnan nsz float @llvm.sqrt.f32(float %a)
+  %fabs = call float @llvm.fabs.f32(float %sqrt)
+  ret float %fabs
----------------
efriedma wrote:
> I'm not convinced this transform is legal without an nsz flag on the fabs...
> 
> Patch is fine otherwise.
I thought we talked about this above and established that, because fabs is a floating-point op and here its input comes from an nsz op, we can assume that the sign of the zero is "insignificant".  My understanding was that only if we have a non-fp op involved do things become complicated.

Maybe this would be easier on IRC?  Please ping me and Hal.


https://reviews.llvm.org/D28928





More information about the llvm-commits mailing list