diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2020-06-23 00:33:54 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-23 00:33:54 -0700 |
| commit | ae38698e7fca180d612dc11be12023076e23236c (patch) | |
| tree | 0d6facabc6acf33196c2d87b81ff79035deffc32 /src/librustc_codegen_llvm | |
| parent | 903823c59bcb9890df2a6fadcf7aa22f74eed67f (diff) | |
| parent | e465b227d15fec8f16863ba8e77191ceb5c8670b (diff) | |
| download | rust-ae38698e7fca180d612dc11be12023076e23236c.tar.gz rust-ae38698e7fca180d612dc11be12023076e23236c.zip | |
Rollup merge of #73398 - oli-obk:const_raw_ptr_cmp, r=varkor,RalfJung,nagisa
A way forward for pointer equality in const eval r? @varkor on the first commit and @RalfJung on the second commit cc #53020
Diffstat (limited to 'src/librustc_codegen_llvm')
| -rw-r--r-- | src/librustc_codegen_llvm/intrinsic.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 95465939070..0a8525f06fa 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -12,7 +12,7 @@ use log::debug; use rustc_ast::ast; use rustc_codegen_ssa::base::{compare_simd_types, to_immediate, wants_msvc_seh}; use rustc_codegen_ssa::common::span_invalid_monomorphization_error; -use rustc_codegen_ssa::common::TypeKind; +use rustc_codegen_ssa::common::{IntPredicate, TypeKind}; use rustc_codegen_ssa::glue; use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue}; use rustc_codegen_ssa::mir::place::PlaceRef; @@ -731,6 +731,16 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { return; } + "ptr_guaranteed_eq" | "ptr_guaranteed_ne" => { + let a = args[0].immediate(); + let b = args[1].immediate(); + if name == "ptr_guaranteed_eq" { + self.icmp(IntPredicate::IntEQ, a, b) + } else { + self.icmp(IntPredicate::IntNE, a, b) + } + } + "ptr_offset_from" => { let ty = substs.type_at(0); let pointee_size = self.size_of(ty); |
