[PATCH] D138766: [InstCombine] If loading from small alloca, load whole alloca and perform variable extraction

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 1 12:03:01 PST 2022


lebedev.ri added a comment.

Thank you for taking a look!

In D138766#3964537 <https://reviews.llvm.org/D138766#3964537>, @efriedma wrote:

> riscv64 doesn't have vectors without the "v" extension, so anything involving byte vectors is going to get scalarized to something very messy.  With -mattr=+v, you get something similar to what you'd expect on other targets.



> It feels a little weird to me that you're using an integer shift on a vector... I'd guess in most cases, you'd want some sort of variable shuffle (like x86 pshufb).

As per langref, poison is byte-wise, so in situations like this, we **can't** just load `i64`,
we **must** load `<8 x i8>`, freeze it(!), and finally bitcast to the `i64`.
I'm not using vector for anything else here, shift is scalar.
Also, we don't really have a way in LLVM IR to represent a shuffle with variable mask.
Shift is the right choice here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138766



More information about the llvm-commits mailing list