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

    <tr>
        <th>Summary</th>
        <td>
            [InstCombine] Failure to avoid decrement for non-zero input to comparison
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            llvm:instcombine,
            missed-optimization
      </td>
    </tr>

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

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

<pre>
    https://alive2.llvm.org/ce/z/sZ6wwS

```
declare void @llvm.assume(i1)

define i1 @src(i8 %x) {
  %z = icmp ne i8 %x, 0
  call void @llvm.assume(i1 %z)
  %i = add i8 %x, -1
  %c = icmp ult i8 %i, 7
  ret i1 %c
}

define i1 @tgt(i8 %x) {
  %c = icmp ule i8 %x, 7
  ret i1 %c
}
```
-->
```
----------------------------------------
define i1 @src(i8 %x) denormal-fp-math=ieee,ieee {
%0:
  %z = icmp ne i8 %x, 0
  assume i1 %z
  %i = add i8 %x, 255
  %c = icmp ult i8 %i, 7
  ret i1 %c
}
=>
define i1 @tgt(i8 %x) denormal-fp-math=ieee,ieee {
%0:
  %c = icmp ule i8 %x, 7
  ret i1 %c
}
Transformation seems to be correct!
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVE1v3CAQ_TX4grzCOMbrgw9JtpGq3pqeesN4dpcKjAU4affXdyC7-ZKSbD8sbGx4vJk3zzC48Ve_j3EOpL4k_AabNPoO-MqYO7tyfocjCvBxwDt8F_f3t4RtCLs8PgU7tvw5gjLSA71zeqTkgmUSGcJikWKtK8K756tH2OoJqK4SNniVMGtKePMTgZS0Vw8wmoYOlNQbqpWdaVpygl1TdgIpacybkTPFY_jMqDOjHMfnbGX1DKGeYi4mHmE6wdoTykOkD-zqqKzdvCkx7uJ7El-Ee6HxnHAvnShLUn96Y-a86xyLRpict9KU27m0Mu4xfw2AFb9O3ZM8xLP0g_2JnQ_m0ZN1H_jGm-a_GVdvHmv3vn1_L_-frP7m5RS2KXLUbqIBwAYaHR2AKuc9KEyzeuV9AX0lBBeiEx0vxr4eu7qTRdTRQE-aq89TiNfODqiWNBt6I7VZcCMjq8xbCne2BwtTpBiYTm4qD-Ad1dO8xIRSzs7S6-CmYvHm1ZGy03G_DCvE4EfamceunL37kdO90eg2BHxpWlE3xb5XVbttRddtBau6tRJtp2Q1cCXEhZRMrAsjBzAh5U44z6T1pUYV6qiC81RO7Cxyw1i6OWqrD7lmabLZFLrnjHPWsTVnF1XNV6Jjsh44U90Acl1zNB0sluLxNCx8nxMfll1Ip4wOMTxN4i-rdxPkgiZ-ucS98_3XL7faYmGyxj4L_A1D3oAB">