Skip to content

Commit 5e0f1f6

Browse files
committed
Auto merge of #136575 - scottmcm:nsuw-math, r=nikic
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](https://github.com/llvm/llvm-project/blob/f0b8ff12519270adcfef93410abff76ab073476a/llvm/include/llvm-c/Core.h#L4403-L4408), we might as well. And it's been there since what looks like LLVM 17 llvm/llvm-project@de9b6aa so doesn't even need to be conditional. (There's other places, like `RawVecInner` or `Layout`, that might want to do things like this too, but I'll leave those for a future PR.)
2 parents fd526a2 + 5e0c773 commit 5e0f1f6

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)