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

    <tr>
        <th>Summary</th>
        <td>
            regression after sccp turned ashr into lshr
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    test from [llvm/test/Transforms/InstCombine/idioms.ll](https://github.com/llvm/llvm-project/blob/94c4499bc73acd2b40f634b2d3bfc8f633a1a1fd/llvm/test/Transforms/InstCombine/idioms.ll)

https://godbolt.org/z/qPa8184Pf
```
int test_asr(int a, int b) { 
    return a < 0 ? -(-a - 1 >> b) - 1 : a >> b; 
}
```
ir clang 15
```
define i32 @test_asr(i32 %0, i32 %1) {
  %3 = ashr i32 %0, %1
  ret i32 %3
}
```
ir trunk:
```
define i32 @test_asr(i32 %0, i32 %1) {
  %3 = icmp slt i32 %0, 0
  %4 = xor i32 %0, -1
  %5 = lshr i32 %4, %1
  %6 = xor i32 %5, -1
  %7 = lshr i32 %0, %1
  %8 = select i1 %3, i32 %6, i32 %7
  ret i32 %8
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0lMlu4zgQhp-mdCnYoLhI1EGHJI6AueUw9wE32ZyhRQ9J9_b0DcoO4iyNRg4NEBJZ_Pnrq4JYKme_X5wbQdyD2DXqXA4xjXkuQZul0dF-H4vLBecUjwjiPoQvR6BTjQGd_k5qyXNMxwx0-mvJ5SEetV8c0MlbH495GwKIHVB5KOWUgd0BnYBOe18OZ701sXpdLetrc0rxX2eqtQ5RA50GbjgfBm16poylmpO5Y1xTy_Rs5NwxplrVzvbF5zNodACyA3J3eb5hjFbHULYx7YFOP4BO_z8p2Ur-NF8PdeQ61qVfCtZv_6NyAirrUgF9wDrRQAeE_h4vUkTE5Mo5LagQ2AMSBDbhBqjcKNxgi8AegT1ezl3Wd6v0GmXPTtDvPoZJaIJa9tiKD_etm_3i0DOKwMktdo1QQVbyy7y9wj-zAxUMge1Q5UPC2wOr-KpKrjzvsd-ylnRe_quV_2Os3hxPmEN5xUtuZHyVfYuvM9q0NxKxSsJN1vxt1kBF99ZIvDPq3xm9Kx9QIVdVdsGZgr69VPIl1e5m3n9Qdfmrqjd2ZHZgg2rc2Ha9IJILwZvDKDszt8Q5KQmxjItWWdPywbQ1aAfZ-JESykhbRysE3yprrNGqt9z1TnUSOHFH5cO23sV6cxqf89mNHWFSNEFpF_Laaihd3FdcN4HS2nnSuDYAfd5n4CT4XPKLS_EluDG5fXI5-7igmotLmI05Yb1Gzl5_xqXEta7NOYXx0z1n5an9YuX9GQAA___Sc2So">