-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
ptr::read() is slower than directly dereferencing #73258
Comments
godbolt for the bad version here: https://rust.godbolt.org/z/CWboVo took me a second, but the panic is from the unwrap, suggesting that the discriminant range isn't propagated correctly |
This is presumably because the |
This matches my impression from skimming over |
LLVM-IR diff: https://rust.godbolt.org/z/vMex9ooxq Looks like the root cause is that - %_3 = load i8, ptr %v, align 1, !dbg !11, !range !13, !noundef !10
+ %tmp.0.copyload = load i8, ptr %v, align 1, !dbg !11 Will hopefully be fixed by #109035 |
compiles to
but replacing
*v
withv.read()
compiles to:
This came up from #71257
The text was updated successfully, but these errors were encountered: