Skip to content

Malformed LLVMIR generated for AMX tile registers #165931

Open

Description

@adamgemmell

We spotted in stdarch's CI that a recent change uncovered an error in LLVM when compiling core_arch: https://godbolt.org/z/eGaf7YKGf

Failed to config tile register, please define the shape earlier

Minimal LLVM IR repro by @sayantn: https://godbolt.org/z/KqeWaeKKE The RHS is what rust currently generates and has been shown to never compile on LLC (since 20.1). The only difference between the 2 is that the tile corresponding to %a is loaded before loading all fields of %b in the RHS.

I bisected the issue to #164578 but that PR probably only uncovered the error, while some change to rustc that changed the order of operations in LLVMIR would have caused the actual issue.

https://rust.godbolt.org/z/qrdbo1YPr is a repro in Rust. The input can be manipulated to avoid the error, for example by getting the tile dimensions from dst or by turning optimisations off.

Backtrace

Backtrace

$ cat /tmp/stdarch-amx-c.rs
#![feature(x86_amx_intrinsics, avx512_target_feature)]
#![allow(stable_features, improper_ctypes_definitions)]
use std::arch::x86_64::{__tile1024i, __tile_cmmimfp16ps};
#[unsafe(no_mangle)]
#[target_feature(enable = "amx-complex")]
pub unsafe extern "C" fn repro(dst: *mut __tile1024i, a: __tile1024i, b: __tile1024i) {
    unsafe { __tile_cmmimfp16ps(dst, a, b) }
}
$ RUST_BACKTRACE=full rustc /tmp/stdarch-amx-c.rs --crate-type lib -O --emit=obj -o /tmp/stdarch-amx-c.o -Ztreat-err-as-bug=1
error: internal compiler error: repro: Failed to config tile register, please define the shape earlier


thread 'rustc' (3596394) panicked at /rustc-dev/8eb778d04094d3af4b26580cab327e0413eb1e02/compiler/rustc_errors/src/lib.rs:1446:17:
aborting due to `-Z treat-err-as-bug=1`
stack backtrace:
   0:     0x71158e5fcc86 - <<std[75d981f13140cbe0]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[ab2f8d7ac3290d3a]::fmt::Display>::fmt
   1:     0x71158ec10e69 - core[ab2f8d7ac3290d3a]::fmt::write
   2:     0x71158e61183c - <std[75d981f13140cbe0]::sys::stdio::unix::Stderr as core[ab2f8d7ac3290d3a]::io::write::Write>::write_fmt
   3:     0x71158e5cdd8a - std[75d981f13140cbe0]::panicking::default_hook::{closure#0}
   4:     0x71158e5f05e3 - std[75d981f13140cbe0]::panicking::default_hook
   5:     0x71158d36e761 - std[75d981f13140cbe0]::panicking::update_hook::<alloc[6f8a4980a9e162d9]::boxed::Box<rustc_driver_impl[7cdb0ac5bbe8c2e5]::install_ice_hook::{
closure#1}>>::{closure#0}
   6:     0x71158e5f0a82 - std[75d981f13140cbe0]::panicking::panic_with_hook
   7:     0x71158e5cde74 - std[75d981f13140cbe0]::panicking::panic_handler::{closure#0}
   8:     0x71158e5c5279 - std[75d981f13140cbe0]::sys::backtrace::__rust_end_short_backtrace::<std[75d981f13140cbe0]::panicking::panic_handler::{closure#0}, !>
   9:     0x71158e5cfb9d - __rustc[8c8e3d3194b7583f]::rust_begin_unwind
  10:     0x71158af238fc - core[ab2f8d7ac3290d3a]::panicking::panic_fmt
  11:     0x71158d3a597c - <rustc_errors[33bfac024ca7560f]::DiagCtxtInner>::panic_if_treat_err_as_bug
  12:     0x7115901f27cc - <rustc_errors[33bfac024ca7560f]::DiagCtxtInner>::emit_diagnostic::{closure#3}
  13:     0x7115901f08b8 - rustc_interface[2cc45a980df577dc]::callbacks::track_diagnostic::<core[ab2f8d7ac3290d3a]::option::Option<rustc_span[e66a16c774821dd5]::ErrorG
uaranteed>>
  14:     0x7115901ef3fd - <rustc_errors[33bfac024ca7560f]::DiagCtxtInner>::emit_diagnostic
  15:     0x7115901ef2bb - <rustc_errors[33bfac024ca7560f]::DiagCtxtHandle>::emit_diagnostic
  16:     0x71159017d40c - <rustc_codegen_ssa[a279203ad243230d]::back::write::SharedEmitterMain>::check
  17:     0x7115901811ec - <rustc_codegen_llvm[ef331c4ece37739b]::back::llvm_backend::LlvmCodegenBackend as rustc_codegen_ssa[a279203ad243230d]::traits::backend::Codeg
enBackend>::join_codegen
  18:     0x711590182f2e - <rustc_interface[2cc45a980df577dc]::queries::Linker>::link
  19:     0x71158ff0189c - rustc_interface[2cc45a980df577dc]::interface::run_compiler::<(), rustc_driver_impl[7cdb0ac5bbe8c2e5]::compiler_entrypoint::{closure#0}>::{cl
osure#2}
  20:     0x71158ff82281 - std[75d981f13140cbe0]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2cc45a980df577dc]::util::run_in_thread_with_globals<ru
stc_interface[2cc45a980df577dc]::util::run_in_thread_pool_with_globals<rustc_interface[2cc45a980df577dc]::interface::run_compiler<(), rustc_driver_impl[7cdb0ac5bbe8c2e
5]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  21:     0x71158ff8202d - <std[75d981f13140cbe0]::thread::lifecycle::spawn_unchecked<rustc_interface[2cc45a980df577dc]::util::run_in_thread_with_globals<rustc_interfa
ce[2cc45a980df577dc]::util::run_in_thread_pool_with_globals<rustc_interface[2cc45a980df577dc]::interface::run_compiler<(), rustc_driver_impl[7cdb0ac5bbe8c2e5]::compile
r_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[ab2f8d7ac3290d3a]::ops::function::FnOnce<()>>::call_
once::{shim:vtable#0}
  22:     0x71158ff860ad - <std[75d981f13140cbe0]::sys::thread::unix::Thread>::new::thread_start
  23:     0x711588e9cb84 - start_thread
                               at ./nptl/pthread_create.c:447:8
  24:     0x711588f29ecc - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
  25:                0x0 - <unknown>

error: the compiler unexpectedly panicked. This is a bug

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/home/adagem01/work/stdarch/rustc-ice-2026-11-13T17_13_35-3596376.txt` to your bug report

note: rustc 1.102.0-nightly (8eb778d04 2026-11-12) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -Z treat-err-as-bug=1

query stack during panic:
end of query stack

Activity

  1. added theissue type on Nov 13, 2026
  2. added
    C-bug
    on Nov 13, 2026
  3. added
    needs-triage
    on Nov 13, 2026
  4. added
    regression-from-stable-to-nightly
    on Nov 13, 2026
  5. added
    I-prioritize
    on Nov 13, 2026
  6. added
    regression-from-stable-to-beta
    and removed
    regression-from-stable-to-nightly
    on Nov 13, 2026
  7. beetrees commented on Nov 13, 2026

    @beetrees
    Contributor

    All the compiler explorer links go to https://rust.godbolt.org/z/qrdbo1YPr, I'm guessing that's not intended?

  8. adamgemmell commented on Nov 13, 2026

    @adamgemmell
    ContributorAuthor

    Nope, not at all, links fixed!

  9. added
    A-codegen
    on Nov 13, 2026
  10. added
    requires-nightly
    and removed
    I-prioritize
    on Nov 22, 2026
  11. removed
    regression-from-stable-to-beta
    on Nov 24, 2026
  12. bardiharborow commented on Nov 28, 2026

    @bardiharborow
    Contributor

    @rustbot label +A-LLVM +I-llvm-error +O-x86_64 +S-has-bisection +S-has-mcve +T-compiler -needs-triage

  13. added
    A-LLVM
    I-llvm-error
    O-x86_64
    S-has-bisection
    S-has-mcve
    T-compiler
    and removed
    needs-triage
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMA-codegenC-bugI-llvm-errorO-x86_64S-has-bisectionS-has-mcveT-compilerrequires-nightly

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions