Skip to content
Commit 991adadc authored by Alex Zinenko's avatar Alex Zinenko Committed by jpienaar
Browse files

Move the ReturnOp type checks to ReturnOp::verify.

This was left as a TODO in the code.  Move the type verification from
MLFuncVerifier::verifyReturn to ReturnOp::verify.  Since the return operation
can only appear as the last statement of an MLFunction, i.e. where the
surrounding block is the function itself, it is easy to access the function
descriptor (ReturnOp::verify already relies on this).  From the function
descriptor, one can easily access the type information.  Note that this
slightly modifies the error message due to the use of emitOpError instead of a
plain emitError.

Drop the obsolete TODO comment in MLFunction::verify about checking that
"return" only appears as the last operation of an MLFunction since
ReturnOp::verify explicitly checks for that.
PiperOrigin-RevId: 218347843
parent d58ffaff
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment