forked from OSchip/llvm-project
[mlir][arith] Mark unknown types legal in WIE
Allow unknown types to pass through without being marked as illegal. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D135123
This commit is contained in:
parent
63022c4810
commit
b39b805ad5
|
@ -627,6 +627,9 @@ arith::WideIntEmulationConverter::WideIntEmulationConverter(
|
|||
"Only power-of-two integers with are supported");
|
||||
assert(widestIntSupportedByTarget >= 2 && "Integer type too narrow");
|
||||
|
||||
// Allow unknown types.
|
||||
addConversion([](Type ty) -> Optional<Type> { return ty; });
|
||||
|
||||
// Scalar case.
|
||||
addConversion([this](IntegerType ty) -> Optional<Type> {
|
||||
unsigned width = ty.getWidth();
|
||||
|
|
|
@ -10,6 +10,24 @@ func.func @addi_same_i32(%a : i32) -> i32 {
|
|||
return %x : i32
|
||||
}
|
||||
|
||||
// Expect no conversions, index is not sized.
|
||||
// CHECK-LABEL: func @addi_same_index
|
||||
// CHECK-SAME: ([[ARG:%.+]]: index) -> index
|
||||
// CHECK-NEXT: [[X:%.+]] = arith.addi [[ARG]], [[ARG]] : index
|
||||
// CHECK-NEXT: return [[X]] : index
|
||||
func.func @addi_same_index(%a : index) -> index {
|
||||
%x = arith.addi %a, %a : index
|
||||
return %x : index
|
||||
}
|
||||
|
||||
// Expect no conversions, f64 is not an integer type.
|
||||
// CHECK-LABEL: func @identity_f64
|
||||
// CHECK-SAME: ([[ARG:%.+]]: f64) -> f64
|
||||
// CHECK-NEXT: return [[ARG]] : f64
|
||||
func.func @identity_f64(%a : f64) -> f64 {
|
||||
return %a : f64
|
||||
}
|
||||
|
||||
// Expect no conversions, i32 is supported.
|
||||
// CHECK-LABEL: func @addi_same_vector_i32
|
||||
// CHECK-SAME: ([[ARG:%.+]]: vector<2xi32>) -> vector<2xi32>
|
||||
|
|
Loading…
Reference in New Issue