about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2024-07-26 23:35:48 +0100
committerAmanieu d'Antras <amanieu@gmail.com>2024-07-30 17:07:56 +0100
commitbb584882070f2f45b35f0af172069e7c00d63983 (patch)
treea1fed5b755f5f9e1b12e2cf0615f59cb1070539e /compiler/rustc_codegen_llvm/src
parent595316b4006932405a63862d8fe65f71a6356293 (diff)
downloadrust-bb584882070f2f45b35f0af172069e7c00d63983.tar.gz
rust-bb584882070f2f45b35f0af172069e7c00d63983.zip
Rewrite binary search implementation
This restores the original binary search implementation from #45333
which has the nice property of having a loop count that only depends on
the size of the slice. This, along with explicit conditional moves
from #128250, means that the entire binary search loop can be perfectly
predicted by the branch predictor.

Additionally, LLVM is able to unroll the loop when the slice length is
known at compile-time. This results in a very compact code sequence of
3-4 instructions per binary search step and zero branches.

Fixes #53823
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions