[PATCH] D50714: [InstCombine] Fold Select with binary op - FP opcodes

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 09:07:11 PDT 2018


spatel added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:85
+  // Check for signed zeros
+  if (isa<FPMathOperator>(BO) && !BO->hasNoSignedZeros())
+    return nullptr;
----------------
I think this is a correct predicate, but stronger than necessary. Does alive-fp say we can get away with CannotBeNegativeZero(Y)? If it doesn't recognize that function, you could fake it by adding another operation that creates 'Y' (or '%z' as shown in the test names) while guaranteeing that it is not -0.0. So something like:
%z = fadd %v, 0.0 (this can never produce -0.0)


https://reviews.llvm.org/D50714





More information about the llvm-commits mailing list