forked from OSchip/llvm-project
[mlir][ods] Fix packing in OperandOrAttribute
Wrong combiner was used which led to information loss.
This commit is contained in:
parent
5aeca3b0a5
commit
b41bfb819d
|
@ -277,7 +277,7 @@ public:
|
|||
struct OperandOrAttribute {
|
||||
enum class Kind { Operand, Attribute };
|
||||
OperandOrAttribute(Kind kind, int index) {
|
||||
packed = (index << 1) & (kind == Kind::Attribute);
|
||||
packed = (index << 1) | (kind == Kind::Attribute);
|
||||
}
|
||||
int operandOrAttributeIndex() const { return (packed >> 1); }
|
||||
Kind kind() { return (packed & 0x1) ? Kind::Attribute : Kind::Operand; }
|
||||
|
|
|
@ -115,12 +115,23 @@ def OpK : NS_Op<"only_input_is_variadic_with_same_value_type_op", [SameOperandsA
|
|||
|
||||
// Test with inferred shapes and interleaved with operands/attributes.
|
||||
//
|
||||
def OpL : NS_Op<"op_with_all_types_constraint",
|
||||
def OpL1 : NS_Op<"op_with_all_types_constraint",
|
||||
[AllTypesMatch<["a", "b"]>]> {
|
||||
let arguments = (ins I32Attr:$attr1, AnyType:$a);
|
||||
let results = (outs Res<AnyType, "output b", []>:$b);
|
||||
}
|
||||
|
||||
// CHECK-LABEL: LogicalResult OpL::inferReturnTypes
|
||||
// CHECK-LABEL: LogicalResult OpL1::inferReturnTypes
|
||||
// CHECK-NOT: }
|
||||
// CHECK: inferredReturnTypes[0] = operands[0].getType();
|
||||
|
||||
def OpL2 : NS_Op<"op_with_all_types_constraint",
|
||||
[AllTypesMatch<["c", "b"]>, AllTypesMatch<["a", "d"]>]> {
|
||||
let arguments = (ins I32Attr:$attr1, AnyType:$a, AnyType:$a2, AnyType:$c);
|
||||
let results = (outs Res<AnyType, "output b", []>:$b, AnyType:$d);
|
||||
}
|
||||
|
||||
// CHECK-LABEL: LogicalResult OpL2::inferReturnTypes
|
||||
// CHECK-NOT: }
|
||||
// CHECK: inferredReturnTypes[0] = operands[2].getType();
|
||||
// CHECK: inferredReturnTypes[1] = operands[0].getType();
|
||||
|
|
Loading…
Reference in New Issue