Skip to content

Commit 5e0c773

Browse files
committed
Set both nuw and nsw in slice size calculation
There's an old note in the code to do this, and now that LLVM-C has an API for it, we might as well.
1 parent 853ae3d commit 5e0c773

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

src/builder.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
665665
a + b
666666
}
667667

668+
// TODO(antoyo): should we also override the `unchecked_` versions?
668669
fn sub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
669670
self.gcc_sub(a, b)
670671
}
@@ -832,31 +833,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
832833
set_rvalue_location(self, self.gcc_not(a))
833834
}
834835

835-
fn unchecked_sadd(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
836-
set_rvalue_location(self, self.gcc_add(a, b))
837-
}
838-
839-
fn unchecked_uadd(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
840-
set_rvalue_location(self, self.gcc_add(a, b))
841-
}
842-
843-
fn unchecked_ssub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
844-
set_rvalue_location(self, self.gcc_sub(a, b))
845-
}
846-
847-
fn unchecked_usub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
848-
// TODO(antoyo): should generate poison value?
849-
set_rvalue_location(self, self.gcc_sub(a, b))
850-
}
851-
852-
fn unchecked_smul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
853-
set_rvalue_location(self, self.gcc_mul(a, b))
854-
}
855-
856-
fn unchecked_umul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
857-
set_rvalue_location(self, self.gcc_mul(a, b))
858-
}
859-
860836
fn fadd_fast(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
861837
// NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
862838
set_rvalue_location(self, lhs + rhs)

0 commit comments

Comments
 (0)