[llvm] [DAG] SDPatternMatch - add matching for SELECT_CC patterns to min/max like matchers (PR #147071)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 8 09:06:03 PDT 2025


================
@@ -655,6 +655,23 @@ struct MaxMin_match {
 
   template <typename MatchContext>
   bool match(const MatchContext &Ctx, SDValue N) {
+    auto MatchMinMax = [&](SDValue L, SDValue R, SDValue TrueValue,
+                           SDValue FalseValue, ISD::CondCode CC) {
+      if ((TrueValue != L || FalseValue != R) &&
+          (TrueValue != R || FalseValue != L)) {
+        return false;
+      }
+
+      ISD::CondCode Cond =
+          TrueValue == L ? CC : getSetCCInverse(CC, L.getValueType());
+      if (!Pred_t::match(Cond)) {
----------------
mshockwave wrote:

maybe we can use this opportunity to drop curly braces

https://github.com/llvm/llvm-project/pull/147071


More information about the llvm-commits mailing list