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

    <tr>
        <th>Summary</th>
        <td>
            Variable properties lost when passed through aggregates
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    * entry() has an aligned range (both the beginning and the end) specified with a pointer p and a size sz
* entry() passes p and sz as separate arguments to foo_for( p, sz ) which loops on the range - it gets properly vectorized w/o any tail or alignment codegen
* entry() passes p and sz as a std::span to foo_span({ p, sz }) which loops on the span - it gets suboptimally vectorized - as if the optimizer looses the alignment info

https://godbolt.org/z/xx7M15YYh

Notes:
- on godbolt it looks as if at least the alignment of the size variable does get 'somewhat' preserved with Clang 14 but I cannot reproduce that locally with Clang-CL 14 (I get the same codegen as with Clang 13)
- likely related to https://github.com/llvm/llvm-project/issues/54193
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyllEtr4zAQxz-NfRkS_Ijt5uBDHxQKu3tc6GmR7LGtraIxkpw0-fQ7UhLSLRQWFpzEkuY_85uHIqk_tklxD2i8PSbFXVJsYRIOhAGh1WiwByvMiMBnkvwEfkKQOCpjlBnZrI87aPqgdDN2alAsOii2FTCTMh4tzNFSgFMnBHdKsqcku_8cdxbOobvYuhMwhsNZWOERhB2XHRs78AQD0a-BLMtgTorHYBv0h0l1E2ii2QGZyHVmX4HyMCKLZ0szWn2EPXaeLNMwalI8E8c8ghdKA9lz5iEadNTjiOafeTlD3yflPT9u5hpeYMN7EDUPN-Dm6QvmKLwhu0XS7NVO6L-xVyGeGqIkGvCuDZ4CU9i8ZaHMQJcU4vfk_ewCZfHMz0i9JO3XZEdenfjz_t58z6vX1-mj6Ad5jKK4WgXaizKgctw3dyESvETh_CcKOrPGEdgLq4TUCD0xLefJDWwc7fAwCc-v3Ch0aPfXSXrU3EjINyAXDy_QCWPIg0XuZ790yI5DUOpikW6K1eO3IOLSv8QgMb7Y4bWvAfij_5Jbcs1PqzdkZxY1z18fOvmpbKxb5LqjHS-03l9_Vsz0m9vES-XcwjUrnqtNvi3Tvi37bbkVqVdeY_vzWoPzUHrFldDEZTtMTBaHK1wuS8vIV2kcLY5M4tLF6vZ_UJp6k05tWWItq7rDqqxqIfqqzrvtnShE3nUSc5FqIVG7NqkekuopVW2RFUW2yaq8LvOiWddV2QyyappMVkNfNMkmwx3fn3UIHGYptW1kkMvo-FAr593tkLML_y549S8WP5FtZ6cmkUbYNpL-AZZ9iy4">