ZIR-212: restore eval's skip-terminator behavior; bibc decoder adds ReturnOp #51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BigInt::eval
formerly tried to skip a BigInt function's terminator op, usingwithout_terminator()
, but this appeared to be an error, because the BigInt dialect does not define any terminator ops. This came up because the last operation (usually an EqZ) would be skipped when running the evaluator on functions decoded from bytecode. I therefore deleted thewithout_terminator()
call, in one of the later changes rolled into aac967b.Looking deeper, however, this leaves us with an inconsistency: the edsl finishes each BigInt function off with a
ReturnOp
, which the bibc encoder skips; the bibc decoder does not re-insert thisReturnOp
when reconstituting bytecode into MLIR ops, and that is why the evaluator was skipping the last real operation instead.This change makes it all consistent again: the edsl continues to add a
ReturnOp
which everyone else will ignore, the bibc decoder now also inserts such an op for consistency, and the evaluator once again skips theReturnOp
instead of throwing.(Deleting the
ReturnOp
everywhere would also be a reasonable solution to this problem, but the edsl is older than the bibc system, so I am deferring to its design here.)