<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/80960>80960</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Inconsistent results for mlir arith shift operations
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          wangyongj1a
      </td>
    </tr>
</table>

<pre>
    I have the following MLIR program:
test.mlir:
```
func.func @func1() {
  %true = arith.constant true
  %false = arith.constant false

 %c1_i64 = arith.constant 1 : i64

  %17 = scf.if %true -> (i1) {
 scf.yield %true : i1
  } else {
    scf.yield %false : i1 // this line can not be changed to %true
  }
  
  // can be changed to arith.shli, arith.shrsi and arith.shrui
  %22 = arith.shrui %17, %true : i1

  %30 = scf.if %true -> (i64) {  // this scf.if can not be removed
    scf.yield %c1_i64 : i64
  } else {
    scf.yield %c1_i64 : i64   // but can yield same value.
  }

  vector.print %22 : i1
  return
}

```

The above MLIR program can be lowered and executed using the following commands:

```
mlir-opt --convert-scf-to-cf --convert-cf-to-llvm --convert-vector-to-llvm --convert-arith-to-llvm --convert-func-to-llvm test.mlir > 1.mlir

mlir-translate --mlir-to-llvmir 1.mlir > 2.ll

sed s/@func1/@main/ 2.ll > 3.ll

bin/clang 3.ll lib/libmlir_c_runner_utils.so lib/libmlir_float16_utils.so lib/libmlir_runner_utils.so /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.so -o out.out

./out.out
```

However, it has inconsistent results over multiple runs.
Is there some problem in the above arith shift operations?
My git version is adbf21f12b3069b2554efb39f2e92c6cf6f24940.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVV2PqzYQ_TXOywgE5iPhgYfdbqOu1PtS9X1lzAC-MnbkD3b331c2CUu2uVWlKOCZc-yZ8ZmBWStGhdiS6plULwfm3aRN-87U-KnV-DNnh073n-0r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