diff --git a/lib/HAL/TargetSystem.cpp b/lib/HAL/TargetSystem.cpp index 6948d78db..8993e5187 100644 --- a/lib/HAL/TargetSystem.cpp +++ b/lib/HAL/TargetSystem.cpp @@ -80,6 +80,11 @@ llvm::Expected TargetInstrument::getModule(mlir::ModuleOp parentModuleOp) { for (auto childModuleOp : parentModuleOp.getBody()->getOps()) { + // Check for a QUIR module. If no quir.nodeType, skip this module. + // This likely indicates it is the `main` module + if (!childModuleOp->hasAttrOfType("quir.nodeType")) + continue; + auto moduleNodeType = childModuleOp->getAttrOfType("quir.nodeType"); auto moduleNodeId = mlir::quir::getNodeId(childModuleOp);