From 088e03fe224e4e7adf3fe1c3d5365a699418b7d9 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 30 Jun 2022 08:16:05 +0000 Subject: [PATCH] Lower the assume intrinsic to a MIR statement --- src/base.rs | 2 ++ src/constant.rs | 1 + src/intrinsics/mod.rs | 3 --- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/base.rs b/src/base.rs index c412e451a03..1f49ead93a3 100644 --- a/src/base.rs +++ b/src/base.rs @@ -791,6 +791,8 @@ fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool { | StatementKind::Nop | StatementKind::FakeRead(..) | StatementKind::Retag { .. } + // We ignore `assume` intrinsics, they are only useful for optimizations + | StatementKind::Assume(..) | StatementKind::AscribeUserType(..) => {} StatementKind::Coverage { .. } => fx.tcx.sess.fatal("-Zcoverage is unimplemented"), diff --git a/src/constant.rs b/src/constant.rs index 9224f499339..f75de9096f3 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -540,6 +540,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>( return None; } // conservative handling StatementKind::Assign(_) + | StatementKind::Assume(_) | StatementKind::FakeRead(_) | StatementKind::SetDiscriminant { .. } | StatementKind::Deinit(_) diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index 39e9e784a47..0cd9332a58b 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -357,9 +357,6 @@ fn codegen_regular_intrinsic_call<'tcx>( let usize_layout = fx.layout_of(fx.tcx.types.usize); match intrinsic { - sym::assume => { - intrinsic_args!(fx, args => (_a); intrinsic); - } sym::likely | sym::unlikely => { intrinsic_args!(fx, args => (a); intrinsic);