brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 9f4a792 Raw
59 lines · plain
1// RUN: mlir-opt %s -test-greedy-patterns="max-iterations=1 top-down=true" \2// RUN:     --split-input-file | FileCheck %s3 4// Tests for https://github.com/llvm/llvm-project/issues/86765. Ensure5// that operands of a dead op are added to the worklist even if the same value6// appears multiple times as an operand.7 8// 2 uses of the same operand9 10// CHECK:       func.func @f(%arg0: i1) {11// CHECK-NEXT:    return12// CHECK-NEXT:  }13func.func @f(%arg0: i1) {14  %0 = arith.constant 0 : i3215  %if = scf.if %arg0 -> (i32) {16    scf.yield %0 : i3217  } else {18    scf.yield %0 : i3219  }20  %dead_leaf = arith.addi %if, %if : i3221  return22}23 24// -----25 26// 3 uses of the same operand27 28// CHECK:       func.func @f() {29// CHECK-NEXT:    return30// CHECK-NEXT:  }31func.func @f() {32  %0 = arith.constant 0 : i133  %if = scf.if %0 -> (i1) {34    scf.yield %0 : i135  } else {36    scf.yield %0 : i137  }38  %dead_leaf = arith.select %if, %if, %if : i139  return40}41 42// -----43 44// 2 uses of the same operand, op has 3 operands45 46// CHECK:       func.func @f() {47// CHECK-NEXT:    return48// CHECK-NEXT:  }49func.func @f() {50  %0 = arith.constant 0 : i151  %if = scf.if %0 -> (i1) {52    scf.yield %0 : i153  } else {54    scf.yield %0 : i155  }56  %dead_leaf = arith.select %0, %if, %if : i157  return58}59