Skip to content

Commit 2342362

Browse files
committed
Directly use from_immediate for handling bool
1 parent 707fa49 commit 2342362

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
@@ -534,9 +534,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
534534
};
535535

536536
if result.layout.ty.is_bool() {
537-
OperandRef::from_immediate_or_packed_pair(bx, llval, result.layout)
538-
.val
539-
.store(bx, result);
537+
let val = bx.from_immediate(llval);
538+
bx.store_to_place(val, result.val);
540539
} else if !result.layout.ty.is_unit() {
541540
bx.store_to_place(llval, result.val);
542541
}

0 commit comments

Comments
 (0)