✨ Add a pass specializing callees for what is known at their call sites - #2197
Open
DRovara wants to merge 2 commits into
Open
✨ Add a pass specializing callees for what is known at their call sites#2197DRovara wants to merge 2 commits into
DRovara wants to merge 2 commits into
Conversation
This was referenced Aug 20, 2026
DRovara
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 20, 2026 18:33
7a39cb5 to
11a067f
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
DRovara
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 24, 2026 09:33
11a067f to
b4f0800
Compare
DRovara
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 24, 2026 09:52
b4f0800 to
bcf64f6
Compare
DRovara
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 25, 2026 07:50
bcf64f6 to
b3697de
Compare
DRovara
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 25, 2026 08:02
b3697de to
99467de
Compare
DRovara
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 25, 2026 10:48
99467de to
47aaea4
Compare
burgholzer
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 25, 2026 21:44
47aaea4 to
458d47c
Compare
DRovara
force-pushed
the
mlir/context-sensitive-specialization
branch
2 times, most recently
from
August 26, 2026 14:11
08fcbf9 to
857d4fe
Compare
DRovara
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 26, 2026 14:34
857d4fe to
3d9f620
Compare
DRovara
marked this pull request as ready for review
August 26, 2026 14:37
DRovara
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 27, 2026 11:40
3d9f620 to
e28d0eb
Compare
DRovara
force-pushed
the
mlir/context-sensitive-specialization
branch
2 times, most recently
from
August 28, 2026 07:28
57f1a36 to
40d0f77
Compare
DRovara
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 28, 2026 08:11
40d0f77 to
301b341
Compare
burgholzer
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 28, 2026 12:30
301b341 to
eabcd73
Compare
Specialize callees from values known at their call sites and cover the interprocedural behavior. Assisted-by: Claude Opus 5 <noreply@anthropic.com> Assisted-by: Codex
burgholzer
force-pushed
the
mlir/context-sensitive-specialization
branch
from
August 30, 2026 14:21
eabcd73 to
6f34e3e
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.
🤖 AI text below 🤖
Description
Fourth of a stack replacing #1970. Builds on #2196. First of the four interprocedural passes; the
quantum-ipopipeline that schedules them arrives in the final slice.quantum-context-sensitive-specializationredirects afunc.callto a specialized copy of its callee whenever the call site pins something down: a qubit argument known to be in |0>, which lets operations that fix |0> be dropped; one known to be in |+>, which lets anxbe dropped; or a compile-time constant rotation angle from a small distinguished set, which is folded into the copy.Copies are shared between call sites with the same context. A callee left without callers is erased, but only when this pass created that situation — unrelated unused functions are left alone, since removing those is the user's decision. Specializations are private, so specializing a public callee neither exports the generated symbol nor leaves it behind once it loses its callers.
IPOUtils.{h,cpp}holds the two helpers the interprocedural passes share; the sibling passes in later slices reuse them.Testing
19 cases in
test_qco_context_sensitive_specialization.cpp, covering the |0>, |+> and constant-angle paths plus specialization reuse across call sites and the negative cases that must not specialize.They are scheduled on
createContextSensitiveSpecialization()alone rather than on a pipeline, per the review comment on the original PR: running each case through the full pipeline made it hard to tell which stage established the result and let one stage mask a regression in another.IPOTestFixture.hcarries the fixture the sibling passes will share, and each suite names itself after its pass.optimizations 140.
AI assistance
Code and this description were produced with Claude Code (Opus 5) and Codex, acting on my instructions and within the scope I authorized.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).