Skip to content

Commit c8087b0

Browse files
committed
address review comments
Signed-off-by: James Newling <james.newling@gmail.com>
1 parent 420da4b commit c8087b0

File tree

2 files changed

+64
-61
lines changed

2 files changed

+64
-61
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7608,20 +7608,24 @@ namespace {
76087608
///
76097609
/// For example, rewrite the 'greater than' comparison below,
76107610
///
7611+
/// ```mlir
76117612
/// %cst = arith.constant dense<7> : vector<3xindex>
76127613
/// %stp = vector.step : vector<3xindex>
76137614
/// %out = arith.cmpi ugt, %stp, %cst : vector<3xindex>
7615+
/// ```
76147616
///
76157617
/// as,
76167618
///
7619+
/// ```mlir
76177620
/// %out = arith.constant dense<false> : vector<3xi1>.
7621+
/// ```
76187622
///
76197623
/// Above [0, 1, 2] > [7, 7, 7] => [false, false, false]. Because the result is
76207624
/// false at ALL indices we fold. If the constant was 1, then
76217625
/// [0, 1, 2] > [1, 1, 1] => [false, false, true] and we do fold, conservatively
76227626
/// preferring the 'compact' vector.step representation.
76237627
struct StepCompareFolder : public OpRewritePattern<StepOp> {
7624-
using OpRewritePattern::OpRewritePattern;
7628+
using Base::Base;
76257629

76267630
LogicalResult matchAndRewrite(StepOp stepOp,
76277631
PatternRewriter &rewriter) const override {
@@ -7679,8 +7683,7 @@ struct StepCompareFolder : public OpRewritePattern<StepOp> {
76797683
if (!type)
76807684
continue;
76817685

7682-
DenseElementsAttr boolAttr =
7683-
DenseElementsAttr::get(type, maybeSplat.value());
7686+
auto boolAttr = DenseElementsAttr::get(type, maybeSplat.value());
76847687
Value splat = mlir::arith::ConstantOp::create(rewriter, cmpiOp.getLoc(),
76857688
type, boolAttr);
76867689

0 commit comments

Comments
 (0)