Skip to content

Commit ff1bb2a

Browse files
* Addressing review comments
Signed-off-by: Pradnya Khalate <[email protected]>
1 parent 56d1e48 commit ff1bb2a

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

include/cudaq/Optimizer/CodeGen/Passes.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ def QirInsertArrayRecord : Pass<"qir-insert-array-record", "mlir::ModuleOp"> {
139139
}];
140140
let dependentDialects = ["quake::QuakeDialect", "cudaq::cc::CCDialect",
141141
"mlir::LLVM::LLVMDialect"];
142-
let constructor = "cudaq::opt::createQirInsertArrayRecord()";
143142
}
144143

145144
def RemoveMeasurements : Pass<"remove-measurements"> {

lib/Optimizer/CodeGen/QirInsertArrayRecord.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,31 +189,25 @@ struct QirInsertArrayRecordPass
189189

190190
void runOnOperation() override {
191191
ModuleOp module = getOperation();
192-
module.walk([&](func::FuncOp funcOp) {
192+
for (auto funcOp : module.getOps<func::FuncOp>()) {
193193
if (!funcOp || funcOp.empty() ||
194194
!funcOp->hasAttr(cudaq::entryPointAttrName) ||
195195
funcOp->hasAttr(cudaq::runtime::enableCudaqRun))
196-
return WalkResult::advance();
196+
continue;
197197

198198
AllocaMeasureStoreAnalysis analysis(funcOp);
199199
if (analysis.arraySize == 0)
200-
return WalkResult::advance();
200+
continue;
201201

202202
LLVM_DEBUG(llvm::dbgs() << "Before adding array recording call:\n"
203203
<< *funcOp);
204204
if (failed(insertArrayRecordingCalls(funcOp, analysis.arraySize,
205205
analysis.allocaOps,
206206
analysis.firstMeasurementOp)))
207-
return WalkResult::interrupt();
207+
return signalPassFailure();
208208
LLVM_DEBUG(llvm::dbgs() << "After adding array recording call:\n"
209209
<< *funcOp);
210-
211-
return WalkResult::advance();
212-
});
210+
}
213211
}
214212
};
215213
} // namespace
216-
217-
std::unique_ptr<Pass> cudaq::opt::createQirInsertArrayRecord() {
218-
return std::make_unique<QirInsertArrayRecordPass>();
219-
}

0 commit comments

Comments
 (0)