summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/mir
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-09-10 09:50:21 +0000
committerbors <bors@rust-lang.org>2022-09-10 09:50:21 +0000
commit5197c96c49fc3b7de3ce9a31f7cc62d2cbd1f70c (patch)
treef0dbcfb3f47bd0bf298f4804f50cd954dc781c5a /compiler/rustc_codegen_ssa/src/mir
parentdb9d86b58dff2a19d84d5e557641dfbb4cbb3a8d (diff)
parentf632dbe46fb0041c786450f7a3c37a1a5b7208a9 (diff)
downloadrust-5197c96c49fc3b7de3ce9a31f7cc62d2cbd1f70c.tar.gz
rust-5197c96c49fc3b7de3ce9a31f7cc62d2cbd1f70c.zip
Auto merge of #101483 - oli-obk:guaranteed_opt, r=fee1-dead
The `<*const T>::guaranteed_*` methods now return an option for the unknown case

cc https://github.com/rust-lang/rust/issues/53020#issuecomment-1236932443

I chose `0` for "not equal" and `1` for "equal" and left `2` for the unknown case so backends can just forward to raw pointer equality and it works ✨

r? `@fee1-dead` or `@lcnr`

cc `@rust-lang/wg-const-eval`
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/mir')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/intrinsic.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
index 6393dd9d634..215edbe02c0 100644
--- a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
@@ -551,14 +551,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                 return;
             }
 
-            sym::ptr_guaranteed_eq | sym::ptr_guaranteed_ne => {
+            sym::ptr_guaranteed_cmp => {
                 let a = args[0].immediate();
                 let b = args[1].immediate();
-                if name == sym::ptr_guaranteed_eq {
-                    bx.icmp(IntPredicate::IntEQ, a, b)
-                } else {
-                    bx.icmp(IntPredicate::IntNE, a, b)
-                }
+                bx.icmp(IntPredicate::IntEQ, a, b)
             }
 
             sym::ptr_offset_from | sym::ptr_offset_from_unsigned => {