[Mlir-commits] [mlir] [mlir][transform] Add an op for replacing values with function calls (PR #78398)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Wed Jan 17 01:58:13 PST 2024


================
@@ -36,6 +37,202 @@ transform::ApplyFuncToLLVMConversionPatternsOp::verifyTypeConverter(
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// CastAndCallOp
+//===----------------------------------------------------------------------===//
+
+DiagnosedSilenceableFailure
+transform::CastAndCallOp::apply(transform::TransformRewriter &rewriter,
+                                transform::TransformResults &results,
+                                transform::TransformState &state) {
+  SmallVector<Value> inputs;
+  if (getInputs())
+    for (Value input : state.getPayloadValues(getInputs()))
+      inputs.push_back(input);
----------------
ftynse wrote:

`llvm::append_range` should work, here and below.  Otherwise, try at least `inputs.reserve(llvm::range_size(..))` before pushing back in a loop.

https://github.com/llvm/llvm-project/pull/78398


More information about the Mlir-commits mailing list