[llvm] InstSimplify: lookthru casts, binops in folding shuffles (PR #92668)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Sat May 18 16:19:13 PDT 2024


artagnon wrote:

I had a look at #88693, and the approach seems a lot more complicated than the one in this patch. I think there's a clear separation of concerns though: InstCombine (and by extension, InstSimplify) is equipped to handle only simple cases, performing trivial removal and rewriting, where the transform is obviously profitable, while VectorCombine is geared toward more complicated transforms possibly involving intrinsics, rewriting the entire tree of instructions, and using a CostModel.

For instance, the case of binary operators with unequal operands and intrinsics can be handled in VectorCombine, but for the simple case of just looking through some intermediate instructions between canceling shuffles, and eliminating the shuffles can be done in InstSimplify.

Besides, there was already code to fold canceling shuffles in InstSimplify, and there are several existing tests in InstSimplify/InstCombine that exercise this. I merely extended it a little bit.

What do you think?

https://github.com/llvm/llvm-project/pull/92668


More information about the llvm-commits mailing list