Change:
Crate bytecount compilation fails with latest nightly on NanoPC-T6 (RK3588 ARM / aarch64). It worked yesterday. I tried this code: Updating index Adding bytecount v0.6.7 to dependencies. Features: generic-simd htmlreport packedsimd runtime-dispatch-simd Updating index Compiling bytecount v0.6.7 Intrinsic has incorrect return type! ptr in function ZN4core9corearch10armshared4neon9generated11vld1qu8x417hd6e0965b4ff7ff22E LLVM ERROR: Broken function found, compilation aborted! error: could not compile (lib) Compiling bytecount v0.6.7 Compiling bytecounttest v0.1.0 (/home/pi/bytecounttest) Finished dev [unoptimized + debuginfo] target(s) in 0.90s Linux NanoPC-T6 5.10.160 SMP Thu Jul 20 15:53:55 CST 2023 aarch64 aarch64 aarch64 GNU/Linux PRETTYNAME="Ubuntu 22.04.3 LTS" NAME="Ubuntu" VERSIONID="22.04" VERSION="22.04.3 LTS (Jammy Jellyfish)" VERSIONCODENAME=jammy ID=ubuntu IDLIKE=debian HOMEURL="" SUPPORTURL="" BUGREPORTURL="" PRIVACYPOLICYURL="" UBUNTUCODENAME=jammy I expected to see this happen: Finished dev [unoptimized + debuginfo] target(s) in 1.32s Instead, this happened: LLVM ERROR: Broken function found, compilation aborted!
searched nightlies: from nightly-2023-11-19 to nightly-2023-11-20 regressed nightly: nightly-2023-11-20 searched commit range: regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.5</summaryHost triple: aarch64-unknown-linux-gnu Reproduce with: </detailslooks like something in that PR changed ABI behavior and now LLVM and rustc disagree. Don't know who's wrong.
Hm, I don't know how that "unadjusted" ABI stuff works...
should fix this. I am not sure how to add a test.
WG-prioritization assigning priority (). label -I-prioritize +P-high

Discussion:
} impl<'a, Ty> TyAndLayout<'a, Ty> { <ins> /// Returns `true` if this is an aggregate type (including a ScalarPair!) </ins> fn is_aggregate(&self) -> bool { match self.abi { Abi::Uninhabited | Abi::Scalar(_) | Abi::Vector { .. } => false,

} /// Ensure that the ABI makes basic sense. <del> fn fn_abi_sanity_check<'tcx>(cx: &LayoutCx<'tcx, TyCtxt<'tcx>>, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) { </del> <ins> fn fn_abi_sanity_check<'tcx>( cx: &LayoutCx<'tcx, TyCtxt<'tcx>>, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, spec_abi: SpecAbi, ) { </ins> fn fn_arg_sanity_check<'tcx>( cx: &LayoutCx<'tcx, TyCtxt<'tcx>>, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, <ins> spec_abi: SpecAbi, </ins> arg: &ArgAbi<'tcx, Ty<'tcx>>, ) { match &arg.mode {

// (See issue: https://github.com/rust-lang/rust/issues/117271) assert!( matches!(&*cx.tcx.sess.target.arch, "wasm32" | "wasm64") <del> || fn_abi.conv == Conv::PtxKernel, "`PassMode::Direct` for aggregates only allowed on wasm and `extern "ptx-kernel"` fnsnProblematic type: {:#?}", </del> <ins> || matches!(spec_abi, SpecAbi::PtxKernel | SpecAbi::Unadjusted), r#"`PassMode::Direct` for aggregates only allowed for "unadjusted" and "ptx-kernel" functions and on wasmnProblematic type: {:#?}"#, </ins> arg.layout, ); }

} for arg in fn_abi.args.iter() { <del> fn_arg_sanity_check(cx, fn_abi, arg); </del> <ins> fn_arg_sanity_check(cx, fn_abi, spec_abi, arg); </ins> } <del> fn_arg_sanity_check(cx, fn_abi, &fn_abi.ret); </del> <ins> fn_arg_sanity_check(cx, fn_abi, spec_abi, &fn_abi.ret); </ins> } // FIXME(eddyb) perhaps group the signature/type-containing (or all of them?)

}; fn_abi_adjust_for_abi(cx, &mut fn_abi, sig.abi, fn_def_id)?; debug!("fn_abi_new_uncached = {:?}", fn_abi); <del> fn_abi_sanity_check(cx, &fn_abi); </del> <ins> fn_abi_sanity_check(cx, &fn_abi, sig.abi); </ins> Ok(cx.tcx.arena.alloc(fn_abi)) }

fn_def_id: Option<DefId>, ) -> Result<(), &'tcx FnAbiError<'tcx>> { if abi == SpecAbi::Unadjusted { <ins> // The "unadjusted" ABI passes aggregates in "direct" mode. That's fragile but needed for // some LLVM intrinsics. fn unadjust<'tcx>(arg: &mut ArgAbi<'tcx, Ty<'tcx>>) { // This still uses `PassMode::Pair` for ScalarPair types. That's unlikely to be intended, // but who knows what breaks if we change this now. if matches!(arg.layout.abi, Abi::Aggregate { .. }) { assert!( arg.layout.abi.is_sized(), "'unadjusted' ABI does not support unsized arguments" ); } arg.make_direct_deprecated(); } unadjust(&mut fn_abi.ret); for arg in fn_abi.args.iter_mut() { unadjust(arg); } </ins> return Ok(()); }

<ins> // build-pass // revisions: arm //[arm] compile-flags: --target arm-unknown-linux-gnueabi //[arm] needs-llvm-components: arm // revisions: aarch64 //[aarch64] compile-flags: --target aarch64-unknown-linux-gnu //[aarch64] needs-llvm-components: aarch64 #![feature( no_core, lang_items, link_llvm_intrinsics, abi_unadjusted, repr_simd, arm_target_feature, )] #![no_std] #![no_core] #![crate_type = "lib"] #![allow(non_camel_case_types)] /// To work cross-target this test must be no_core. /// This little prelude supplies what we need. #[lang = "sized"] pub trait Sized {} #[lang = "copy"] pub trait Copy: Sized {} impl Copy for i8 {} impl<T: ?Sized> Copy for *const T {} impl<T: ?Sized> Copy for *mut T {} // Regression test for https://github.com/rust-lang/rust/issues/118124. #[repr(simd)] pub struct int8x16_t( pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, pub(crate) i8, ); impl Copy for int8x16_t {} #[repr(C)] pub struct int8x16x4_t(pub int8x16_t, pub int8x16_t, pub int8x16_t, pub int8x16_t); impl Copy for int8x16x4_t {} #[target_feature(enable = "neon")] #[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))] pub unsafe fn vld1q_s8_x4(a: *const i8) -> int8x16x4_t { #[allow(improper_ctypes)] extern "unadjusted" { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vld1x4.v16i8.p0i8")] #[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.ld1x4.v16i8.p0i8")] fn vld1q_s8_x4_(a: *const i8) -> int8x16x4_t; } vld1q_s8_x4_(a) } </ins>