Skip to content

Commit da65b93

Browse files
committed
Add the optimization in a few other methods
1 parent 3545bfb commit da65b93

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/builder.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,18 +855,21 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
855855
}
856856

857857
fn neg(&mut self, a: RValue<'gcc>) -> RValue<'gcc> {
858-
set_rvalue_location(self, self.gcc_neg(a))
858+
let result = set_rvalue_location(self, self.gcc_neg(a));
859+
self.assign_to_var(result)
859860
}
860861

861862
fn fneg(&mut self, a: RValue<'gcc>) -> RValue<'gcc> {
862-
set_rvalue_location(
863+
let result = set_rvalue_location(
863864
self,
864865
self.cx.context.new_unary_op(self.location, UnaryOp::Minus, a.get_type(), a),
865-
)
866+
);
867+
self.assign_to_var(result)
866868
}
867869

868870
fn not(&mut self, a: RValue<'gcc>) -> RValue<'gcc> {
869-
set_rvalue_location(self, self.gcc_not(a))
871+
let result = set_rvalue_location(self, self.gcc_not(a));
872+
self.assign_to_var(result)
870873
}
871874

872875
fn fadd_fast(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {

0 commit comments

Comments
 (0)