Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intrinsic has incorrect return type. LLVM ERROR: Broken function found, compilation aborted. aarch64 / ARM / nightly #118124

Closed
spital opened this issue Nov 21, 2023 · 4 comments · Fixed by #118127
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. O-AArch64 Armv8-A or later processors in AArch64 mode P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@spital
Copy link

spital commented Nov 21, 2023

Crate bytecount compilation fails with latest nightly on NanoPC-T6 (RK3588 ARM / aarch64).
It worked yesterday.

I tried this code:

cargo new bytecount_test && cd bytecount_test

cargo add bytecount
Updating crates.io index
  Adding bytecount v0.6.7 to dependencies.
         Features:
         - generic-simd
         - html_report
         - packed_simd
         - runtime-dispatch-simd
Updating crates.io index
cargo  +nightly-2023-11-20 build

Compiling bytecount v0.6.7
Intrinsic has incorrect return type!
ptr @llvm.aarch64.neon.ld1x4.v16i8.p0i8
in function _ZN4core9core_arch10arm_shared4neon9generated11vld1q_u8_x417hd6e0965b4ff7ff22E
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile bytecount (lib)

cargo  +nightly-2023-11-19 build

Compiling bytecount v0.6.7
Compiling bytecount_test v0.1.0 (/home/pi/bytecount_test)
Finished dev [unoptimized + debuginfo] target(s) in 0.90s

uname -a

Linux NanoPC-T6 5.10.160 #7 SMP Thu Jul 20 15:53:55 CST 2023 aarch64 aarch64 aarch64 GNU/Linux

cat /etc/os-release

PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=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!

@spital spital added the C-bug Category: This is a bug. label Nov 21, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 21, 2023
@Nilstrieb Nilstrieb added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc O-AArch64 Armv8-A or later processors in AArch64 mode and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Nov 21, 2023
@nikic nikic added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Nov 21, 2023
@Nilstrieb
Copy link
Member

searched nightlies: from nightly-2023-11-19 to nightly-2023-11-20
regressed nightly: nightly-2023-11-20
searched commit range: 4cb3bee...9a66e44
regressed commit: d19980e

bisected with cargo-bisect-rustc v0.6.5

Host triple: aarch64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start 2023-11-19 --access github --end 2023-11-20 --regress error

looks like something in that PR changed ABI behavior and now LLVM and rustc disagree. Don't know who's wrong. @RalfJung @davidtwco

@Nilstrieb Nilstrieb added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Nov 21, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Nov 21, 2023
@RalfJung
Copy link
Member

RalfJung commented Nov 21, 2023

Hm, I don't know how that "unadjusted" ABI stuff works...

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)
}

@RalfJung
Copy link
Member

#118127 should fix this. I am not sure how to add a test.

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Nov 23, 2023
@bors bors closed this as completed in 16087ee Nov 25, 2023
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Nov 27, 2023
the unadjusted ABI needs to pass aggregates by-value

Fixes rust-lang/rust#118124, a regression introduced in rust-lang/rust#117500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. O-AArch64 Armv8-A or later processors in AArch64 mode P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants