File tree Expand file tree Collapse file tree 2 files changed +2
-12
lines changed
Expand file tree Collapse file tree 2 files changed +2
-12
lines changed Original file line number Diff line number Diff line change @@ -109,12 +109,7 @@ struct CtrlInlineGPhase final : OpRewritePattern<CtrlOp> {
109109} // namespace
110110
111111UnitaryOpInterface 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
120115size_t CtrlOp::getNumQubits () { return getNumTargets () + getNumControls (); }
Original file line number Diff line number Diff line change @@ -142,12 +142,7 @@ struct CtrlInlineId final : OpRewritePattern<CtrlOp> {
142142} // namespace
143143
144144UnitaryOpInterface 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
153148size_t CtrlOp::getNumQubits () { return getNumTargets () + getNumControls (); }
You can’t perform that action at this time.
0 commit comments