[mlir] Change verification order to prevent null dereference
authorTres Popp <tpopp@google.com>
Tue, 13 Apr 2021 15:31:41 +0000 (17:31 +0200)
committerTres Popp <tpopp@google.com>
Wed, 14 Apr 2021 07:33:17 +0000 (09:33 +0200)
Differential Revision: https://reviews.llvm.org/D100390

mlir/lib/Dialect/Vector/VectorTransforms.cpp

index 3bb333c..2af0b36 100644 (file)
@@ -2556,13 +2556,13 @@ LogicalResult mlir::vector::splitFullAndPartialTransfer(
          "Expected splitFullAndPartialTransferPrecondition to hold");
   auto xferReadOp = dyn_cast<vector::TransferReadOp>(xferOp.getOperation());
 
-  if (xferReadOp.mask())
-    return failure();
-
   // TODO: add support for write case.
   if (!xferReadOp)
     return failure();
 
+  if (xferReadOp.mask())
+    return failure();
+
   OpBuilder::InsertionGuard guard(b);
   if (Operation *sourceOp = xferOp.source().getDefiningOp())
     b.setInsertionPointAfter(sourceOp);