[PATCH] D67126: [GVN/FP] Considate logic for reasoning about equality vs equivalance for floats

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 14:20:57 PDT 2019


arsenm added inline comments.


================
Comment at: lib/Transforms/Scalar/GVN.cpp:1394
+
+  // Floating point comparisons can be equal, but not equivelent.  Cases:
+  // NaNs for unordered operators
----------------
Spelling, equivalent


================
Comment at: lib/Transforms/Scalar/GVN.cpp:1407-1408
+      // indicator that relaxed FP semantics are being used.
+      if (isa<ConstantFP>(LHS) && !cast<ConstantFP>(LHS)->isZero())
+        return true;
+      if (isa<ConstantFP>(RHS) && !cast<ConstantFP>(RHS)->isZero())
----------------
This won't handle vectors


================
Comment at: lib/Transforms/Scalar/GVN.cpp:1429
+      // equivalence. 
+      // FIXME: We should do this optimization if 'no signed zeros' is
+      // applicable via an instruction-level fast-math-flag or some other
----------------
xbolva00 wrote:
> reames wrote:
> > xbolva00 wrote:
> > > Cmp->getFastMathFlags().noSignedZeros() ?
> > a) I just moved the todo
> > b) See the comment about not considering myself particularly FP knowledgeable.  
> Ok, no problem
I think you are looking for llvm::CannotBeNegativeZero


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67126





More information about the llvm-commits mailing list