[llvm] [RISCV] Combine build_vector of extract_vector_elts to vector_shuffle (PR #80883)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 11:13:28 PST 2024


preames wrote:

Luke, it sounds like you went further than I'd intended.  I was really only suggesting replacing the explode/build fallback with a packed shuffle fallback.  However, let's focus on the current patch.

For an m1 vector, replacing a set of extracts and inserts with a shuffle is going to always be a win.  It might be that VL=1 might be worthwhile as the extract and insert idiom, but I don't think that case is worth worrying about too much.

However if the source vector is > m1, then the vrgather is (in general) quadratic.  Given the cost of the extract and insert will be either O(NumElems) for exact vlen or O(NumElems * LMUL) for default case, we have the possibility of introducing a regression here.

Please limit the initial version of this transform to m1.  


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


More information about the llvm-commits mailing list