<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62116>62116</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
attribute(annotate) impedes static initializer optimization
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
davidben
</td>
</tr>
</table>
<pre>
We bumped into this interesting case where adding an annotate attribute to a pointer causes Clang's static initializer optimizations to stop working:
https://godbolt.org/z/Kn65GG5ME
https://godbolt.org/z/vGxzb3KcY
(Yes, that code is doing strange things with initializer lists and should just be written [this way](https://godbolt.org/z/cEj9hEao6). We'll switch that, but the lost optimization was still surprising and seemed worth filing a bug for. 😄)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMUj1zrDgQ_DUimfIWiGUXAgJ_4cB1scuhhGZhfFppSzOY8_76K2HfvfJL_BKQRtNSd08bZpoCYq-aO9U8FGaROabemXdyFkNho_voXxDscr6gAwoSQWbivMKELBQmGA0jrDMmBONcrpgAJoQoRhCMSCK7CIJEMHCJGxRGszAy3HsTJqWPDCxGaAQKJGQ8XTFBvAid6WqEYuAMZ4kXWGP6m8Kk6ltVPqjydha5cN7pQelhis5GL7uYJqWHq9LDczg0T0_NX49_1v7-9M_V1s_j62f711e3r8hK34PMRmCMDoEYXMxqWZIJE2ZjwsSwkszfZHhiYTDBAc9x8Q7eFhawCGsiEQygmrvN1NV8qOZB6fYnjuPjWzc_mnhQutvBCyp99B54JRnnjWFmahcBmRF8ZPlmJawm200ZsqRLIv6cmQNGPKPLDssMJ_JbHewywSmmHaihVN2gula1e6W7wvW16-rOFNhXh7aqu73udDH3tnTV_jgescHSYtcd2uPhaPB4wtYaNK6gXpe6LvdVXdVNW-ldZcu6qcq2Lqu6NOak9iWeDfmd9-_nLLwg5gX7g66qQ-GNRc9bZrUOuMJ2qLTOEU59xtzYZWK1Lzfvf90iJB77_yOpdPtfTpXugHLI8ccoFkvy_W8jIpkXuxvjWekhv_b1u7mk-IajKD1sHFnpYdPwbwAAAP__aL4pfw">