[PATCH] D89038: [PatternMatch] Add new FP matchers. NFC.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 03:37:05 PDT 2020


RKSimon added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4039
                           Q.CxtI->hasNoSignedZeros();
-  const APFloat *C;
-  if (HasNoSignedZeros || (match(T, m_APFloat(C)) && C->isNonZero()) ||
-                          (match(F, m_APFloat(C)) && C->isNonZero())) {
+  if (HasNoSignedZeros || match(T, m_NonZeroFP()) || match(F, m_NonZeroFP())) {
     // (T == F) ? T : F --> F
----------------
I'd expect this now to work for non-uniform vectors that contain different non-zero float values (and also undefs) - can we add test coverage for this please?


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:5297
   //   X > C1 ? C1 : Max(X, C2) --> Min(C1, Max(X, C2))
   // and return description of the outer Max/Min.
 
----------------
Ideally this function needs extending to support non-uniform vectors as well.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:5310
   const APFloat *FC1;
-  if (CmpRHS != TrueVal || !match(CmpRHS, m_APFloat(FC1)) || !FC1->isFinite())
+  if (CmpRHS != TrueVal || !match(CmpRHS, m_Finite(FC1)))
     return {SPF_UNKNOWN, SPNB_NA, false};
----------------
m_APFloat didn't match constant vectors containing undefs but m_Finite will? Again, we need test coverage for this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89038



More information about the llvm-commits mailing list