Skip to content

Commit b17a250

Browse files
committed
amend! [MLIR][DRR] Fix inconsistent operand and arg index usage
[MLIR][DRR] Fix inconsistent operand and arg index usage
1 parent 09316e0 commit b17a250

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

mlir/test/mlir-tblgen/pattern.mlir

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -609,17 +609,17 @@ func.func @redundantTest(%arg0: i32) -> i32 {
609609
// Test either directive
610610
//===----------------------------------------------------------------------===//
611611

612-
// CHECK: @either_dag_leaf_only
613-
func.func @either_dag_leaf_only_1(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
612+
// CHECK-LABEL: @eitherDagLeafOnly
613+
func.func @eitherDagLeafOnly(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
614614
// CHECK: "test.either_op_b"(%arg1, %arg2) : (i16, i8) -> i32
615615
%0 = "test.either_op_a"(%arg0, %arg1, %arg2) : (i32, i16, i8) -> i32
616616
// CHECK: "test.either_op_b"(%arg1, %arg2) : (i16, i8) -> i32
617617
%1 = "test.either_op_a"(%arg1, %arg0, %arg2) : (i16, i32, i8) -> i32
618618
return
619619
}
620620

621-
// CHECK: @either_dag_leaf_dag_node
622-
func.func @either_dag_leaf_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
621+
// CHECK-LABEL: @eitherDagLeafDagNode
622+
func.func @eitherDagLeafDagNode(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
623623
%0 = "test.either_op_b"(%arg0, %arg0) : (i32, i32) -> i32
624624
// CHECK: "test.either_op_b"(%arg1, %arg2) : (i16, i8) -> i32
625625
%1 = "test.either_op_a"(%0, %arg1, %arg2) : (i32, i16, i8) -> i32
@@ -628,8 +628,8 @@ func.func @either_dag_leaf_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> ()
628628
return
629629
}
630630

631-
// CHECK: @either_dag_node_dag_node
632-
func.func @either_dag_node_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
631+
// CHECK-LABEL: @eitherDagNodeDagNode
632+
func.func @eitherDagNodeDagNode(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> () {
633633
%0 = "test.either_op_b"(%arg0, %arg0) : (i32, i32) -> i32
634634
%1 = "test.either_op_b"(%arg1, %arg1) : (i16, i16) -> i32
635635
// CHECK: "test.either_op_b"(%arg1, %arg2) : (i16, i8) -> i32
@@ -639,24 +639,38 @@ func.func @either_dag_node_dag_node(%arg0 : i32, %arg1 : i16, %arg2 : i8) -> ()
639639
return
640640
}
641641

642+
// CHECK-LABEL: @testEitherOpWithAttr
643+
func.func @testEitherOpWithAttr(%arg0 : i32, %arg1 : i16) -> () {
644+
// CHECK: "test.either_op_b"(%arg1, %arg0) : (i16, i32) -> i32
645+
%0 = "test.either_op_c"(%arg0, %arg1) {attr = 0 : i32} : (i32, i16) -> i32
646+
// CHECK: "test.either_op_b"(%arg1, %arg0) : (i16, i32) -> i32
647+
%1 = "test.either_op_c"(%arg1, %arg0) {attr = 0 : i32} : (i16, i32) -> i32
648+
// CHECK: "test.either_op_c"(%arg0, %arg1) <{attr = 1 : i32}> : (i32, i16) -> i32
649+
%2 = "test.either_op_c"(%arg0, %arg1) {attr = 1 : i32} : (i32, i16) -> i32
650+
return
651+
}
652+
642653
//===----------------------------------------------------------------------===//
643654
// Test that ops without type deduction can be created with type builders.
644655
//===----------------------------------------------------------------------===//
645656

657+
// CHECK-LABEL: @explicitReturnTypeTest
646658
func.func @explicitReturnTypeTest(%arg0 : i64) -> i8 {
647659
%0 = "test.source_op"(%arg0) {tag = 11 : i32} : (i64) -> i8
648660
// CHECK: "test.op_x"(%arg0) : (i64) -> i32
649661
// CHECK: "test.op_x"(%0) : (i32) -> i8
650662
return %0 : i8
651663
}
652664

665+
// CHECK-LABEL: @returnTypeBuilderTest
653666
func.func @returnTypeBuilderTest(%arg0 : i1) -> i8 {
654667
%0 = "test.source_op"(%arg0) {tag = 22 : i32} : (i1) -> i8
655668
// CHECK: "test.op_x"(%arg0) : (i1) -> i1
656669
// CHECK: "test.op_x"(%0) : (i1) -> i8
657670
return %0 : i8
658671
}
659672

673+
// CHECK-LABEL: @multipleReturnTypeBuildTest
660674
func.func @multipleReturnTypeBuildTest(%arg0 : i1) -> i1 {
661675
%0 = "test.source_op"(%arg0) {tag = 33 : i32} : (i1) -> i1
662676
// CHECK: "test.one_to_two"(%arg0) : (i1) -> (i64, i32)
@@ -666,13 +680,15 @@ func.func @multipleReturnTypeBuildTest(%arg0 : i1) -> i1 {
666680
return %0 : i1
667681
}
668682

683+
// CHECK-LABEL: @copyValueType
669684
func.func @copyValueType(%arg0 : i8) -> i32 {
670685
%0 = "test.source_op"(%arg0) {tag = 44 : i32} : (i8) -> i32
671686
// CHECK: "test.op_x"(%arg0) : (i8) -> i8
672687
// CHECK: "test.op_x"(%0) : (i8) -> i32
673688
return %0 : i32
674689
}
675690

691+
// CHECK-LABEL: @multipleReturnTypeDifferent
676692
func.func @multipleReturnTypeDifferent(%arg0 : i1) -> i64 {
677693
%0 = "test.source_op"(%arg0) {tag = 55 : i32} : (i1) -> i64
678694
// CHECK: "test.one_to_two"(%arg0) : (i1) -> (i1, i64)
@@ -684,6 +700,7 @@ func.func @multipleReturnTypeDifferent(%arg0 : i1) -> i64 {
684700
// Test that multiple trailing directives can be mixed in patterns.
685701
//===----------------------------------------------------------------------===//
686702

703+
// CHECK-LABEL: @returnTypeAndLocation
687704
func.func @returnTypeAndLocation(%arg0 : i32) -> i1 {
688705
%0 = "test.source_op"(%arg0) {tag = 66 : i32} : (i32) -> i1
689706
// CHECK: "test.op_x"(%arg0) : (i32) -> i32 loc("loc1")
@@ -696,6 +713,7 @@ func.func @returnTypeAndLocation(%arg0 : i32) -> i1 {
696713
// Test that patterns can create ConstantStrAttr
697714
//===----------------------------------------------------------------------===//
698715

716+
// CHECK-LABEL: @testConstantStrAttr
699717
func.func @testConstantStrAttr() -> () {
700718
// CHECK: test.has_str_value {value = "foo"}
701719
test.no_str_value {value = "bar"}
@@ -706,6 +724,7 @@ func.func @testConstantStrAttr() -> () {
706724
// Test that patterns with variadics propagate sizes
707725
//===----------------------------------------------------------------------===//
708726

727+
// CHECK-LABEL: @testVariadic
709728
func.func @testVariadic(%arg_0: i32, %arg_1: i32, %brg: i64,
710729
%crg_0: f32, %crg_1: f32, %crg_2: f32, %crg_3: f32) -> () {
711730
// CHECK: "test.variadic_rewrite_dst_op"(%arg2, %arg3, %arg4, %arg5, %arg6, %arg0, %arg1) <{operandSegmentSizes = array<i32: 1, 4, 2>}> : (i64, f32, f32, f32, f32, i32, i32) -> ()

0 commit comments

Comments
 (0)