We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Why can't the compiler hoist branch out of the loop in the following code?
use std::hint::black_box; use hashbrown::HashMap; pub fn main() { let mut map: HashMap<u32, u32> = hashbrown::HashMap::default(); map.insert(0, 0); for i in 0..10000 { if let Some(_) = map.get(&0) { continue; } else { black_box(i); } } }
online assembly https://rust.godbolt.org/z/vr3WGsfhP
The text was updated successfully, but these errors were encountered:
This happens because hashbrown::raw::RawTable<T,A>::find is not inlined and therefore LLVM doesn't know that it is a pure function.
hashbrown::raw::RawTable<T,A>::find
Sorry, something went wrong.
Thanks for your reply. but I checked the code and it seems that RawTable::find has been marked as inline, and there are no extra call in the assembly
RawTable::find
No branches or pull requests
Objectives
Why can't the compiler hoist branch out of the loop in the following code?
online assembly https://rust.godbolt.org/z/vr3WGsfhP
The text was updated successfully, but these errors were encountered: