[InstCombine] Call getCmpPredicateForMinMax only with a valid SPF
[oota-llvm.git] / include / llvm / Analysis / ValueTracking.h
index b34d6bac1f3421c45fc5bd698176dde6804ea08c..eb2c000e07cd51d972a66dd6af07027e53151e1a 100644 (file)
@@ -412,6 +412,11 @@ namespace llvm {
     bool Ordered;               /// When implementing this min/max pattern as
                                 /// fcmp; select, does the fcmp have to be
                                 /// ordered?
+
+    /// \brief Return true if \p SPF is a min or a max pattern.
+    static bool isMinOrMax(SelectPatternFlavor SPF) {
+      return !(SPF == SPF_UNKNOWN || SPF == SPF_ABS || SPF == SPF_NABS);
+    }
   };
   /// Pattern match integer [SU]MIN, [SU]MAX and ABS idioms, returning the kind
   /// and providing the out parameter results if we successfully match.