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

    <tr>
        <th>Summary</th>
        <td>
            Missed optimization of useless instructions:   xor edi, edi    test edi, edi    je 
        </td>
    </tr>

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

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

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

<pre>
    https://godbolt.org/z/rnoW561Yf
```cpp
int a, b,d;
void test() {
  for (int c=0; c < 100;c++){
    if (a){
 a = b;
      d+=a;
    }
  }
}
```

For the code above, llvm looks like it's generating useless instruction sequences:
```asm
.LBB0_2:                                #   in Loop: Header=BB0_1 Depth=1
        xor     edi, edi
        test    edi, edi
        je      .LBB0_6
```
These instructions might be optimized directly as a jump statement `jmp     .LBB0_6`.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U01vnDwQ_jXDZZSVsYGFA4dsEHoPeW-VqvRSGXt28QYwtU3a5NdXhs3HVmkti7GfYTzzzIf03pwmohryA-RNIpfQW1d_e8izIumsfq77EGYP4hZ4C7w9Wd3ZIeysOwFvX4C3brJf8yJ9OAJrgN1Cwbat5nlDzBRQAr_DDvidBnHY4CdrNAbyAXgJvELYXxSIR-sQeBkNFYiGgTigQhB3mLJ4UcAP664-GCGaY7SSV7BEEA12b15xXTpai0ZewbBvXi9vx_fDK63Ldf221mHoCZXVhLKzTxRpDsPTiIO1jx4H80hoAvC9xxNN5GQw0wkXTwN5j2bywS0qGDuhpx8LTYrWVF-7lH7ckN394cC-cxAXGn9fwEVMyIT31s7x__9IanIgmvhCig3NoQfRpB-zgvjLulWSNpFJFFf6WK5_6c-0yS3Q4tPUfenJ00fqHkdz6gN2hHYOZjQvpFEbRyoMzyg9Sjwv44w-yEAjTQGhYOdxvvJUsN32fKJroStRyYTqtKjKvGJVwZO-LrNcZCoXIk3TfaFKuZeCKs3UkQmmSSem5oyLlPEqzbKK8504SqVLXWYlEaWFgozRKM2wixWOE5AY7xeq9yyvimSQHQ1-nSPOJ_qJqxI4j2Pl6mhz0y0nDxkbjA_-_ZVgwkD1_8Z70q8pkGtT2ONnveK3BojFei_EW3muoTNhsrjhzyk2oV-6nbIj8DbGcRE3s7NnUgF4u0bvgbcru98BAAD__zygLFE">