[Mlir-commits] [mlir] [mlir][sparse] allow YieldOp to yield multiple values. (PR #87261)

Aart Bik llvmlistbot at llvm.org
Mon Apr 1 10:07:11 PDT 2024


================
@@ -1302,14 +1304,24 @@ def SparseTensor_YieldOp : SparseTensor_Op<"yield", [Pure, Terminator]>,
   let builders = [
     OpBuilder<(ins),
     [{
-      build($_builder, $_state, Value());
+      build($_builder, $_state, ValueRange());
+    }]>,
+    OpBuilder<(ins "Value":$yieldVal),
+    [{
+      build($_builder, $_state, ValueRange(yieldVal));
     }]>
   ];
 
+  let extraClassDeclaration = [{
+     Value getSingleResult() {
----------------
aartbik wrote:

bool hasSingleResult() {
  return getResults.size() == 1;
}
Value getSingleResult() {
  assert(hasSingleResult()); 
  return getResults().front();
     }
  

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


More information about the Mlir-commits mailing list