<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65763>65763</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LoopFullUnrollPass failed due to constant inference in opaque pointer mode.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue,
llvm:optimizations,
missed-optimization
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
DianQK
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DianQK
</td>
</tr>
</table>
<pre>
I tried to disable the opaque pointer in https://github.com/rust-lang/rust/issues/115339 to get the SLPVectorizer optimization.
See https://godbolt.org/z/GqdPGarsn.
According to my investigation, the success of optimization in non-opaque pointer mode relates to [SROA.cpp#L1831-L1845](https://github.com/llvm/llvm-project/blob/llvmorg-16.0.6/llvm/lib/Transforms/Scalar/SROA.cpp#L1831-L1845) or [InstructionCombining.cpp#L2220-L2274](https://github.com/llvm/llvm-project/blob/llvmorg-16.0.6/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp#L2220-L2274). Unfortunately, these two transformations have been removed during opaque pointer migration.
My plan is to restore the behavior of [InstructionCombining.cpp#L2220-L2274](https://github.com/llvm/llvm-project/blob/llvmorg-16.0.6/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp#L2220-L2274) using `alloc` instead of `bitcast`.
Looking at the code comments, this seems to be an important optimization. So it might be worth backporting to LLVM 17?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVE2P2zYQ_TX0hbBAUpZsHXRwduEgqINu6yZ3ihxLbCiOwqG82P31BWVvulkERXvpIReZ5gzn472Zp4lcHwBaVr1jSt07HX77hSnFqvuVntOAsb3erTq0T-0HnqIDyxNy60h3HngagOOkv87AJ3QhQeQu8CGliVi5Z-rA1KF3aZi7wuDI1CHOlNZeh_52ZurgiGYgpg5SVmXZ5PA9pCX06fjwGUzC6J4hcpySG92zTg5DwcQ9E_sTwNtsaDv0qcCYUzwzdXj_1T6815Fe3ly_e2MwWhf6nG984i5cgJLrl-hM3S35aTYGiDiev0ueewwY1m86H9ECj-B1AspRWfXu9Puv-8JME1PlUe5KuT7K3aZi1T1Tu39AyfvLy896ivgnmAxU57G73WLs17IuRFG_8nbZ-kfUgc4Yx4zoyWivYz78uA7VcIy5zg-BUpxNbu4Ox84FF_oXf6WUWB-V2m7-t7pzOdc64PbvXxSnmoJ_CmeMaQ46gX-6sUjA0yPy9JJgoZD4oC_AO4DAI4x4AcvtHPM8vGXV9fH1yF2_H5_45HXgbmE6AiWM13XoYNAXhzEPzU-DLJ8pQ8Nqob1Hw2rBXaAE2i5t1qJzyWhKrBY3mI6IX_ITfd1kk3fD4DhCSHQlxhEngHEBsAOewRwnjEmH9P2q8xNylzIRQ8qejxjTwDttvmT32wofj58_crll5WFl29I2ZaNX0Mq62chdKaRYDe1Wn3eVtlZu61LopqptLU0jy51R1qpms3KtEqoUjdjJjSpLUahtBxLqUtpOgJGSbQSM2vkiA5wlZrWIV1tX27pced2Bp5uYBnjkizHrqbpjSi2klPvXrdE34-iIwK5fG29CHNuF9G7uiW2Ed5To7_TJJQ_tEXE6zN5_ChG9f9BE_KydX0YaMjgGAy24unCGCMFAlrAfyFexmqNv__McfpPwBYi_AgAA___LEBhq">