Skip to content

LLVM Assertion failed when optimizing SIMD code on aarch64.apple.darwin #140933

Open
@bk-eclipse

Description

@bk-eclipse

Code

#![feature(portable_simd)]
use core::simd::Simd;

type BASE=u64;
fn test(
    value: [Simd<BASE, 1>; 2]
) -> Simd<BASE, 1> {
    rotate_right(Simd::splat(1) ^ value[0], 8)
}

fn rotate_right(v: Simd<BASE, 1>, count: BASE) -> Simd<BASE, 1> {
    (v >> count) | (v << (64-count))
}

fn main() {
    let v = [Simd::splat(1); 2];
    assert_eq!(test(v), Simd::splat(1));
}

Meta

rustc --version --verbose:

rustc 1.89.0-nightly (dcecb9917 2025-05-09)

Error output

error: rustc interrupted by SIGILL, printing backtrace
Backtrace

Thread 9 "lto cgu.0" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7fffdcbff6c0 (LWP 481356)]
0x00007fffed215dbb in llvm::AArch64InstrInfo::copyPhysReg(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::DebugLoc const&, llvm::MCRegister, llvm::MCRegister, bool, bool, bool) const ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM.so.20.1-rust-1.89.0-nightly
(gdb) bt
#0  0x00007fffed215dbb in llvm::AArch64InstrInfo::copyPhysReg(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::DebugLoc const&, llvm::MCRegister, llvm::MCRegister, bool, bool, bool) const ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM.so.20.1-rust-1.89.0-nightly
#1  0x00007fffef8b6eac in llvm::TargetInstrInfo::lowerCopy(llvm::MachineInstr*, llvm::TargetRegisterInfo const*) const [clone .cold] ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM.so.20.1-rust-1.89.0-nightly
#2  0x00007fffeec34b8d in (anonymous namespace)::ExpandPostRA::runOnMachineFunction(llvm::MachineFunction&) ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM.so.20.1-rust-1.89.0-nightly
#3  0x00007fffee828f91 in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM.so.20.1-rust-1.89.0-nightly
#4  0x00007fffee8283ef in llvm::FPPassManager::runOnModule(llvm::Module&) ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM.so.20.1-rust-1.89.0-nightly
#5  0x00007fffeee5d7c3 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM.so.20.1-rust-1.89.0-nightly
#6  0x00007ffff6830302 in LLVMRustWriteOutputFile ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-9dc9f9e211dbb3c2.so
#7  0x00007ffff682fe61 in rustc_codegen_llvm::back::write::write_output_file ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-9dc9f9e211dbb3c2.so
#8  0x00007ffff682d426 in rustc_codegen_llvm::back::write::codegen ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-9dc9f9e211dbb3c2.so
#9  0x00007ffff682d0f4 in rustc_codegen_ssa::back::write::finish_intra_module_work::<rustc_codegen_llvm::LlvmCodegenBackend> ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-9dc9f9e211dbb3c2.so
#10 0x00007ffff682be2a in std::sys::backtrace::__rust_begin_short_backtrace::<<rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::ExtraBackendMethods>::spawn_named_thread<rustc_codegen_ssa::back::write::spawn_work<rustc_codegen_llvm::LlvmCodegenBackend>::{closure#0}, ()>::{closure#0}, ()> ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-9dc9f9e211dbb3c2.so
#11 0x00007ffff68f8c5c in <<std::thread::Builder>::spawn_unchecked_<<rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::ExtraBackendMethods>::spawn_named_thread<rustc_codegen_ssa::back::write::spawn_work<rustc_codegen_llvm::LlvmCodegenBackend>::{closure#0}, ()>::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-9dc9f9e211dbb3c2.so
#12 0x00007ffff68f8feb in std::sys::pal::unix::thread::Thread::new::thread_start ()
   from ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-9dc9f9e211dbb3c2.so
#13 0x00007ffff069c043 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447
#14 0x00007ffff071a778 in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-SIMDArea: SIMD (Single Instruction Multiple Data)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-appleOperating system: Apple (macOS, iOS, tvOS, visionOS, watchOS)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions