[Mlir-commits] [mlir] [mlir][vector][nfc] Clean-up VectorOps.{h|cpp} (PR #109316)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Sep 19 11:14:03 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-vector
Author: Andrzej WarzyĆski (banach-space)
<details>
<summary>Changes</summary>
* Removes the declaration of `getAsConstantIndexOps` - this method is
neither defined nor used.
* Moves the definition of `getConstantVscaleMultiplier` near other
helper hooks so that the order of definitions matches the order of
declarations.
---
Full diff: https://github.com/llvm/llvm-project/pull/109316.diff
2 Files Affected:
- (modified) mlir/include/mlir/Dialect/Vector/IR/VectorOps.h (-5)
- (modified) mlir/lib/Dialect/Vector/IR/VectorOps.cpp (+15-15)
``````````diff
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 d3aef4ac38af03..0be6b5d2b617cf 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
//===----------------------------------------------------------------------===//
@@ -5887,21 +5902,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.
``````````
</details>
https://github.com/llvm/llvm-project/pull/109316
More information about the Mlir-commits
mailing list