|
17 | 17 | #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h" |
18 | 18 | #include "mlir/Dialect/Bufferization/IR/Bufferization.h" |
19 | 19 | #include "mlir/Dialect/Func/IR/FuncOps.h" |
| 20 | +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" |
20 | 21 | #include "mlir/Dialect/Linalg/IR/Linalg.h" |
21 | 22 | #include "mlir/Dialect/Linalg/Utils/Utils.h" |
22 | 23 | #include "mlir/Dialect/MemRef/IR/MemRef.h" |
@@ -889,11 +890,18 @@ static Value genIndexValue(Merger &merger, CodeGen &codegen, |
889 | 890 | VectorType vtp = vectorType(codegen, itype); |
890 | 891 | ival = rewriter.create<vector::BroadcastOp>(loc, vtp, ival); |
891 | 892 | if (idx == ldx) { |
892 | | - SmallVector<APInt, 4> integers; |
893 | | - for (unsigned i = 0; i < vl; i++) |
894 | | - integers.push_back(APInt(/*width=*/64, i)); |
895 | | - auto values = DenseElementsAttr::get(vtp, integers); |
896 | | - Value incr = rewriter.create<arith::ConstantOp>(loc, vtp, values); |
| 893 | + Value incr; |
| 894 | + if (vtp.isScalable()) { |
| 895 | + Type stepvty = vectorType(codegen, rewriter.getI64Type()); |
| 896 | + Value stepv = rewriter.create<LLVM::StepVectorOp>(loc, stepvty); |
| 897 | + incr = rewriter.create<arith::IndexCastOp>(loc, vtp, stepv); |
| 898 | + } else { |
| 899 | + SmallVector<APInt, 4> integers; |
| 900 | + for (unsigned i = 0; i < vl; i++) |
| 901 | + integers.push_back(APInt(/*width=*/64, i)); |
| 902 | + auto values = DenseElementsAttr::get(vtp, integers); |
| 903 | + incr = rewriter.create<arith::ConstantOp>(loc, vtp, values); |
| 904 | + } |
897 | 905 | ival = rewriter.create<arith::AddIOp>(loc, ival, incr); |
898 | 906 | } |
899 | 907 | } |
|
0 commit comments