[mlir][sparse] fix switch statement bug on two binary ops
authorAart Bik <ajcbik@google.com>
Tue, 9 Aug 2022 16:39:58 +0000 (09:39 -0700)
committerAart Bik <ajcbik@google.com>
Tue, 9 Aug 2022 18:58:05 +0000 (11:58 -0700)
They appeared at the wrong place in the switch, treating
them as unary op rather than binary op.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D131509

mlir/unittests/Dialect/SparseTensor/MergerTest.cpp

index 621e502..a44f1f6 100644 (file)
@@ -260,8 +260,6 @@ protected:
     case kBitCast:
     case kBinaryBranch:
     case kUnary:
-    case kShlI:
-    case kBinary:
       return compareExpression(tensorExp.children.e0, pattern->e0);
     // Binary operations.
     case kMulF:
@@ -282,6 +280,8 @@ protected:
     case kXorI:
     case kShrS:
     case kShrU:
+    case kShlI:
+    case kBinary:
       return compareExpression(tensorExp.children.e0, pattern->e0) &&
              compareExpression(tensorExp.children.e1, pattern->e1);
     }