From 400866b7ab74cb9a4e705e0c4536a8b8130eb59e Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sun, 14 May 2023 22:29:26 -0700 Subject: Also assume wrap-around discriminants in `as` MIR building Resolves this FIXME: https://github.com/rust-lang/rust/blob/8d18c32b61476ed16dd15074e71be3970368d6d7/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs#L231 --- tests/codegen/option-nonzero-eq.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'tests/codegen') diff --git a/tests/codegen/option-nonzero-eq.rs b/tests/codegen/option-nonzero-eq.rs index 835decd3e5f..a394695f3bd 100644 --- a/tests/codegen/option-nonzero-eq.rs +++ b/tests/codegen/option-nonzero-eq.rs @@ -7,6 +7,9 @@ use core::cmp::Ordering; use core::num::{NonZeroU32, NonZeroI64}; use core::ptr::NonNull; +// See also tests/assembly/option-nonzero-eq.rs, for cases with `assume`s in the +// LLVM and thus don't optimize down clearly here, but do in assembly. + // CHECK-lABEL: @non_zero_eq #[no_mangle] pub fn non_zero_eq(l: Option, r: Option) -> bool { @@ -33,12 +36,3 @@ pub fn non_null_eq(l: Option>, r: Option>) -> bool { // CHECK-NEXT: ret i1 l == r } - -// CHECK-lABEL: @ordering_eq -#[no_mangle] -pub fn ordering_eq(l: Option, r: Option) -> bool { - // CHECK: start: - // CHECK-NEXT: icmp eq i8 - // CHECK-NEXT: ret i1 - l == r -} -- cgit 1.4.1-3-g733a5