[Mlir-commits] [mlir] 1335a11 - [mlir][vector][nfc] Clean-up VectorOps.{h|cpp} (#109316)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Sep 19 13:45:06 PDT 2024


Author: Andrzej WarzyƄski
Date: 2024-09-19T21:45:01+01:00
New Revision: 1335a11176f99cc54f423fe173708bd2373b59f7

URL: https://github.com/llvm/llvm-project/commit/1335a11176f99cc54f423fe173708bd2373b59f7
DIFF: https://github.com/llvm/llvm-project/commit/1335a11176f99cc54f423fe173708bd2373b59f7.diff

LOG: [mlir][vector][nfc] Clean-up VectorOps.{h|cpp} (#109316)

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Vector/IR/VectorOps.h
    mlir/lib/Dialect/Vector/IR/VectorOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.h b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.h
index 3d29ce8246b966..98fb6075cbf329 100644
--- a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.h
+++ b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.h
@@ -166,11 +166,6 @@ SmallVector<int64_t> getAsIntegers(ArrayRef<OpFoldResult> foldResults);
 SmallVector<Value> getAsValues(OpBuilder &builder, Location loc,
                                ArrayRef<OpFoldResult> foldResults);
 
-/// Returns the constant index ops in `values`. `values` are expected to be
-/// constant operations.
-SmallVector<arith::ConstantIndexOp>
-getAsConstantIndexOps(ArrayRef<Value> values);
-
 /// If `value` is a constant multiple of `vector.vscale` (e.g. `%cst *
 /// vector.vscale`), return the multiplier (`%cst`). Otherwise, return
 /// `std::nullopt`.

diff  --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
index 1438ddd1028bb9..cac6b955457049 100644
--- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
@@ -351,6 +351,21 @@ SmallVector<Value> vector::getAsValues(OpBuilder &builder, Location loc,
   return values;
 }
 
+std::optional<int64_t> vector::getConstantVscaleMultiplier(Value value) {
+  if (value.getDefiningOp<vector::VectorScaleOp>())
+    return 1;
+  auto mul = value.getDefiningOp<arith::MulIOp>();
+  if (!mul)
+    return {};
+  auto lhs = mul.getLhs();
+  auto rhs = mul.getRhs();
+  if (lhs.getDefiningOp<vector::VectorScaleOp>())
+    return getConstantIntValue(rhs);
+  if (rhs.getDefiningOp<vector::VectorScaleOp>())
+    return getConstantIntValue(lhs);
+  return {};
+}
+
 //===----------------------------------------------------------------------===//
 // CombiningKindAttr
 //===----------------------------------------------------------------------===//
@@ -5894,21 +5909,6 @@ LogicalResult CreateMaskOp::verify() {
   return success();
 }
 
-std::optional<int64_t> vector::getConstantVscaleMultiplier(Value value) {
-  if (value.getDefiningOp<vector::VectorScaleOp>())
-    return 1;
-  auto mul = value.getDefiningOp<arith::MulIOp>();
-  if (!mul)
-    return {};
-  auto lhs = mul.getLhs();
-  auto rhs = mul.getRhs();
-  if (lhs.getDefiningOp<vector::VectorScaleOp>())
-    return getConstantIntValue(rhs);
-  if (rhs.getDefiningOp<vector::VectorScaleOp>())
-    return getConstantIntValue(lhs);
-  return {};
-}
-
 namespace {
 
 /// Pattern to rewrite a CreateMaskOp with a ConstantMaskOp.


        


More information about the Mlir-commits mailing list