88 * Licensed under the MIT License
99 */
1010
11- #include " Helpers.h"
1211#include " ir/Definitions.hpp"
1312#include " ir/QuantumComputation.hpp"
1413#include " ir/operations/Control.hpp"
@@ -183,9 +182,7 @@ struct ToQuantumComputationPattern final : mlir::OpRewritePattern<AllocOp> {
183182 findQubitIndex (val, currentQubitVariables));
184183 }
185184 // Get the qubit index of the target qubit (if already collected).
186- if (!in.empty ()) {
187185 targetIndex[0 ] = findQubitIndex (in[0 ], currentQubitVariables);
188- }
189186 if (in.size () > 1 ) {
190187 targetIndex[1 ] = findQubitIndex (in[1 ], currentQubitVariables);
191188 }
@@ -206,9 +203,7 @@ struct ToQuantumComputationPattern final : mlir::OpRewritePattern<AllocOp> {
206203 currentQubitVariables[negCtrlInsIndices[i]] =
207204 outs[i + 1 + posCtrlInsIndices.size ()];
208205 }
209- if (!op.getOutQubits ().empty ()) {
210- currentQubitVariables[targetIndex[0 ]] = outs[0 ];
211- }
206+ currentQubitVariables[targetIndex[0 ]] = outs[0 ];
212207 if (op.getOutQubits ().size () > 1 ) {
213208 currentQubitVariables[targetIndex[1 ]] = outs[1 ];
214209 }
@@ -230,8 +225,6 @@ struct ToQuantumComputationPattern final : mlir::OpRewritePattern<AllocOp> {
230225 parameters.emplace_back (param);
231226 }
232227 }
233- auto x = helpers::getParameters (op);
234- parameters.insert (parameters.end (), x.begin (), x.end ());
235228
236229 if (op.getOutQubits ().size () > 1 ) {
237230 circuit.emplace_back <qc::StandardOperation>(
@@ -372,7 +365,7 @@ struct ToQuantumComputationPattern final : mlir::OpRewritePattern<AllocOp> {
372365
373366 std::string regName;
374367 llvm::raw_string_ostream os (regName);
375- os << " q " ;
368+ op. getResult (). print (os) ;
376369
377370 circuit.addQubitRegister (numQubits, regName);
378371 circuit.addClassicalRegister (numQubits);
0 commit comments