about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2024-07-26 19:36:21 +0100
committerAmanieu d'Antras <amanieu@gmail.com>2024-07-28 17:24:57 +0100
commit4f78f9fbb05145d437540181fda9bcc83d5a53e4 (patch)
tree0d7f49f2f98393f8afcf6d2342b3bacc433a0aca /compiler/rustc_codegen_llvm/src/llvm/ffi.rs
parent355efacf0d430331c962a38af39049b76bb6266b (diff)
downloadrust-4f78f9fbb05145d437540181fda9bcc83d5a53e4.tar.gz
rust-4f78f9fbb05145d437540181fda9bcc83d5a53e4.zip
Force LLVM to use CMOV for binary search
Since https://reviews.llvm.org/D118118, LLVM will no longer turn CMOVs
into branches if it comes from a `select` marked with an `unpredictable`
metadata attribute.

This PR introduces `core::intrinsics::select_unpredictable` which emits
such a `select` and uses it in the implementation of `binary_search_by`.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/ffi.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/ffi.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
index 3beda28ac1f..1e2b0292d36 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
@@ -428,6 +428,7 @@ pub enum MetadataType {
     MD_nontemporal = 9,
     MD_mem_parallel_loop_access = 10,
     MD_nonnull = 11,
+    MD_unpredictable = 15,
     MD_align = 17,
     MD_type = 19,
     MD_vcall_visibility = 28,