From 09fd9087b6ee5245e5b87fdb2dd48e7770c41fd6 Mon Sep 17 00:00:00 2001 From: tempdragon <645703113@qq.com> Date: Wed, 28 Feb 2024 11:37:49 +0800 Subject: [PATCH] fix(code fmt): builder.rs & base.rs --- src/base.rs | 4 ++-- src/builder.rs | 17 +++-------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/base.rs b/src/base.rs index bcf467839a4..773e234150d 100644 --- a/src/base.rs +++ b/src/base.rs @@ -184,8 +184,8 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol, target_info: Lock // wrapper here maybe_create_entry_wrapper::>(&cx); - // FINALIZE debuginfo - if cx.sess().opts.debuginfo != DebugInfo::None { + // Finalize debuginfo + if cx.sess().opts.debuginfo != DebugInfo::None { cx.debuginfo_finalize(); } } diff --git a/src/builder.rs b/src/builder.rs index 663e42aaf85..87b5b04af13 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -70,7 +70,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { cx, block, stack_var_count: Cell::new(0), - loc:None + loc: None } } @@ -541,12 +541,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { } fn fmul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { - let i=a * b; - if self.loc.is_some() { - #[cfg(feature = "master")] - i.set_location(self.loc.clone().unwrap()); - } - i + self.cx.context.new_binary_op(self.loc, BinaryOp::Mult, a.get_type(), a, b) } fn udiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { @@ -660,13 +655,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { } fn or(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { - let ret = self.cx.gcc_or(a, b, self.loc); - - if self.loc.is_some() { - #[cfg(feature = "master")] - ret.set_location(self.loc.unwrap()); - } - ret + self.cx.gcc_or(a, b, self.loc) } fn xor(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {