[PATCH] D148575: ValueTracking: Handle cannotBeOrderedLessThanZero for fadd

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 04:51:58 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4751
+        Op->getOpcode() == Instruction::FAdd &&
+        (InterestedClasses & (fcNegative & ~fcNegZero)) != fcNone;
+    bool WantNaN = (InterestedClasses & fcNan) != fcNone;
----------------
Use OrderedLessThanZeroMask?


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4763
+        (WantNegative && KnownRHS.cannotBeOrderedLessThanZero()) ||
+        KnownRHS.isKnownNeverNegZero() || Opc == Instruction::FSub) {
       // RHS is canonically cheaper to compute. Skip inspecting the LHS if
----------------
Even if !KnownRHS.isKnownNeverNegZero it is still worth calculating KnownLHS, because it might be isKnownNeverNegZero.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4766
       // there's no point.
       computeKnownFPClass(Op->getOperand(0), DemandedElts, fcNan | fcInf,
                           KnownLHS, Depth + 1, Q, TLI);
----------------
Surely need more stuff in InterestedClasses for the recursive call?


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4778
+            KnownRHS.cannotBeOrderedLessThanZero())
+          Known.knownNot(fcNegative & ~fcNegZero);
+
----------------
Use OrderedLessThanZeroMask?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148575/new/

https://reviews.llvm.org/D148575



More information about the llvm-commits mailing list