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

    <tr>
        <th>Summary</th>
        <td>
            Visibility of a global variable affects autovectorization
        </td>
    </tr>

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

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

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

<pre>
    ```c++
#ifdef STT
static
#endif
int barx[8];

void inc() {
    for (auto& foo : barx) {
        foo += 1;
 }
}
```

https://godbolt.org/z/sfPnGcW5a

`static int barx[8]` version simply unrolls 8 sequential increments, while int `int barx[8]` performs a SIMD operation.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsUs-K3DwMfxrlInbwKHEmc8hh9hvy0UOhsEt7VhJlRsWJp7Yz292nL0m2lC4FYYMs_f5Y4hj1MonUYB_BnjOe09WHmkOSMWt9_1pDabbogB6XMCegXIdeBnx6fgZziomTdltepl4HMCedErYcfoJ9rMCeIV_7zOnutUedOqAK6IhwWPKIiIMPCFTxnDxQiYP3CPlpw_ircCv2uEjJz7jfoBEO54VhO39L3jivKd0i5CegBqi5-L71Lu18uAA1b0BNHL5M_3ffLG_lUJrNEX40URq8S4jqJ4w63twrzlPwzkWsMMqPWaak7BZ7QUaZUgT6D1-u6mSFgtL8A_EmYfBhjMj49OnzGf1NAif10y7r67w_5kfOpN4fCnOwpiptdq3zfmA6shmKsu0ONm9L6UxLHXNBdp8XmdZkyBqiap_bguyOLR27Pt9XZVVUTAYKIyOr2zl3H5evyDTGWeo9HakoM8etuLjuBNEkL7i-AtGyIqFemh7a-RKhME5jin9gkiYn9VeN2qrT9Ip-QMaL8y07vHNQbp0gD4N0KeIy7bt0yQd9Wz1nc3D1h3lpus7trvMjULPwvF8Pt-C_S5eAmlVdBGre5d9r-hUAAP__tn_dLA">