[llvm] [InstCombine] Move extends across identity shuffles. (PR #146901)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 8 09:20:29 PDT 2025


preames wrote:

> > Not an objection, but a possible point of concern. We canonicalize shuffles after binary operators, and unary operators. Having the shuffle canonicalized before the casts seems slightly inconsistent. We should canonicalize one direction or the other, but is pulling the shuffle early the right choice? I have no strong opinion here, just raising the question for consideration.
> 
> Yes that's a slight inconsentency, but casts seem perhaps different enough to warrant separate treatement, as extending casts on wider vectors are usually more expensive than on narrower vectors. So moving them earlier should never make things worse, whereas moving after the cast could make things worse in practice.

Seems reasonable.  We can always revisit if needed.

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


More information about the llvm-commits mailing list