Emit trunc nuw for unchecked shifts and to_immediate_scalar
- For shifts this shrinks the IR by no longer needing an `assume` while still providing the UB information - Having this on the `i8`→`i1` truncations will hopefully help with some places that have to load `i8`s or pass those in LLVM structs without range information
This commit is contained in:
@@ -340,6 +340,17 @@ pub trait BuilderMethods<'a, 'tcx>:
|
||||
}
|
||||
|
||||
fn trunc(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value;
|
||||
/// Produces the same value as [`Self::trunc`] (and defaults to that),
|
||||
/// but is UB unless the *zero*-extending the result can reproduce `val`.
|
||||
fn unchecked_utrunc(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value {
|
||||
self.trunc(val, dest_ty)
|
||||
}
|
||||
/// Produces the same value as [`Self::trunc`] (and defaults to that),
|
||||
/// but is UB unless the *sign*-extending the result can reproduce `val`.
|
||||
fn unchecked_strunc(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value {
|
||||
self.trunc(val, dest_ty)
|
||||
}
|
||||
|
||||
fn sext(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value;
|
||||
fn fptoui_sat(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value;
|
||||
fn fptosi_sat(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value;
|
||||
|
||||
Reference in New Issue
Block a user