1 // RUN: mlir-opt %s -test-greedy-patterns="max-iterations=1 top-down=true" \
2 // RUN: --split-input-file | FileCheck %s
4 // Tests for https://github.com/llvm/llvm-project/issues/86765. Ensure
5 // that operands of a dead op are added to the worklist even if the same value
6 // appears multiple times as an operand.
8 // 2 uses of the same operand
10 // CHECK: func.func @f(%arg0: i1) {
13 func.func @f(%arg0: i1) {
14 %0 = arith.constant 0 : i32
15 %if = scf.if %arg0 -> (i32) {
20 %dead_leaf = arith.addi %if, %if : i32
26 // 3 uses of the same operand
28 // CHECK: func.func @f() {
32 %0 = arith.constant 0 : i1
33 %if = scf.if %0 -> (i1) {
38 %dead_leaf = arith.select %if, %if, %if : i1
44 // 2 uses of the same operand, op has 3 operands
46 // CHECK: func.func @f() {
50 %0 = arith.constant 0 : i1
51 %if = scf.if %0 -> (i1) {
56 %dead_leaf = arith.select %0, %if, %if : i1