Skip to content

Commit 81658b0

Browse files
committed
Refactor getMask
1 parent d8499c0 commit 81658b0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2685,10 +2685,11 @@ OpFoldResult vector::ShuffleOp::fold(FoldAdaptor adaptor) {
26852685
return {};
26862686

26872687
// Fold shuffle V1, V2, [0, 1, 2, 3] : <4xi32>, <2xi32> -> V1.
2688-
if (isStepIndexArray(getMask(), 0, v1Type.getDimSize(0)))
2688+
auto mask = getMask();
2689+
if (isStepIndexArray(mask, 0, v1Type.getDimSize(0)))
26892690
return getV1();
26902691
// Fold shuffle V1, V2, [4, 5] : <4xi32>, <2xi32> -> V2.
2691-
if (isStepIndexArray(getMask(), v1Type.getDimSize(0), v2Type.getDimSize(0)))
2692+
if (isStepIndexArray(mask, v1Type.getDimSize(0), v2Type.getDimSize(0)))
26922693
return getV2();
26932694

26942695
Attribute v1Attr = adaptor.getV1(), v2Attr = adaptor.getV2();
@@ -2705,7 +2706,7 @@ OpFoldResult vector::ShuffleOp::fold(FoldAdaptor adaptor) {
27052706
SmallVector<Attribute> results;
27062707
auto v1Elements = cast<DenseElementsAttr>(v1Attr).getValues<Attribute>();
27072708
auto v2Elements = cast<DenseElementsAttr>(v2Attr).getValues<Attribute>();
2708-
for (int64_t maskIdx : this->getMask()) {
2709+
for (int64_t maskIdx : mask) {
27092710
Attribute indexedElm;
27102711
// Select v1[0] for poison indices.
27112712
// TODO: Return a partial poison vector when supported by the UB dialect.

0 commit comments

Comments
 (0)