[PATCH] DAGCombine: Remove redundant NaN checks around ISD::FSQRT

Mehdi AMINI mehdi.amini at apple.com
Thu Mar 19 20:02:33 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:12444
@@ +12443,3 @@
+  // fold (select (setcc x, -0.0, olt), NaN, (fsqrt x))
+  // The select + setcc is redundant, becuase fsqrt returns NaN for X < -0.
+  if (const ConstantFPSDNode *NaN = isConstOrConstSplatFP(LHS)) {
----------------
s/becuase/because

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:12467
@@ +12466,3 @@
+      if (NegZero && NegZero->isNegative() && NegZero->isZero() &&
+          Sqrt.getOperand(0) == CmpLHS && CC == ISD::SETOLT) {
+          // We have: (select (setcc x, -0.0, olt), NaN, (fsqrt x))
----------------
Since fsqrt(NaN) = NaN (I believe), SETULT should be fine as well here right? And SETLT too?

http://reviews.llvm.org/D8470

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list