@@ -434,7 +434,7 @@ func @cstr_require_no_fold(%arg0: i1) {
434
434
}
435
435
436
436
// -----
437
- // `assuming_all` with all `cstr_eq` can be collapsed.
437
+ // `assuming_all` with all `cstr_eq` and shared operands can be collapsed.
438
438
// CHECK-LABEL: func @assuming_all_to_cstr_eq
439
439
// CHECK-SAME: (%[[A:.*]]: !shape.shape, %[[B:.*]]: tensor<?xindex>, %[[C:.*]]: tensor<3xindex>)
440
440
func @assuming_all_to_cstr_eq (%a : !shape.shape , %b : tensor <?xindex >,
@@ -447,6 +447,22 @@ func @assuming_all_to_cstr_eq(%a : !shape.shape, %b : tensor<?xindex>,
447
447
return %2 : !shape.witness
448
448
}
449
449
450
+ // -----
451
+ // `assuming_all` with all `cstr_eq` but disjoint operands cannot be collapsed.
452
+ // CHECK-LABEL: func @assuming_all_to_cstr_eq
453
+ // CHECK-SAME: (%[[A:.*]]: !shape.shape, %[[B:.*]]: tensor<?xindex>, %[[C:.*]]: tensor<3xindex>, %[[D:.*]]: tensor<3xindex>)
454
+ func @assuming_all_to_cstr_eq (%a : !shape.shape , %b : tensor <?xindex >,
455
+ %c : tensor <3 xindex >, %d : tensor <3 xindex >) -> !shape.witness {
456
+ // CHECK: %[[EQ0:.*]] = shape.cstr_eq %[[A]], %[[B]]
457
+ // CHECK: %[[EQ1:.*]] = shape.cstr_eq %[[C]], %[[D]]
458
+ // CHECK: %[[RESULT:.*]] = shape.assuming_all %[[EQ0]], %[[EQ1]]
459
+ // CHECK: return %[[RESULT]]
460
+ %0 = shape.cstr_eq %a , %b : !shape.shape , tensor <?xindex >
461
+ %1 = shape.cstr_eq %c , %d : tensor <3 xindex >, tensor <3 xindex >
462
+ %2 = shape.assuming_all %0 , %1
463
+ return %2 : !shape.witness
464
+ }
465
+
450
466
// -----
451
467
// assuming_all with known passing witnesses can be folded
452
468
// CHECK-LABEL: func @f
0 commit comments