Skip to content

Commit d4cd92a

Browse files
committed
apply some polish
1 parent f9cbef9 commit d4cd92a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,8 +2385,7 @@ static LogicalResult rewriteFromElementsAsSplat(FromElementsOp fromElementsOp,
23852385
return success();
23862386
}
23872387

2388-
2389-
/// Rewrite a vecor.from_elements as a vector.shape_cast, if possible.
2388+
/// Rewrite vector.from_elements as vector.shape_cast, if possible.
23902389
///
23912390
/// Example:
23922391
/// %0 = vector.extract %source[0, 0] : i8 from vector<1x2xi8>
@@ -2400,8 +2399,8 @@ rewriteFromElementsAsShapeCast(FromElementsOp fromElementsOp,
24002399
PatternRewriter &rewriter) {
24012400

24022401
// The common source of vector.extract operations (if one exists), as well
2403-
// as its shape and rank. Set in the first iteration of the loop over the
2404-
// operands of `fromElementsOp`.
2402+
// as its shape and rank. These are set in the first iteration of the loop
2403+
// over the operands (elements) of `fromElementsOp`.
24052404
Value source;
24062405
ArrayRef<int64_t> shape;
24072406
int64_t rank;
@@ -2426,9 +2425,8 @@ rewriteFromElementsAsShapeCast(FromElementsOp fromElementsOp,
24262425
// Check that the (linearized) index of extraction is the same as the index
24272426
// in the result of `fromElementsOp`.
24282427
ArrayRef<int64_t> position = extractOp.getStaticPosition();
2429-
if (position.size() != rank)
2430-
return failure();
2431-
2428+
assert(position.size() == rank &&
2429+
"scalar extract must have full rank position");
24322430
int64_t stride{1};
24332431
int64_t offset{0};
24342432
for (auto [pos, size] :

0 commit comments

Comments
 (0)