[WebAssembly] Fix ISel crash in SIGN_EXTEND_INREG lowering
authorThomas Lively <tlively@google.com>
Wed, 3 Jun 2020 22:36:44 +0000 (15:36 -0700)
committerThomas Lively <tlively@google.com>
Wed, 3 Jun 2020 22:36:44 +0000 (15:36 -0700)
commit25af2126f93a76f39c3121b3ddccdfd9f1aba4be
tree766a12a794cfb8a12ec9574e46d0153e0ef61e51
parent969d2d1ea9466143e7099040f5f0735cc81963b1
[WebAssembly] Fix ISel crash in SIGN_EXTEND_INREG lowering

Summary:
The code previously assumed that the index of a vector extract was
constant, but this was not always true. This patch fixes the problem
by bailing out of the lowering if the index is nonconstant and also
replaces `static_cast`s in the lowering function with `cast`s because
the latter contain type-checking asserts that would make similar
issues easier to find and debug.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81025
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
llvm/test/CodeGen/WebAssembly/simd-nonconst-sext.ll [new file with mode: 0644]