Skip to content

Commit 87a435a

Browse files
authored
Fix linearize for non-vectors (#700)
1 parent 6eb1932 commit 87a435a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/Transforms/VectorLinearize.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct VectorLinearizePass final
3434
mlir::RewritePatternSet patterns(context);
3535
mlir::ConversionTarget target(*context);
3636

37+
typeConverter.addConversion([](mlir::Type type) { return type; });
3738
mlir::vector::populateVectorLinearizeTypeConversionsAndLegality(
3839
typeConverter, patterns, target);
3940
if (mlir::failed(mlir::applyPartialConversion(getOperation(), target,

test/Transforms/vector-linearize.mlir

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,13 @@ func.func @test_linearize(%arg0: vector<2x2xf32>) -> vector<2x2xf32> {
1717
// CHECK: return %[[RES]] : vector<2x2xf32>
1818
return %0 : vector<2x2xf32>
1919
}
20+
21+
// -----
22+
23+
// CHECK-LABEL: test_const_novector
24+
// CHECK: %[[R:.*]] = arith.constant 42 : i32
25+
// CHECK: return %[[R]] : i32
26+
func.func @test_const_novector() -> i32 {
27+
%0 = arith.constant 42 : i32
28+
return %0 : i32
29+
}

0 commit comments

Comments
 (0)