-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
backend:HexagoncrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]
Description
This program reduced from Rust's core_simd
fails as shown below.
$ cat ./test_v64i1_truncate_error.ll
; Minimal LLVM IR reproducer for "Cannot select: v64i1 = truncate" error
; Based on error from: crates/core_simd/src/select.rs:71:13
; Function: Mask::select implementations in portable-simd
target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
target triple = "hexagon-unknown-linux-musl"
define void @test_v64i1_truncate_error(<64 x i32>* %mask_storage, <64 x i32>* %true_vals, <64 x i32>* %false_vals, <64 x i32>* %result) {
entry:
; Load a wide integer vector that represents mask data
%mask_wide = load <64 x i32>, <64 x i32>* %mask_storage
; This truncate from <64 x i32> to <64 x i1> triggers: "Cannot select: v64i1 = truncate"
; This operation mimics what happens in Mask::select when converting mask representations
%mask = trunc <64 x i32> %mask_wide to <64 x i1>
; Load the input vectors
%true_vec = load <64 x i32>, <64 x i32>* %true_vals
%false_vec = load <64 x i32>, <64 x i32>* %false_vals
; Use the v64i1 mask in a select operation - this forces LLVM to handle the truncate
%selected = select <64 x i1> %mask, <64 x i32> %true_vec, <64 x i32> %false_vec
; Store result to prevent optimization elimination
store <64 x i32> %selected, <64 x i32>* %result
ret void
}
$ ~/src/toolchain_for_hexagon/obj_lld/bin/llc -mattr=-small-data,+hvx-length128b ./test_v64i1_truncate_error.ll
LLVM ERROR: Cannot select: t12: v64i1 = truncate t63
t63: v64i32 = concat_vectors t61, t62
t61: v32i32,ch = load<(load (s1024) from %ir.mask_storage, align 256)> t0, t2, undef:i32
t2: i32,ch = CopyFromReg t0, Register:i32 %0
t62: v32i32,ch = load<(load (s1024) from %ir.mask_storage + 128, basealign 256)> t0, t60, undef:i32
t60: i32 = add t2, Constant:i32<128>
t2: i32,ch = CopyFromReg t0, Register:i32 %0
In function: test_v64i1_truncate_error
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/brian/src/toolchain_for_hexagon/obj_lld/bin/llc -mattr=-small-data,+hvx-length128b ./test_v64i1_truncate_error.ll
1. Running pass 'Function Pass Manager' on module './test_v64i1_truncate_error.ll'.
2. Running pass 'Hexagon DAG->DAG Pattern Instruction Selection' on function '@test_v64i1_truncate_error'
...
Metadata
Metadata
Assignees
Labels
backend:HexagoncrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]