[all-commits] [llvm/llvm-project] 51a938: [WASM] Fix legalizer for LowerBUILD_VECTOR.

Peter Rong via All-commits all-commits at lists.llvm.org
Thu Mar 30 19:20:17 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 51a93828d782dae09f2dc69aae53f4e6dd1ca98a
  Author: Peter Rong <PeterRong96 at gmail.com>
  Date:   2023-03-30 (Thu, 30 Mar 2023)

  Changed paths:
    M llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
    A llvm/test/CodeGen/WebAssembly/simd-pr61780.ll

  Log Message:
  [WASM] Fix legalizer for LowerBUILD_VECTOR.

Constants in BUILD_VECTOR may be down cast into a smaller value that fits LaneBits, i.e., the bit width of elements in the vector.
This cast didn't consider 2^N where it would be cast into -2^N, which still doesn't fit into LaneBits after casting.
This will cause an assertion in later legalization.

2^N should be cast into 0, and this patch reflects such behavior.
This patch also includes a test to reflect the fix.
This patch fixes [issue 61780](https://github.com/llvm/llvm-project/issues/61780)

Related patch: https://reviews.llvm.org/D108669

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D147208

More information about the All-commits mailing list