Skip to content

Commit 1335a11

Browse files
authored
[mlir][vector][nfc] Clean-up VectorOps.{h|cpp} (#109316)
1 parent d7c69c2 commit 1335a11

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

mlir/include/mlir/Dialect/Vector/IR/VectorOps.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,6 @@ SmallVector<int64_t> getAsIntegers(ArrayRef<OpFoldResult> foldResults);
166166
SmallVector<Value> getAsValues(OpBuilder &builder, Location loc,
167167
ArrayRef<OpFoldResult> foldResults);
168168

169-
/// Returns the constant index ops in `values`. `values` are expected to be
170-
/// constant operations.
171-
SmallVector<arith::ConstantIndexOp>
172-
getAsConstantIndexOps(ArrayRef<Value> values);
173-
174169
/// If `value` is a constant multiple of `vector.vscale` (e.g. `%cst *
175170
/// vector.vscale`), return the multiplier (`%cst`). Otherwise, return
176171
/// `std::nullopt`.

mlir/lib/Dialect/Vector/IR/VectorOps.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,21 @@ SmallVector<Value> vector::getAsValues(OpBuilder &builder, Location loc,
351351
return values;
352352
}
353353

354+
std::optional<int64_t> vector::getConstantVscaleMultiplier(Value value) {
355+
if (value.getDefiningOp<vector::VectorScaleOp>())
356+
return 1;
357+
auto mul = value.getDefiningOp<arith::MulIOp>();
358+
if (!mul)
359+
return {};
360+
auto lhs = mul.getLhs();
361+
auto rhs = mul.getRhs();
362+
if (lhs.getDefiningOp<vector::VectorScaleOp>())
363+
return getConstantIntValue(rhs);
364+
if (rhs.getDefiningOp<vector::VectorScaleOp>())
365+
return getConstantIntValue(lhs);
366+
return {};
367+
}
368+
354369
//===----------------------------------------------------------------------===//
355370
// CombiningKindAttr
356371
//===----------------------------------------------------------------------===//
@@ -5894,21 +5909,6 @@ LogicalResult CreateMaskOp::verify() {
58945909
return success();
58955910
}
58965911

5897-
std::optional<int64_t> vector::getConstantVscaleMultiplier(Value value) {
5898-
if (value.getDefiningOp<vector::VectorScaleOp>())
5899-
return 1;
5900-
auto mul = value.getDefiningOp<arith::MulIOp>();
5901-
if (!mul)
5902-
return {};
5903-
auto lhs = mul.getLhs();
5904-
auto rhs = mul.getRhs();
5905-
if (lhs.getDefiningOp<vector::VectorScaleOp>())
5906-
return getConstantIntValue(rhs);
5907-
if (rhs.getDefiningOp<vector::VectorScaleOp>())
5908-
return getConstantIntValue(lhs);
5909-
return {};
5910-
}
5911-
59125912
namespace {
59135913

59145914
/// Pattern to rewrite a CreateMaskOp with a ConstantMaskOp.

0 commit comments

Comments
 (0)