[llvm] [WebAssembly] Fold constant `i8x16.swizzle` and `i8x16.relaxed.swizzle` to `shufflevector` (PR #169110)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 24 09:45:33 PST 2025


valadaptive wrote:

I've moved the new TTI hook into `WebAssemblyTargetTransformInfo.cpp`.

I've decided to keep treating the swizzle indices as signed--the code is a lot cleaner that way, it's functionally equivalent since all valid indices are between 0 and 15, and finally [I can't actually tell whether the spec treats them as signed or unsigned](https://www.w3.org/TR/2025/CRD-wasm-core-2-20250616/#-mathsfi8x16hrefsyntax-instr-vecmathsfswizzle%E2%91%A0). 


I'm still unsure about the following:
- I'm handling undef values in this transform the same way that the x86 version does, [but I don't know if that's correct.](https://github.com/llvm/llvm-project/pull/169110#issuecomment-3565990569)

- If I can, I want to write an Alive2 proof for this transform, but I can't find any good guides on how to do so. In particular, I don't know if it supports "for all arbitrary constants" constraints.

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


More information about the llvm-commits mailing list