[llvm] [VectorCombine] Add support for zext/sext/trunc to shuffleToIdentity (PR #92696)

David Green via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 11:12:46 PDT 2024


================
@@ -754,10 +720,8 @@ define void @trunc(<8 x i64> %a, <8 x i64> %b, ptr %p) {
 
 define <4 x i64> @zext_chain(<4 x i16> %x) {
----------------
davemgreen wrote:

My guess is that is because we don't currently handle multiple uses. It was my plan to add something, but it wasn't necessary for the motivating example I had, and it makes things more complex.

As as simple fix, we could try changing the hasOneUse check to hasOneUser, but it looks like it will still generate a tree from the original root, so generate multiple instructions where only one is needed. The limits should prevent it from being 2^n from a long chain, but it isn't as efficient as it could be.

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


More information about the llvm-commits mailing list