[PATCH] D27932: InstSimplify: Eliminate fabs on known positive

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 13:32:00 PST 2016


efriedma added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:2592
+    return !CFP->getValueAPF().isNegative() ||
+           (IncludeNeg0 && CFP->getValueAPF().isZero());
+  }
----------------
Maybe explicitly handle NaNs here to make it more clear?


================
Comment at: lib/Analysis/ValueTracking.cpp:2614
     if (I->getOperand(0) == I->getOperand(1))
       return true;
     LLVM_FALLTHROUGH;
----------------
IIRC, A*A->A if A is a NaN, so fabs(x*x) isn't equivalent to x*x.


https://reviews.llvm.org/D27932





More information about the llvm-commits mailing list