[Mlir-commits] [mlir] [mlir] Fix segfault in gpu.launch verifier when body region is empty (PR #182086)

Darshan Bhat llvmlistbot at llvm.org
Thu Feb 19 10:29:36 PST 2026


================
@@ -892,10 +892,12 @@ LogicalResult LaunchOp::verifyRegions() {
   // Kernel launch takes kNumConfigOperands leading operands for grid/block
   // sizes and transforms them into kNumConfigRegionAttributes region arguments
   // for block/thread identifiers and grid/block sizes.
-  if (!getBody().empty()) {
-    if (getBody().getNumArguments() <
-        kNumConfigRegionAttributes + getNumWorkgroupAttributions())
-      return emitOpError("unexpected number of region arguments");
+  if (getBody().empty()) {
+    return emitOpError("body region is empty");
+  }
----------------
darshan-opensource wrote:

But I still feel it is safer to do an early return when the body is empty. 

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


More information about the Mlir-commits mailing list