Closed
Description
I tried this code:
code originally from ./src/test/codegen/simd-wide-sum.rs
#![crate_type = "lib"]
#![feature(portable_simd)]
use std::simd::Simd;
const N: usize = 8;
#[no_mangle]
// CHECK-LABEL: @wider_reduce_into_iter
pub fn wider_reduce_into_iter(x: Simd<u8, N>) -> u16 {
// CHECK: zext <8 x i8>
// CHECK-SAME: to <8 x i16>
// CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
x.to_array().into_iter().map(u16::from).sum()
}
Meta
rustc --version --verbose
:
rustc 1.63.0-nightly (ec55c6130 2022-06-10)
binary: rustc
commit-hash: ec55c61305eaf385fc1b93ac9a78284b4d887fe5
commit-date: 2022-06-10
host: x86_64-unknown-linux-gnu
release: 1.63.0-nightly
LLVM version: 14.0.5
When compile with -Zmir-opt-level=3
, there is a LLVM_ERROR
which does not occur with -Zmir-opt-level=2
rustc ./src/test/codegen/simd-wide-sum.rs --edition=2021 -Zmir-opt-level=3 -Zvalidate-mir
Invalid bitcast
%10 = bitcast <8 x i8> %9 to [8 x i8]
in function wider_reduce_into_iter
LLVM ERROR: Broken function found, compilation aborted!
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: SIMD (Single Instruction Multiple Data)Area: MIR optimizationsCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Project group: Portable SIMD (https://github.com/rust-lang/project-portable-simd)Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.