[Loom] Preserve C++ increment values and conditional mutations - #687
Merged
Merged
Conversation
Use one source update path for discarded and value-producing integer and pointer increments. Capture the old value for postfix expressions and return the narrowed or displaced value for prefix expressions while retaining pointer allocation identity. Retain conditional-expression mutation summaries in the existing source control analysis and join updated bindings with expression results. Each arm starts from the condition's resulting state, skipped operands publish their known boolean value, and translation snapshots only the bindings the expression can change.
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.
C/C++ prefix and postfix
++/--can now produce values from integer and pointer bindings. This admits ordinary pointer streams and conditional counters that previously failed import:Postfix expressions return the captured previous value; prefix expressions return the updated value. Updates use the existing promoted integer arithmetic and narrowing rules or provenance-preserving pointer displacement. Discarded increments use the same implementation.
&&,||, and?:now join modified source bindings alongside their expression results. Each arm starts with the state established by its condition, and skipped operands neither update bindings nor perform loads. The existing control analysis retains expression mutation facts in its single source traversal; translation consumes those facts and snapshots only changed bindings. Skipped logical operands publish their known boolean result directly.The standalone corpus adds exact byte/64-bit wrap, signed decrement, nested lazy expressions, condition mutations, loop updates, and guarded pointer streams. It checks 532 scalar VM cases and 17 GPU inputs both normally and with device access sanitization, including complete outputs, unchanged inputs, and guard values. The existing attention, RMSNorm, and SwiGLU examples retain byte-identical HSACO.
The admitted destinations remain owned automatic integer and pointer bindings. Memory-element, vector, floating-point, const, and volatile updates retain source diagnostics; this change does not introduce an implicit storage model for them.