Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 6b54b7c

Browse files
committed
Remove sign extension for ty::Int from CValue::const_val
1 parent 648b634 commit 6b54b7c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/value_and_place.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,13 @@ impl<'tcx> CValue<'tcx> {
217217
.iconst(types::I64, (const_val >> 64) as u64 as i64);
218218
fx.bcx.ins().iconcat(lsb, msb)
219219
}
220-
ty::Bool | ty::Char | ty::Uint(_) | ty::Ref(..)
220+
ty::Bool | ty::Char | ty::Uint(_) | ty::Int(_) | ty::Ref(..)
221221
| ty::RawPtr(..) => {
222222
fx
223223
.bcx
224224
.ins()
225225
.iconst(clif_ty, u64::try_from(const_val).expect("uint") as i64)
226226
}
227-
ty::Int(_) => {
228-
let const_val = rustc_middle::mir::interpret::sign_extend(const_val, layout.size);
229-
fx.bcx.ins().iconst(clif_ty, i64::try_from(const_val as i128).unwrap())
230-
}
231227
ty::Float(FloatTy::F32) => {
232228
fx.bcx.ins().f32const(Ieee32::with_bits(u32::try_from(const_val).unwrap()))
233229
}

0 commit comments

Comments
 (0)