[Mlir-commits] [mlir] [RFC][mlir][func] Enforce func.return as sole terminator in func.func regions (PR #184778)

Jakub Kuderski llvmlistbot at llvm.org
Thu Mar 5 07:17:27 PST 2026


================
@@ -1607,6 +1627,11 @@ struct TestLegalizePatternDriver
       return llvm::none_of(op.getOperandTypes(),
                            [](Type type) { return type.isF32(); });
     });
+    target.addDynamicallyLegalOp<func::ReturnOp>([](func::ReturnOp op) {
+      // Don't allow F32 operands (mirroring TestReturnOp rule).
+      return llvm::none_of(op.getOperandTypes(),
+                           [](Type type) { return type.isF32(); });
----------------
kuhar wrote:

you could also do 
```suggestion
                           llvm::IsaPred<Float32Type>);
```

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


More information about the Mlir-commits mailing list