♻️ Use WireIterator in MergeSingleQubitRotationGates #1674
Conversation
WireIterator in MergeSingleQubitRotationGates WireIterator in MergeSingleQubitRotationGates
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughRefactors MergeSingleQubitRotationGates to use pointer-based operation checks and replaces SSA-user traversal with qubit-wire traversal via ChangesMerge pass -> WireIterator integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@mlir/lib/Dialect/QCO/Utils/WireIterator.cpp`:
- Around line 87-95: In backward() guard against op_ being nullptr before the
TypeSwitch<Operation*>(op_) so we don't dereference op in the .Default() path;
check if op_ == nullptr and handle it (e.g., return/stop iteration) prior to the
TypeSwitch, and apply the same nullptr guard for the other similar occurrence
around the code that uses op->getName() (the block using report_fatal_error and
the cases for UnitaryOpInterface, MeasureOp, ResetOp) so report_fatal_error is
never called on a null op_.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b0f0a221-5b5b-4450-b4d5-449e67738d0e
📒 Files selected for processing (2)
mlir/lib/Dialect/QCO/Transforms/Optimizations/MergeSingleQubitRotationGates.cppmlir/lib/Dialect/QCO/Utils/WireIterator.cpp
|
@MatthiasReumann would you mind resolving the conflicts stemming from #1673 before I take a look here? |
Signed-off-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com>
Should be done. 👍 |
…github.com/munich-quantum-toolkit/core into enh/use-wireiterator-in-merge-1q-rotations
Signed-off-by: burgholzer <burgholzer@me.com>
burgholzer
left a comment
There was a problem hiding this comment.
LGTM 👍🏼
It does not save much here, but still feels rather clean.
Description
While looking at the pass I noticed an opportunity to utilize the wire iterator. Hence, this pull request. Cherry-picks the wire iterator changes introduced in #1600 to support tensors.
Checklist
If PR contains AI-assisted content:
Assisted-by: [Model Name] via [Tool Name]footer.