Skip to content

Commit 5fae654

Browse files
committed
Revert ":bug: Fix qc(o)::CtrlOp::getBodyUnitary() for ops with params"
This reverts the following commits: * 5a3f2de * 47b6798
1 parent 6d88bb6 commit 5fae654

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

mlir/lib/Dialect/QC/IR/Modifiers/CtrlOp.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,7 @@ struct CtrlInlineGPhase final : OpRewritePattern<CtrlOp> {
109109
} // namespace
110110

111111
UnitaryOpInterface CtrlOp::getBodyUnitary() {
112-
for (auto&& op : getBody()->getOperations()) {
113-
if (auto&& unitaryOp = llvm::dyn_cast<UnitaryOpInterface>(&op)) {
114-
return unitaryOp;
115-
}
116-
}
117-
return nullptr;
112+
return llvm::dyn_cast<UnitaryOpInterface>(&getBody()->front());
118113
}
119114

120115
size_t CtrlOp::getNumQubits() { return getNumTargets() + getNumControls(); }

mlir/lib/Dialect/QCO/IR/Modifiers/CtrlOp.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,7 @@ struct CtrlInlineId final : OpRewritePattern<CtrlOp> {
142142
} // namespace
143143

144144
UnitaryOpInterface CtrlOp::getBodyUnitary() {
145-
for (auto&& op : getBody()->getOperations()) {
146-
if (auto&& unitaryOp = llvm::dyn_cast<UnitaryOpInterface>(&op)) {
147-
return unitaryOp;
148-
}
149-
}
150-
return nullptr;
145+
return llvm::dyn_cast<UnitaryOpInterface>(&getBody()->front());
151146
}
152147

153148
size_t CtrlOp::getNumQubits() { return getNumTargets() + getNumControls(); }

0 commit comments

Comments
 (0)