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.
This commit is contained in:
parent
a567209daa
commit
9ad6839f7a
7 changed files with 81 additions and 44 deletions
|
@ -665,6 +665,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
|||
a + b
|
||||
}
|
||||
|
||||
// TODO(antoyo): should we also override the `unchecked_` versions?
|
||||
fn sub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
|
||||
self.gcc_sub(a, b)
|
||||
}
|
||||
|
@ -832,31 +833,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
|||
set_rvalue_location(self, self.gcc_not(a))
|
||||
}
|
||||
|
||||
fn unchecked_sadd(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
|
||||
set_rvalue_location(self, self.gcc_add(a, b))
|
||||
}
|
||||
|
||||
fn unchecked_uadd(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
|
||||
set_rvalue_location(self, self.gcc_add(a, b))
|
||||
}
|
||||
|
||||
fn unchecked_ssub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
|
||||
set_rvalue_location(self, self.gcc_sub(a, b))
|
||||
}
|
||||
|
||||
fn unchecked_usub(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
|
||||
// TODO(antoyo): should generate poison value?
|
||||
set_rvalue_location(self, self.gcc_sub(a, b))
|
||||
}
|
||||
|
||||
fn unchecked_smul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
|
||||
set_rvalue_location(self, self.gcc_mul(a, b))
|
||||
}
|
||||
|
||||
fn unchecked_umul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
|
||||
set_rvalue_location(self, self.gcc_mul(a, b))
|
||||
}
|
||||
|
||||
fn fadd_fast(&mut self, lhs: RValue<'gcc>, rhs: RValue<'gcc>) -> RValue<'gcc> {
|
||||
// NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
|
||||
set_rvalue_location(self, lhs + rhs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue