Skip to content

Commit 284bec5

Browse files
committed
Directly use from_immediate for handling bool
1 parent 0fcea3d commit 284bec5

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,13 +498,10 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
498498
};
499499

500500
if result.layout.ty.is_bool() {
501-
OperandRef::from_immediate_or_packed_pair(self, value, result.layout)
502-
.val
503-
.store(self, result);
501+
let val = self.from_immediate(value);
502+
self.store_to_place(val, result.val);
504503
} else if !result.layout.ty.is_unit() {
505-
let ptr_llty = self.type_ptr_to(result.layout.gcc_type(self));
506-
let ptr = self.pointercast(result.val.llval, ptr_llty);
507-
self.store(value, ptr, result.val.align);
504+
self.store_to_place(value, result.val);
508505
}
509506
Ok(())
510507
}

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,8 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
610610
};
611611

612612
if result.layout.ty.is_bool() {
613-
OperandRef::from_immediate_or_packed_pair(self, llval, result.layout)
614-
.val
615-
.store(self, result);
613+
let val = self.from_immediate(llval);
614+
self.store_to_place(val, result.val);
616615
} else if !result.layout.ty.is_unit() {
617616
self.store_to_place(llval, result.val);
618617
}

compiler/rustc_codegen_ssa/src/mir/intrinsic.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
9191

9292
let ret_llval = |bx: &mut Bx, llval| {
9393
if result.layout.ty.is_bool() {
94-
OperandRef::from_immediate_or_packed_pair(bx, llval, result.layout)
95-
.val
96-
.store(bx, result);
94+
let val = bx.from_immediate(llval);
95+
bx.store_to_place(val, result.val);
9796
} else if !result.layout.ty.is_unit() {
9897
bx.store_to_place(llval, result.val);
9998
}

0 commit comments

Comments
 (0)