[PATCH] D14596: [SROA] Choose more profitable type in findCommonType

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 15:54:49 PST 2015


On Wed, Dec 16, 2015 at 3:20 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
> chandlerc added a comment.
>
> So, the problem here is that the instcombine pass tries to remove the bitcast from i32 to float, but fails because of the phi node.
>
> Specifically, we have a combine that handles bitcasts of loads and bitcasts prior to stores, but we don't have anything that looks through phi-nodes. If you were to reg-to-mem the phi nodes so that they were replaced with loads and stores to an i32 alloca, I believe you would find that instcombine would remove the bitcasts and make all of these floating point.

This sounds reasonable. However does instcombine need to insert
additional bitcasts from float to i32 in places where i32 type is
expected (i.e. the store after the loop)? If that is the case, the
combine still needs to know the relative frequency of the eliminated
bitcasts vs the inserted ones?

David

>
> The key will be to push this to handle phi nodes as well. This may be a bit trickier because you really want to handle even complex cycles of phi-nodes. Does this make sense? I'm familiar with this part of instcombine if it would be helpful for me to help you craft this change.
>
>
> http://reviews.llvm.org/D14596
>
>
>


More information about the llvm-commits mailing list