smite-ir: split determinism out of has_side_effects - #198
Open
devvaansh wants to merge 1 commit into
Open
Conversation
devvaansh
force-pushed
the
operation-is-deterministic
branch
from
August 10, 2026 16:13
6891208 to
ef5f24c
Compare
LookupShortChannelId is a read-only operation, but it was marked as having side effects to stop CSE from merging two lookups whose results differ. Add is_deterministic and is_pure so CSE and the reorder mutator can ask about purity while DCE keeps asking about side effects.
devvaansh
force-pushed
the
operation-is-deterministic
branch
from
August 10, 2026 19:34
ef5f24c to
9b4dcf2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up to #155, where we agreed
LookupShortChannelIddoesn't really have side effects and that CSE wants a separate question answered.has_side_effectswas being asked three different questions by three callers: DCE wants to know whether an instruction can be dropped, CSE wants to know whether two instructions can be merged, andInstructionReorderMutatorwants to know whether an instruction's position matters. Those coincide for every operation we had untilLookupShortChannelId, which is read-only but nondeterministic, so it was marked as side-effecting to keep CSE away from it.Add
is_deterministic, andis_pureon top of it, so each caller asks what it actually means. DCE keeps usinghas_side_effects, while CSE and the reorder mutator switch tois_pure.LookupShortChannelIdbecomes side-effect free and nondeterministic, andCreateFundingTransactionand theRecvoperations are marked nondeterministic too since their results come from the wallet and from the target.The only behavior change is that DCE can now drop a
LookupShortChannelIdwhose result nothing consumes. I checked every operation, and it is the only one where!is_pure()differs fromhas_side_effects(), so CSE's skip set and the reorder mutator's candidate set are unchanged.Ref: #155