Skip to content

Commit a380380

Browse files
committed
Add the optimization in a few other methods
1 parent 575d46c commit a380380

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/builder.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -725,15 +725,15 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
725725
}
726726

727727
fn fdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
728-
a / b
728+
self.assign_to_var(a / b)
729729
}
730730

731731
fn urem(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
732-
self.gcc_urem(a, b)
732+
self.assign_to_var(self.gcc_urem(a, b))
733733
}
734734

735735
fn srem(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
736-
self.gcc_srem(a, b)
736+
self.assign_to_var(self.gcc_srem(a, b))
737737
}
738738

739739
fn frem(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
@@ -829,17 +829,20 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
829829
}
830830

831831
fn shl(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
832-
self.gcc_shl(a, b)
832+
let result = self.gcc_shl(a, b);
833+
self.assign_to_var(result)
833834
}
834835

835836
fn lshr(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
836-
self.gcc_lshr(a, b)
837+
let result = self.gcc_lshr(a, b);
838+
self.assign_to_var(result)
837839
}
838840

839841
fn ashr(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
840842
// TODO(antoyo): check whether behavior is an arithmetic shift for >> .
841843
// It seems to be if the value is signed.
842-
self.gcc_lshr(a, b)
844+
let result = self.gcc_lshr(a, b);
845+
self.assign_to_var(result)
843846
}
844847

845848
fn and(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {

0 commit comments

Comments
 (0)