The LLVM dialect type system has been closed until now, i.e. did not support types from other dialects inside containers. While this has had obvious benefits of deriving from a common base class, it has led to some simple types being almost identical with the built-in types, namely integer and floating point types. This in turn has led to a lot of larger-scale complexity: simple types must still be converted, numerous operations that correspond to LLVM IR intrinsics are replicated to produce versions operating on either LLVM dialect or built-in types leading to quasi-duplicate dialects, lowering to the LLVM dialect is essentially required to be one-shot because of type conversion, etc. In this light, it is reasonable to trade off some local complexity in the internal implementation of LLVM dialect types for removing larger-scale system complexity. Previous commits to the LLVM dialect type system have adapted the API to support types from other dialects. Replace LLVMIntegerType with the built-in IntegerType plus additional checks that such types are signless (these are isolated in a utility function that replaced `isa<LLVMType>` and in the parser). Temporarily keep the possibility to parse `!llvm.i32` as a synonym for `i32`, but add a deprecation notice. Reviewed By: mehdi_amini, silvas, antiagainst Differential Revision: https://reviews.llvm.org/D94178
20 lines
987 B
MLIR
20 lines
987 B
MLIR
// RUN: mlir-opt -convert-std-to-llvm %s | FileCheck %s
|
|
|
|
// CHECK-LABEL: func @check_attributes
|
|
// When expanding the memref to multiple arguments, argument attributes are replicated.
|
|
// CHECK-COUNT-7: {dialect.a = true, dialect.b = 4 : i64}
|
|
func @check_attributes(%static: memref<10x20xf32> {dialect.a = true, dialect.b = 4 : i64 }) {
|
|
%c0 = constant 0 : index
|
|
%0 = load %static[%c0, %c0]: memref<10x20xf32>
|
|
return
|
|
}
|
|
|
|
// CHECK-LABEL: func @check_multiple
|
|
// Make sure arguments attributes are attached to the right argument. We match
|
|
// commas in the argument list for this purpose.
|
|
// CHECK: %{{.*}}: !llvm{{.*}} {first.arg = true}, %{{.*}}: !llvm{{.*}} {first.arg = true}, %{{.*}}: i{{.*}} {first.arg = true},
|
|
// CHECK-SAME: %{{.*}}: !llvm{{.*}} {second.arg = 42 : i32}, %{{.*}}: !llvm{{.*}} {second.arg = 42 : i32}, %{{.*}}: i{{.*}} {second.arg = 42 : i32})
|
|
func @check_multiple(%first: memref<f32> {first.arg = true}, %second: memref<f32> {second.arg = 42 : i32}) {
|
|
return
|
|
}
|