[PATCH] D37427: [InstCombine] canonicalize fcmp ord/uno with constants to null constant

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 13:00:39 PDT 2017


spatel added inline comments.


================
Comment at: lib/IR/Constants.cpp:224
+    if (isa<UndefValue>(Elt))
+      continue;
+    auto *CElt = dyn_cast<ConstantFP>(Elt);
----------------
efriedma wrote:
> This handling of undef makes sense where you're using it, but is a bit weird for a function named "isKnownNeverNaN".
> 
> Would it make sense for this to be a utility that operates on arbitrary values, rather than constants?  For example, we can assume the result of an sitofp is never a NaN.
Sure - I stole the name from the DAG version:
bool SelectionDAG::isKnownNeverNaN(SDValue Op) const 

We'd add it to ValueTracking for the IR version?


https://reviews.llvm.org/D37427





More information about the llvm-commits mailing list