[Mlir-commits] [mlir] 0692784 - Apply clang-tidy fixes for performance-unnecessary-value-param in SliceAnalysis.cpp (NFC)

Mehdi Amini llvmlistbot at llvm.org
Tue Oct 31 21:26:05 PDT 2023


Author: Mehdi Amini
Date: 2023-10-31T21:25:47-07:00
New Revision: 06927848dae4279267392b1000f71c55a65e2c49

URL: https://github.com/llvm/llvm-project/commit/06927848dae4279267392b1000f71c55a65e2c49
DIFF: https://github.com/llvm/llvm-project/commit/06927848dae4279267392b1000f71c55a65e2c49.diff

LOG: Apply clang-tidy fixes for performance-unnecessary-value-param in SliceAnalysis.cpp (NFC)

Added: 
    

Modified: 
    mlir/include/mlir/Analysis/SliceAnalysis.h
    mlir/lib/Analysis/SliceAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Analysis/SliceAnalysis.h b/mlir/include/mlir/Analysis/SliceAnalysis.h
index e64d3ac0271eb92..d5cdf72c3889fda 100644
--- a/mlir/include/mlir/Analysis/SliceAnalysis.h
+++ b/mlir/include/mlir/Analysis/SliceAnalysis.h
@@ -93,12 +93,12 @@ using ForwardSliceOptions = SliceOptions;
 ///      {4, 3, 6, 2, 1, 5, 8, 7, 9}
 ///
 void getForwardSlice(Operation *op, SetVector<Operation *> *forwardSlice,
-                     ForwardSliceOptions options = {});
+                     const ForwardSliceOptions &options = {});
 
 /// Value-rooted version of `getForwardSlice`. Return the union of all forward
 /// slices for the uses of the value `root`.
 void getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
-                     ForwardSliceOptions options = {});
+                     const ForwardSliceOptions &options = {});
 
 /// Fills `backwardSlice` with the computed backward slice (i.e.
 /// all the transitive defs of op), **without** including that operation.
@@ -135,12 +135,12 @@ void getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
 ///    {1, 2, 5, 3, 4, 6}
 ///
 void getBackwardSlice(Operation *op, SetVector<Operation *> *backwardSlice,
-                      BackwardSliceOptions options = {});
+                      const BackwardSliceOptions &options = {});
 
 /// Value-rooted version of `getBackwardSlice`. Return the union of all backward
 /// slices for the op defining or owning the value `root`.
 void getBackwardSlice(Value root, SetVector<Operation *> *backwardSlice,
-                      BackwardSliceOptions options = {});
+                      const BackwardSliceOptions &options = {});
 
 /// Iteratively computes backward slices and forward slices until
 /// a fixed point is reached. Returns an `SetVector<Operation *>` which
@@ -219,9 +219,9 @@ void getBackwardSlice(Value root, SetVector<Operation *> *backwardSlice,
 /// and keep things ordered but this is still hand-wavy and not worth the
 /// trouble for now: punt to a simple worklist-based solution.
 ///
-SetVector<Operation *> getSlice(Operation *op,
-                                BackwardSliceOptions backwardSliceOptions = {},
-                                ForwardSliceOptions forwardSliceOptions = {});
+SetVector<Operation *>
+getSlice(Operation *op, const BackwardSliceOptions &backwardSliceOptions = {},
+         const ForwardSliceOptions &forwardSliceOptions = {});
 
 /// Multi-root DAG topological sort.
 /// Performs a topological sort of the Operation in the `toSort` SetVector.

diff  --git a/mlir/lib/Analysis/SliceAnalysis.cpp b/mlir/lib/Analysis/SliceAnalysis.cpp
index 95ec6ab2bd7a49f..26fe8e3dc081941 100644
--- a/mlir/lib/Analysis/SliceAnalysis.cpp
+++ b/mlir/lib/Analysis/SliceAnalysis.cpp
@@ -26,7 +26,7 @@ using namespace mlir;
 
 static void
 getForwardSliceImpl(Operation *op, SetVector<Operation *> *forwardSlice,
-                    SliceOptions::TransitiveFilter filter = nullptr) {
+                    const SliceOptions::TransitiveFilter &filter = nullptr) {
   if (!op)
     return;
 
@@ -51,7 +51,7 @@ getForwardSliceImpl(Operation *op, SetVector<Operation *> *forwardSlice,
 }
 
 void mlir::getForwardSlice(Operation *op, SetVector<Operation *> *forwardSlice,
-                           ForwardSliceOptions options) {
+                           const ForwardSliceOptions &options) {
   getForwardSliceImpl(op, forwardSlice, options.filter);
   if (!options.inclusive) {
     // Don't insert the top level operation, we just queried on it and don't
@@ -67,7 +67,7 @@ void mlir::getForwardSlice(Operation *op, SetVector<Operation *> *forwardSlice,
 }
 
 void mlir::getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
-                           SliceOptions options) {
+                           const SliceOptions &options) {
   for (Operation *user : root.getUsers())
     getForwardSliceImpl(user, forwardSlice, options.filter);
 
@@ -80,7 +80,7 @@ void mlir::getForwardSlice(Value root, SetVector<Operation *> *forwardSlice,
 
 static void getBackwardSliceImpl(Operation *op,
                                  SetVector<Operation *> *backwardSlice,
-                                 BackwardSliceOptions options) {
+                                 const BackwardSliceOptions &options) {
   if (!op || op->hasTrait<OpTrait::IsIsolatedFromAbove>())
     return;
 
@@ -119,7 +119,7 @@ static void getBackwardSliceImpl(Operation *op,
 
 void mlir::getBackwardSlice(Operation *op,
                             SetVector<Operation *> *backwardSlice,
-                            BackwardSliceOptions options) {
+                            const BackwardSliceOptions &options) {
   getBackwardSliceImpl(op, backwardSlice, options);
 
   if (!options.inclusive) {
@@ -130,7 +130,7 @@ void mlir::getBackwardSlice(Operation *op,
 }
 
 void mlir::getBackwardSlice(Value root, SetVector<Operation *> *backwardSlice,
-                            BackwardSliceOptions options) {
+                            const BackwardSliceOptions &options) {
   if (Operation *definingOp = root.getDefiningOp()) {
     getBackwardSlice(definingOp, backwardSlice, options);
     return;
@@ -139,9 +139,9 @@ void mlir::getBackwardSlice(Value root, SetVector<Operation *> *backwardSlice,
   getBackwardSlice(bbAargOwner, backwardSlice, options);
 }
 
-SetVector<Operation *> mlir::getSlice(Operation *op,
-                                      BackwardSliceOptions backwardSliceOptions,
-                                      ForwardSliceOptions forwardSliceOptions) {
+SetVector<Operation *>
+mlir::getSlice(Operation *op, const BackwardSliceOptions &backwardSliceOptions,
+               const ForwardSliceOptions &forwardSliceOptions) {
   SetVector<Operation *> slice;
   slice.insert(op);
 


        


More information about the Mlir-commits mailing list