[Mlir-commits] [mlir] c000b40 - [mlir] Avoid unnecessary copies in SCF's OneToNTypeConversions. (NFC)
Ingo Müller
llvmlistbot at llvm.org
Fri Jul 7 02:15:36 PDT 2023
Author: Ingo Müller
Date: 2023-07-07T09:15:30Z
New Revision: c000b403fcae6272779686ab82eb777ca3fd6d77
URL: https://github.com/llvm/llvm-project/commit/c000b403fcae6272779686ab82eb777ca3fd6d77
DIFF: https://github.com/llvm/llvm-project/commit/c000b403fcae6272779686ab82eb777ca3fd6d77.diff
LOG: [mlir] Avoid unnecessary copies in SCF's OneToNTypeConversions. (NFC)
In two places, a ResultRange was copied into a SmallVector just to be
passed as a ValueRange argument. With this patch, the ResultRanges are
passed directly, avoiding a copy.
Reviewed By: ingomueller-net
Differential Revision: https://reviews.llvm.org/D154685
Added:
Modified:
mlir/lib/Dialect/SCF/Transforms/OneToNTypeConversion.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/SCF/Transforms/OneToNTypeConversion.cpp b/mlir/lib/Dialect/SCF/Transforms/OneToNTypeConversion.cpp
index 9fd266bc44c687..d47543a8ad6bee 100644
--- a/mlir/lib/Dialect/SCF/Transforms/OneToNTypeConversion.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/OneToNTypeConversion.cpp
@@ -50,8 +50,7 @@ class ConvertTypesInSCFIfOp : public OneToNOpConversionPattern<IfOp> {
rewriter.inlineRegionBefore(op.getElseRegion(), newOp.getElseRegion(),
newOp.getElseRegion().end());
- rewriter.replaceOp(op, SmallVector<Value>(newOp->getResults()),
- resultMapping);
+ rewriter.replaceOp(op, newOp->getResults(), resultMapping);
return success();
}
};
@@ -95,8 +94,7 @@ class ConvertTypesInSCFWhileOp : public OneToNOpConversionPattern<WhileOp> {
rewriter.inlineRegionBefore(op.getRegion(i), dstRegion, dstRegion.end());
}
- rewriter.replaceOp(op, SmallVector<Value>(newOp->getResults()),
- resultMapping);
+ rewriter.replaceOp(op, newOp->getResults(), resultMapping);
return success();
}
};
More information about the Mlir-commits
mailing list