Between opt-level=1 and opt-level=2, LLVM deoptimizes the output of ptr::addr, if it ptr::addr is #[inline] #103285
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
P-medium
Medium priority
regression-from-stable-to-beta
Performance or correctness regression from stable to beta.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
godbolt demo: https://godbolt.org/z/51o3hYjvv
This code:
At
opt-level=2
compiles to this:Decreasing to
opt-level=1
or removing the#[inline]
on the transmute wrapper function causes the panic path to go away.As far as I can tell, this doesn't happen on stable but it happens on beta and nightly. This code pattern is used in the standard library here:
rust/library/core/src/intrinsics.rs
Lines 2234 to 2238 in cb94675
@rustbot label +A-LLVM +regression-from-stable-to-beta
The text was updated successfully, but these errors were encountered: