[PATCH] D51216: Fix IRBuilder.CreateFCmp(X, X) misfolding

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 13 15:38:18 PST 2019


spatel added a comment.

Some IR tests added here:
rL353992 <https://reviews.llvm.org/rL353992>
I think that's better than IRBuilder tests. Feel free to add other predicates if you think they are needed, but I think those 4 give us good coverage.



================
Comment at: lib/IR/ConstantFold.cpp:1364
   // Handle degenerate case quickly
-  if (V1 == V2) return FCmpInst::FCMP_OEQ;
+  if (V1 == V2) return FCmpInst::FCMP_UEQ;
 
----------------
Can we assert that either V1 or V2 is a constant expression?
Either way, a bit more code comment (as suggested previously I think) would be helpful.
How about:
  // We do not know if a constant expression will evaluate to a number or NaN.
  // Therefore, we can only say that the relation is unordered or equal.



Repository:
  rL LLVM

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

https://reviews.llvm.org/D51216





More information about the llvm-commits mailing list