Skip to content

Commit 9c18fae

Browse files
committed
Merge remote-tracking branch 'origin/main' into more-control
2 parents 4c4b31c + df24c19 commit 9c18fae

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel
1818
- ✨ Add conversions between `jeff` and QCO ([#1479], [#1548], [#1565], [#1637], [#1676], [#1706]) ([**@denialhaag**], [**@burgholzer**])
1919
- ✨ Add a `place-and-route` pass for mapping circuits to architectures with restricted topologies ([#1537], [#1547], [#1568], [#1581], [#1583], [#1588], [#1600], [#1664], [#1709], [#1716], [#1748]) ([**@MatthiasReumann**], [**@burgholzer**])
2020
- ✨ Add initial infrastructure for new QC and QCO MLIR dialects
21-
([#1264], [#1330], [#1402], [#1428], [#1430], [#1436], [#1443], [#1446], [#1464], [#1465], [#1470], [#1471], [#1472], [#1474], [#1475], [#1506], [#1510], [#1513], [#1521], [#1542], [#1548], [#1550], [#1554], [#1567], [#1569], [#1570], [#1572], [#1573], [#1580], [#1602], [#1620], [#1623], [#1624], [#1626], [#1627], [#1635], [#1638], [#1673], [#1675], [#1700], [#1717], [#1728], [#1730], [#1749])
21+
([#1264], [#1330], [#1402], [#1428], [#1430], [#1436], [#1443], [#1446], [#1464], [#1465], [#1470], [#1471], [#1472], [#1474], [#1475], [#1506], [#1510], [#1513], [#1521], [#1542], [#1548], [#1550], [#1554], [#1567], [#1569], [#1570], [#1572], [#1573], [#1580], [#1602], [#1620], [#1623], [#1624], [#1626], [#1627], [#1635], [#1638], [#1673], [#1675], [#1700], [#1717], [#1728], [#1730], [#1749], [#1762])
2222
([**@burgholzer**], [**@denialhaag**], [**@taminob**], [**@DRovara**], [**@li-mingbao**], [**@Ectras**], [**@MatthiasReumann**], [**@simon1hofmann**])
2323

2424
### Changed
@@ -402,6 +402,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool
402402

403403
<!-- PR links -->
404404

405+
[#1762]: https://github.com/munich-quantum-toolkit/core/pull/1762
405406
[#1749]: https://github.com/munich-quantum-toolkit/core/pull/1749
406407
[#1748]: https://github.com/munich-quantum-toolkit/core/pull/1748
407408
[#1737]: https://github.com/munich-quantum-toolkit/core/pull/1737

mlir/include/mlir/Dialect/QCO/QCOUtils.h

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ removeInversePairOneTargetZeroParameter(OpType op, PatternRewriter& rewriter) {
3434
return failure();
3535
}
3636

37-
// Unlink both operations
38-
rewriter.replaceOp(op, op.getInputQubits());
39-
rewriter.replaceOp(nextOp, nextOp.getInputQubits());
37+
// Erase both operations
38+
rewriter.replaceAllUsesWith(nextOp->getResult(0), op.getInputQubit(0));
39+
rewriter.eraseOp(nextOp);
40+
rewriter.eraseOp(op);
4041

4142
return success();
4243
}
@@ -64,9 +65,11 @@ removeInversePairTwoTargetZeroParameter(OpType op, PatternRewriter& rewriter) {
6465
return failure();
6566
}
6667

67-
// Unlink both operations
68-
rewriter.replaceOp(op, op.getInputQubits());
69-
rewriter.replaceOp(nextOp, nextOp.getInputQubits());
68+
// Erase both operations
69+
rewriter.replaceAllUsesWith(nextOp->getResults(),
70+
{op.getInputQubit(0), op.getInputQubit(1)});
71+
rewriter.eraseOp(nextOp);
72+
rewriter.eraseOp(op);
7073

7174
return success();
7275
}
@@ -96,9 +99,11 @@ removeTwoTargetZeroParameterPairWithSwappedTargets(OpType op,
9699
return failure();
97100
}
98101

99-
// Unlink both operations
100-
rewriter.replaceOp(op, op.getInputQubits());
101-
rewriter.replaceOp(nextOp, nextOp.getInputQubits());
102+
// Erase both operations
103+
rewriter.replaceAllUsesWith(nextOp->getResults(),
104+
{op.getInputQubit(1), op.getInputQubit(0)});
105+
rewriter.eraseOp(nextOp);
106+
rewriter.eraseOp(op);
102107

103108
return success();
104109
}
@@ -196,6 +201,7 @@ LogicalResult mergeTwoTargetOneParameter(OpType op, PatternRewriter& rewriter) {
196201

197202
// Replace the second operation with the result of the first operation
198203
rewriter.replaceOp(nextOp, op.getResults());
204+
199205
return success();
200206
}
201207

@@ -236,6 +242,7 @@ mergeTwoTargetOneParameterWithSwappedTargets(OpType op,
236242

237243
// nextOp results correspond to swapped operands, so swap replacements too
238244
rewriter.replaceOp(nextOp, {op.getOutputQubit(1), op.getOutputQubit(0)});
245+
239246
return success();
240247
}
241248

0 commit comments

Comments
 (0)