[Mlir-commits] [mlir] f17453e - [mlir][memref] Add SCFDialect dependency to RuntimeOpVerification (#205241)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Jun 23 06:20:55 PDT 2026


Author: Longsheng Mou
Date: 2026-06-23T21:20:51+08:00
New Revision: f17453ef75fc4acb0bb8c149bfcc07409881676e

URL: https://github.com/llvm/llvm-project/commit/f17453ef75fc4acb0bb8c149bfcc07409881676e
DIFF: https://github.com/llvm/llvm-project/commit/f17453ef75fc4acb0bb8c149bfcc07409881676e.diff

LOG: [mlir][memref] Add SCFDialect dependency to RuntimeOpVerification (#205241)

Explicitly load SCFDialect as a dependent dialect in
RuntimeOpVerification to avoid unregistered dialect errors when
generating `scf.if`/`scf.yield` ops. Fixes #204295.

Added: 
    

Modified: 
    mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
    mlir/test/Dialect/MemRef/runtime-verification.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
index e5cc41e2c43ba..d7fdedce415d9 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp
@@ -418,6 +418,6 @@ void mlir::memref::registerRuntimeVerifiableOpInterfaceExternalModels(
 
     // Load additional dialects of which ops may get created.
     ctx->loadDialect<affine::AffineDialect, arith::ArithDialect,
-                     cf::ControlFlowDialect>();
+                     cf::ControlFlowDialect, scf::SCFDialect>();
   });
 }

diff  --git a/mlir/test/Dialect/MemRef/runtime-verification.mlir b/mlir/test/Dialect/MemRef/runtime-verification.mlir
index 28777a3e88672..2198f0032aff5 100644
--- a/mlir/test/Dialect/MemRef/runtime-verification.mlir
+++ b/mlir/test/Dialect/MemRef/runtime-verification.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt %s -generate-runtime-verification -cse | FileCheck %s
+// RUN: mlir-opt %s -generate-runtime-verification -cse -split-input-file | FileCheck %s
 
 // CHECK-LABEL: func @expand_shape(
 //  CHECK-SAME:     %[[m:.*]]: memref<?xf32>
@@ -13,3 +13,16 @@ func.func @expand_shape(%m: memref<?xf32>, %sz0: index) -> memref<?x5xf32> {
   %0 = memref.expand_shape %m [[0, 1]] output_shape [%sz0, 5] : memref<?xf32> into memref<?x5xf32>
   return %0 : memref<?x5xf32>
 }
+
+// -----
+
+// Ensure the SCF dialect is loaded.
+
+// CHECK-LABEL: func @subview(
+// CHECK:       scf.if
+func.func @subview(%memref: memref<1xf32>, %offset: index) {
+  memref.subview %memref[%offset] [1] [1] : 
+      memref<1xf32> to 
+      memref<1xf32, strided<[1], offset: ?>>
+  return
+}


        


More information about the Mlir-commits mailing list