Peter Rong 3b2476910b [WASM] Prevent casting undef to CosntantSDNode
WebAssembly tries to cast an `undef` to `CosntantSDNode` during `LowerAccessVectorElement`.
These operations will trigger an assertion error in cast.
To avoid this issue, we prevent casting, and abort the lowering operation.
A unit test is also included.

This patch fixes [pr61828](https://github.com/llvm/llvm-project/issues/61828)

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D147198
2023-03-30 20:14:11 -07:00

10 lines
292 B
LLVM

; RUN: llc < %s -mattr=+simd128 -mtriple=wasm64
define void @foo(i64 %i0, i64 %i1, ptr %p) {
%B4 = urem i64 %i0, %i0
%B5 = udiv i64 %i1, %B4
%I = insertelement <4 x float> <float 0.25, float 0.25, float 0.25, float 0.25>, float 0.5, i64 %B5
store <4 x float> %I, ptr %p
ret void
}