[PATCH] D138874: [InstCombine] canonicalize trunc + insert as bitcast + shuffle, part 3

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 12:47:55 PST 2022


spatel abandoned this revision.
spatel added a comment.

In D138874#3981419 <https://reviews.llvm.org/D138874#3981419>, @dmgreen wrote:

>> After thinking this over again, we should be able to add a more specific peephole that finds the common source op by looking through shifts and casts:
>> https://alive2.llvm.org/ce/z/_4iTEu
>> It's bigger than the typical pattern match, but it's not that bad. It could start off very narrow and be generalized in a few steps. 
>> That avoids creating a shuffle, so it sidesteps the backend problems noted here. The question of whether we should canonicalize in the opposite direction from this patch is still open.
>
> I don't want to block any work, don't consider me having any real objection. Some of this feels a little X86-shaped for instcombine, but the motivating example in #17113 seems like it would apply to any architecture, and I haven't seen any cases that can't be fixed up in the backend.

I agree that this is on the borderline - we're not ready to canonicalize to shuffles more generally. I've reverted the earlier patches and put up an alternative:
D139668 <https://reviews.llvm.org/D139668>


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138874/new/

https://reviews.llvm.org/D138874



More information about the llvm-commits mailing list