about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/builder.rs
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2025-02-10 20:28:39 +0900
committerGitHub <noreply@github.com>2025-02-10 20:28:39 +0900
commit67ba6a6acfd886f1c175e0f5a64a3d2228ac143f (patch)
tree2d6f32e88ad42b1ced7529c15488473bfe8b2abd /compiler/rustc_codegen_llvm/src/builder.rs
parentcf15b33e3b8c6a2b1e629af9ae253bf7e4b18799 (diff)
parent81f21f0cce8be1e4dd1c8f4b9c6d0434029a13be (diff)
downloadrust-67ba6a6acfd886f1c175e0f5a64a3d2228ac143f.tar.gz
rust-67ba6a6acfd886f1c175e0f5a64a3d2228ac143f.zip
Merge pull request #2244 from rust-lang/rustc-pull
Rustc pull update
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/builder.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/builder.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs
index 2d007416263..264d43c6d46 100644
--- a/compiler/rustc_codegen_llvm/src/builder.rs
+++ b/compiler/rustc_codegen_llvm/src/builder.rs
@@ -421,6 +421,20 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
         unchecked_umul(x, y) => LLVMBuildNUWMul,
     }
 
+    fn or_disjoint(&mut self, a: &'ll Value, b: &'ll Value) -> &'ll Value {
+        unsafe {
+            let or = llvm::LLVMBuildOr(self.llbuilder, a, b, UNNAMED);
+
+            // If a and b are both values, then `or` is a value, rather than
+            // an instruction, so we need to check before setting the flag.
+            // (See also `LLVMBuildNUWNeg` which also needs a check.)
+            if llvm::LLVMIsAInstruction(or).is_some() {
+                llvm::LLVMSetIsDisjoint(or, True);
+            }
+            or
+        }
+    }
+
     set_math_builder_methods! {
         fadd_fast(x, y) => (LLVMBuildFAdd, LLVMRustSetFastMath),
         fsub_fast(x, y) => (LLVMBuildFSub, LLVMRustSetFastMath),