Skip to content

LLVM crashes when using prefetch_read_instruction #111823

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

Closed
Voultapher opened this issue May 21, 2023 · 4 comments · Fixed by #112312
Closed

LLVM crashes when using prefetch_read_instruction #111823

Voultapher opened this issue May 21, 2023 · 4 comments · Fixed by #112312
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Voultapher
Copy link
Contributor

Voultapher commented May 21, 2023

Code

#![feature(core_intrinsics)]

pub fn x(data: *const u64) {
    unsafe {
        core::intrinsics::prefetch_read_instruction(data, 3);
    }
}

Meta=

rustc --version --verbose:

rustc 1.71.0-nightly (521f4dae1 2023-05-19)
binary: rustc
commit-hash: 521f4dae1bdf7fe9cf9436ecef9ee7c7442708bf
commit-date: 2023-05-19
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.4
Compiler returned: 0

Error output

LLVM ERROR: Cannot select: 0x7f3d820ff1c0: ch = Prefetch<(load (s8) from %ir.0)> 0x7f3d8207c460, 0x7f3d820ff070, Constant:i32<0>, Constant:i32<3>, Constant:i32<0>, example.rs:5:9
  0x7f3d820ff070: i64,ch = CopyFromReg 0x7f3d8207c460, Register:i64 %1, example.rs:5:9
    0x7f3d820ff000: i64 = Register %1
  0x7f3d820ff0e0: i32 = Constant<0>
  0x7f3d820ff150: i32 = Constant<3>
  0x7f3d820ff0e0: i32 = Constant<0>
In function: _ZN7example1x17h72659061d1989aabE
Compiler returned: 101
@Voultapher Voultapher added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 21, 2023
@Sp00ph
Copy link
Member

Sp00ph commented May 21, 2023

Note that this doesn't seem to be rustc's fault: https://llvm.godbolt.org/z/8KPcn46r1 , so an LLVM issue would probably also be good. Interestingly, it compiles just fine on aarch64, and it also compiles on x86 when you change the third argument of the LLVM intrinsic from 0 (icache) to 1 (dcache).

@Voultapher
Copy link
Contributor Author

I've submitted it to LLVM. Much nicer now that they use GitHub instead of bugzilla.

@Noratrieb
Copy link
Member

@rustbot assign @nikic
Assigning it for closing the issue on the next LLVM upgrade that includes the patch.

@matthiaskrgr
Copy link
Member

Seems similar to tests/codegen/intrinsics/prefetch.rs which also causes llvm errors by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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.

5 participants