llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-mlir Author: Matthias Springer (matthias-springer) <details> <summary>Changes</summary> Verify that tokens are not used as forwarded values in `BranchOpInterface` and `RegionBranchOpInterface`. The existing verification is ODS-only. This commit adds verification for ops that implement one of these interfaces and are not defined in ODS. Depends on #<!-- -->195640. --- Full diff: https://github.com/llvm/llvm-project/pull/197131.diff 1 Files Affected: - (modified) mlir/lib/Interfaces/ControlFlowInterfaces.cpp (+14) ``````````diff diff --git a/mlir/lib/Interfaces/ControlFlowInterfaces.cpp b/mlir/lib/Interfaces/ControlFlowInterfaces.cpp index c3fb73acf5ef0..be97c3740e1b6 100644 --- a/mlir/lib/Interfaces/ControlFlowInterfaces.cpp +++ b/mlir/lib/Interfaces/ControlFlowInterfaces.cpp @@ -91,6 +91,13 @@ detail::verifyBranchSuccessorOperands(Operation *op, unsigned succNo, << ", but target block has " << destBB->getNumArguments(); + // Check that no token type is used as a forwarded operand. + for (Value operand : operands.getForwardedOperands()) { + if (isa<TokenType>(operand.getType())) + return op->emitError() + << "token type is not allowed as a forwarded operand"; + } + // Check the types. LDBG() << "Checking type compatibility for " << (operandCount - operands.getProducedOperandCount()) @@ -203,6 +210,13 @@ LogicalResult detail::verifyRegionBranchOpInterface(Operation *op) { << " inputs"; } + // Verify that no token type is used as a forwarded operand. + for (Value operand : succOperands) { + if (isa<TokenType>(operand.getType())) + return emitRegionEdgeError() + << ": token type is not allowed as a forwarded operand"; + } + // Verify that the types are compatible. TypeRange succInputTypes = succInputs.getTypes(); TypeRange succOperandTypes = succOperands.getTypes(); `````````` </details> https://github.com/llvm/llvm-project/pull/197131 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
