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

    <tr>
        <th>Summary</th>
        <td>
            [hexagon] loop-3c fails with -Os
        </td>
    </tr>

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

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

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

<pre>
    This program (reduced slightly from llvm-test-suite's `SingleSource/Regression/C/gcc-c-torture/execute/loop-3c.c`) fails with -Oz but passes with -O0, -O2, -Os.
 
```
#include <limits.h>

void * a[255];

f (m)
{
  int i;
  int sh = 0x100;
  i = m;
  do
    { 
 a[sh >>= 1] = ((unsigned)i << 3)  + (char*)a;
      i += 4;
    }
 while (i < INT_MAX/2 + 1 + 4 * 4);
}

main ()
{
  a[0x10] = 0;
 a[0x08] = 0;
  f (INT_MAX/2 + INT_MAX/4 + 2);
  if (a[0x10] || a[0x08])
 abort ();
}

```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcU8GOozgQ_ZriUkpkyhDDgQNJJtIedkfamcPeVg52wCuDI9t09-zXj2wm6emOUJx65Vf1qsKTIZhx0bqD-gj1uZBrnJzv5KK8m7mSxdWpH933yQS8ezd6OSNQ47VaB60wWDNO0f7Am3czWvsy76IOcRdWEzWQCAgH9s0so9Xf3OoHDXT5W49eh2DcAnQ5AV3GYdgNu-h8XH26oN_0sCb6xTp33_FhP8CBAbV4k8YGfDVxwt3X__G6RrzLEPQTY0An3H2l7Qh7YD0C6xN9e1gPxM0y2FVpBH6yZjYx7CfgX1KO9S_OKATqUUJ9pLqG-gz8uOVuafQZqE2hSCCiWSKa7cYWhAmBn5G9lYw98QzNj1C5fCCCOCZ5uVfmfcnPGUuoz5kD1AA165L_JAXUplIn4CfkaSEIdEx3hkl6oB6olY8m6WNSPpWp3lEQ5_TrdTJWJ2ouiH_89f3fP_t_gC6Ua5b5u8qbqNLE2w4yF1g_S7Ns2n7fRRojzf0Q_5h_w1nzGce80M-t3-Mqx_Rsj2gy40MfcQJx-r3Fpgnl1fn40PhR_fN1KFTHVctbWeiuFBVnQjR1VUzdTVW3Qd5acThcm4OuSTeiVEqpgWRzPTSF6YhRzTiJkkrBq31bcUEN54y11U20AiqmZ2nsPpli7_xYmBBW3ZWcU1UWVl61Ddl0RIt-xZwFouRB32UnXdcxQMWsCTG8l4km2uzWSb_J0S1pCb988tEfoVi97aYY7wF4D3RJVjNxWq_7wc3JXfblcezu3v2nhwh0yUIC0OWX0peOfgYAAP__22MhRg">