Skip to content

Commit 51911a7

Browse files
committed
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
1 parent 5e0f1f6 commit 51911a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
16941694

16951695
fn to_immediate_scalar(&mut self, val: Self::Value, scalar: abi::Scalar) -> Self::Value {
16961696
if scalar.is_bool() {
1697-
return self.trunc(val, self.cx().type_i1());
1697+
return self.unchecked_utrunc(val, self.cx().type_i1());
16981698
}
16991699
val
17001700
}

0 commit comments

Comments
 (0)