
The tablegen patterns on vector_extract only match i32 constants, but on wasm64 these come in as i64 constants. In certain situations this would cause crashes whenever it couldn't select an extract_vector_elt instruction. Rather than add duplicate patterns for every instruction, this just canonicalizes the constant to be i32 when lowering. Fixes https://github.com/llvm/llvm-project/issues/57577 Differential Revision: https://reviews.llvm.org/D140205
19 lines
652 B
LLVM
19 lines
652 B
LLVM
; RUN: llc < %s -mattr=+simd128 -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals
|
|
|
|
; Regression test for a crash on wasm64 when trying to lower extract_vector_elt
|
|
; with a 64 bit constant:
|
|
;
|
|
; t19: i64 = extract_vector_elt t18, Constant:i64<0>
|
|
|
|
target triple = "wasm64-unknown-unknown"
|
|
|
|
define void @foo() {
|
|
store <4 x i32> zeroinitializer, ptr poison, align 16
|
|
%1 = load <4 x i32>, ptr poison, align 16
|
|
%2 = extractelement <4 x i32> %1, i32 0
|
|
%3 = insertelement <2 x i32> undef, i32 %2, i32 0
|
|
%4 = insertelement <2 x i32> %3, i32 poison, i32 1
|
|
store <2 x i32> %4, ptr poison, align 8
|
|
unreachable
|
|
}
|