forked from OSchip/llvm-project
[mlir] Tighten LLVM_AnyNonAggregate ODS type constraint
The constraint was checking that the type is not an LLVM structure or array type, but was not checking that it is an LLVM-compatible type, making it accept incorrect types. As a result, some LLVM dialect ops could process values that are not compatible with the LLVM dialect leading to further issues with conversions and translations that assume all values are LLVM-compatible. Make LLVM_AnyNonAggregate only accept LLVM-compatible types. Reviewed By: cota, akuegel Differential Revision: https://reviews.llvm.org/D107889
This commit is contained in:
parent
62c08c021d
commit
79b0576dd4
|
@ -130,8 +130,9 @@ def LLVM_AnyAggregate : Type<
|
|||
|
||||
// Type constraint accepting any LLVM non-aggregate type, i.e. not structure or
|
||||
// array.
|
||||
def LLVM_AnyNonAggregate : Type<Neg<LLVM_AnyAggregate.predicate>,
|
||||
"LLVM non-aggregate type">;
|
||||
def LLVM_AnyNonAggregate : Type<And<[LLVM_Type.predicate,
|
||||
Neg<LLVM_AnyAggregate.predicate>]>,
|
||||
"LLVM-compatible non-aggregate type">;
|
||||
|
||||
// Type constraint accepting any LLVM vector type.
|
||||
def LLVM_AnyVector : Type<CPred<"::mlir::LLVM::isCompatibleVectorType($_self)">,
|
||||
|
|
|
@ -1119,3 +1119,11 @@ llvm.func @caller() {
|
|||
}
|
||||
|
||||
llvm.func @callee() -> !llvm.struct<(i32, f32)>
|
||||
|
||||
// -----
|
||||
|
||||
func @bitcast(%arg0: vector<2x3xf32>) {
|
||||
// expected-error @below {{op operand #0 must be LLVM-compatible non-aggregate type}}
|
||||
llvm.bitcast %arg0 : vector<2x3xf32> to vector<2x3xi32>
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue