================
@@ -320,7 +321,11 @@ void TargetLoweringPass::runOnOperation() {
   mlir::ConversionTarget target(*mod.getContext());
   populateTargetLoweringConversionTarget(target, typeConverter);
 
-  if (failed(mlir::applyPartialConversion(mod, target, std::move(patterns))))
+  llvm::SmallVector<mlir::Operation *> ops;
+  ops.push_back(mod);
+  cir::collectUnreachable(mod, ops);
----------------
steffenlarsen wrote:

Unrelated to your changes, but I wonder whether `collectUnreachable` should do 
more of an effort to reserve space it the passed vector. I.e. 
https://github.com/llvm/llvm-project/blob/main/clang/lib/CIR/Dialect/Transforms/CIRTransformUtils.cpp#L42
 could reserve based on the size of `blk` (or use insertion). We can't do a 
full pre-reservation without doing two passes over, but at least that would 
avoid repeat allocations in the loop.

https://github.com/llvm/llvm-project/pull/224609
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to