<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJytVF2zmyAQ_TX4wtyMgDb64EOTNH3qb-igEKWXgCPgvemv74r5bjLTO72MisuBs3t2V2srDhVKNyj9GoxTrZECNzYYr0z7c2cHRIvz-sg1omt8tp3ng0e0xGi5mikwjAuN8RixDU4Ru4KBE1-TqrhnpmKraH6LnsBAdAWXmlwA2WzdkA3Sh8FE8LSMlpvjyxNRb53S8tNlPdFz2SDsLd80HouahnqwDspwDH7K3yVPtPxgSr6v17gfrAiNdIgdF5_VXE0hXiUn2uX52CnevR3jLPn7tF06dYu_Q9UjLmYcphvcyPZ8_jZF-_54UD0kbsCzqS-O74khHXcC_6r_J0k847NE8lGBbhYoHgis8T8IvH523vextnQLV2tFbbVf2KEF6zfccpczYl2xTETFRMlKnvDgOztUgo9q2j1y414PSRh0dUemfBfqRWP3YGg9nqYXaKlfsoHUbZVzAVqLbnO6LGnSVSVfilqInDV5mu4KeLKMyoI1qSRNRkSieS21q1AOTU-NfMORAt5Rvkn-PwJV0ZQSQklBSJ5TtiBfWJGVNCOlIIVsMpSlcs-VXkw8U56SoYqUdWgdgFo57y4gd7FVZAwYIvTKa1n9AK_QPrbv7eCDUf4Qf3Y7ZbievtQgoVi95o3cS-OTGGMVA_wD2YGXGQ>52792</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Missed opportunity for final value replacement
        </td>
    </tr>

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

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

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

<pre>
    
unsigned counting_for(unsigned val, unsigned start) {
    unsigned cnt = 0;
    for (unsigned i = start; i > val; ++i) cnt++;
    return cnt;
}

unsigned counting_while(unsigned val, unsigned start) {
    unsigned cnt = 0;
    unsigned i = start;
    do {
        cnt++;
        i++;
    } while (i > val);
    return cnt;
}

GCC produces:
counting_for(unsigned int, unsigned int):
        mov     eax, esi
        xor     edx, edx
        neg     eax
        cmp     edi, esi
        cmovnb  eax, edx
        ret
counting_while(unsigned int, unsigned int):
        mov     eax, esi
        mov     edx, 1
        neg     eax
        cmp     esi, edi
        cmovb   eax, edx
        ret


https://godbolt.org/z/ef531os87
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytU9uO2yAQ_Rr8ghoZsBPz4IcmafrUb6iwIQ4tActAdtOv7xjn3kTqSots4-HAmTkHaJw81ihfo_xrtF53VkncumiDtt3PrRsQrS7jB2EQXeFL7IMYAqIco8VyosDQrjQ2YMTWOEfsBgZOfEuq05yJii1T-C1lggDRJTx6TAFkU3RHNqgQB5vA8zBarE8_L0S97bRRny7rhZ7rBOnu-cb2XNTY9JNxUIZT8aN_V58o_6Al31cr3A9OxlZ5xE6Dr_ZcjyXemJNifll2rnfvDqlX4n2crry-x99h1xMuJxy6O9yq7rL-3qJ9f1qonxK3kNk218SPxGDHg8B_9v-TJF7wSSL5qEA_CZRPBDb4PwTefnch9Glv6QaezsnGmTBzQwfRH3jVtmTE-WqRyZpJzrjIgg5G1T-092CB63s3hGh1OKYLu9VWmPG0RQUJeyNatVc2ZHEw9UMuHXaxmbVuD4Exh3P3BU7cL9WCsxtIEeHk0U1JF5xmu5qQds5Lyts2rxSZE543rODFPFdMzStOMiMaZXyNSrgT1Ko3nCjgH5XrTNc0p4RQUhFSlpTNyJxVBacF4ZJUqi1Qkau90GY21jGakA11KqmJnQfQaB_8FRQ-nQOV0gG_iGHnhlqKgx5tPAjrfx-zVEGdFPwFDRCAlw">