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 name not mangled correctly for type arguments #102738

Closed
Nugine opened this issue Oct 6, 2022 · 5 comments · Fixed by #103479
Closed

Intrinsic name not mangled correctly for type arguments #102738

Nugine opened this issue Oct 6, 2022 · 5 comments · Fixed by #103479
Assignees
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-SIMD Area: SIMD (Single Instruction Multiple Data) C-bug Category: This is a bug.

Comments

@Nugine
Copy link
Contributor

Nugine commented Oct 6, 2022

My project uses arm neon intrinsics. The arm test starts failing after 2022-10-04.

Reproduce:

git clone [email protected]:Nugine/simd.git
cd simd
cd crates/vsimd
export CARGO_INCREMENTAL=0
cross test --target armv7-unknown-linux-gnueabihf --no-default-features --features detect,unstable

https://github.com/Nugine/simd/actions/runs/3191907964/jobs/5214086504

+ cross test --target armv7-unknown-linux-gnueabihf --no-default-features --features detect,unstable
   Compiling vsimd v0.1.0-dev (/project/crates/vsimd)
Intrinsic name not mangled correctly for type arguments! Should be: llvm.arm.neon.vld1x2.v16i8.p0
ptr @llvm.arm.neon.vld1x2.v16i8.p0i8
in function _ZN4core9core_arch10arm_shared4neon9generated11vld1q_u8_x217hedb14b770e5be213E
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile `vsimd`
error: Recipe `arm-test` failed with exit code 101

rustc 1.66.0-nightly (57f097ea2 2022-10-01) works.

rustc 1.66.0-nightly (c97d02cdb 2022-10-05) works (incremental compilation enabled)
rustc 1.66.0-nightly (c97d02cdb 2022-10-05) fails (incremental compilation disabled)

I'm not sure how to find a MCVE for this issue, so I put the original context here.

Meta

rustc --version --verbose:

rustc 1.66.0-nightly (c97d02cdb 2022-10-05)
binary: rustc
commit-hash: c97d02cdb5ca5f5e9eff1fa9e4560d220d1fd2a0
commit-date: 2022-10-05
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.2
@Nugine Nugine added the C-bug Category: This is a bug. label Oct 6, 2022
Nugine referenced this issue in Nugine/simd Oct 6, 2022
@nikic
Copy link
Contributor

nikic commented Oct 6, 2022

Looks like stdarch hardcodes LLVM intrinsic mangling in a few places. These should be changed from p0i8 to just p0 in LLVM 15: https://github.com/rust-lang/stdarch/search?q=p0i8

Usually this gets gracefully handled through intrinsic remangling, I don't know why that doesn't occur for your particular case. Updating stdarch to directly use the right names should avoid any problems though.

cc @Amanieu

@nikic nikic added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-SIMD Area: SIMD (Single Instruction Multiple Data) labels Oct 6, 2022
@Amanieu
Copy link
Member

Amanieu commented Oct 13, 2022

@nikic Does this apply to all .p0* extensions or just .p0i8? For example llvm.aarch64.neon.ld4.v1f64.p0v1f64.

Amanieu added a commit to Amanieu/stdarch that referenced this issue Oct 13, 2022
LLVM 15 removes the pointer type from intrinsic suffixes, effectively
replacing `.p0i8` (and other similar types) with just `.p0`.

cc rust-lang/rust#102738
@nikic
Copy link
Contributor

nikic commented Oct 13, 2022

It applies to all .pN extensions.

@Amanieu
Copy link
Member

Amanieu commented Oct 20, 2022

Minimal reproduction on godbolt: https://rust.godbolt.org/z/v79M878Ye

@nikic Any idea why LLVM auto-upgrade isn't working in this case?

@nikic
Copy link
Contributor

nikic commented Oct 21, 2022

Thanks for the minimal reproducer. This turned out to be a simple typo, fixed in llvm/llvm-project@c893880. This was hidden when doing simple tests with opt because the IR parser was doing another redundant remangle (fixed in llvm/llvm-project@d25ef09 and llvm/llvm-project@befb731).

Backport request: llvm/llvm-project#58522

@nikic nikic self-assigned this Oct 24, 2022
@bors bors closed this as completed in 77e57db Oct 30, 2022
Aaron1011 pushed a commit to Aaron1011/rust that referenced this issue Jan 6, 2023
Update LLVM submodule

Merge upstream `release/15.x` branch.

Fixes rust-lang#102738.
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. A-SIMD Area: SIMD (Single Instruction Multiple Data) C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants