[IR Container] Phase 2.2 Fusion Statement Registration#5958
[IR Container] Phase 2.2 Fusion Statement Registration#5958mdavis36 wants to merge 1 commit intomd/dep-special-typesfrom
Conversation
|
Review updated until commit 54cd0fe Description
|
| Relevant files | |||||||
|---|---|---|---|---|---|---|---|
| Enhancement |
|
PR Reviewer Guide
Here are some key observations to aid the review process:
| 🧪 PR contains tests |
| ⚡ No major issues detected |
|
!test |
Inlines registerVal, registerExpr, removeVal, and removeExpr logic directly into Fusion, eliminating the delegation to IrContainer. This consolidates the registration path after per-Fusion special values were moved from IrContainer to Fusion. Also removes vestigial friend class StatementGuard from IrContainer (it only uses public Fusion API) and adds Fusion as a friend of IrContainerPasskey so it can construct passkeys for setName() calls.
1588d37 to
cf4ae4a
Compare
074c814 to
54cd0fe
Compare
|
!test |
Greptile SummaryThis PR moves statement registration (
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Before["Before (delegated)"]
A1["Fusion::registerVal(val)"] --> B1["IrContainer::registerVal(val)"]
B1 --> C1["vals_up_.emplace_back(val)"]
B1 --> D1["vals_.insert(val)"]
B1 --> E1["val->setName(...)"]
A2["Fusion::removeVal(val)"] --> B2["IrContainer::removeVal(val)"]
B2 --> C2["vals_up_.erase(...)"]
B2 --> D2["vals_.erase(val)"]
end
subgraph After["After (inlined in Fusion)"]
F1["Fusion::registerVal(val)"] --> G1["c->vals_up_.emplace_back(val)"]
F1 --> H1["c->vals_.insert(val)"]
F1 --> I1["val->setName(IrContainerPasskey(), ...)"]
F2["Fusion::removeVal(val)"] --> G2["c->vals_up_.erase(...)"]
F2 --> H2["c->vals_.erase(val)"]
end
Before -.->|"code motion"| After
Last reviewed commit: 54cd0fe |
Summary
Inline
registerVal,registerExpr,removeVal, andremoveExprlogic directly intoFusion, eliminating the delegation toIrContainer. This consolidates the statement registration path after per-Fusion special values, axioms, and metadata were moved to Fusion in PR #5954 .Key Changes
fusion.cpp:registerVal,registerExpr,removeVal,removeExprimplemented directly on Fusion, no longer delegating to IrContainercontainer.cpp: Remove registration/removal implementationscontainer.h: RemoveregisterVal/registerExpr/removeVal/removeExprdeclarations, remove vestigialfriend class StatementGuard(it only uses public Fusion API)container.h: AddFusionas friend ofIrContainerPasskeyso it can construct passkeys forsetName()callsWhy This Matters
Statement registration is the write path for container mutation. In Phase 2, when multiple Fusions share a container, registration must populate per-Fusion tracking maps (
per_fusion_vals_,per_fusion_exprs_). Having registration live in Fusion (which knowsthis— the owning Fusion) rather than in IrContainer (which doesn't know which Fusion is registering) is essential for correct per-Fusion tracking.Relationship to Phase 2
This is the final foundation change before the shared_ptr transition begins. Now Fusion is the single authority for:
CI Risk
Low. Pure code motion — identical behavior, just different call location. The registration logic is unchanged; only the method boundaries moved.