Use custom wrap-around type instead of Range
This commit is contained in:
parent
7481e6d1a4
commit
5a501f73ff
12 changed files with 255 additions and 116 deletions
|
@ -462,7 +462,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
load: &'ll Value,
|
||||
scalar: &abi::Scalar,
|
||||
) {
|
||||
let vr = scalar.valid_range.clone();
|
||||
let vr = scalar.valid_range;
|
||||
match scalar.value {
|
||||
abi::Int(..) => {
|
||||
let range = scalar.valid_range_exclusive(bx);
|
||||
|
@ -470,7 +470,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
bx.range_metadata(load, range);
|
||||
}
|
||||
}
|
||||
abi::Pointer if vr.start() < vr.end() && !vr.contains(&0) => {
|
||||
abi::Pointer if vr.start < vr.end && !vr.contains(0) => {
|
||||
bx.nonnull_metadata(load);
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
@ -16,7 +16,9 @@ use rustc_middle::mir::interpret::{
|
|||
use rustc_middle::mir::mono::MonoItem;
|
||||
use rustc_middle::ty::{self, Instance, Ty};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_target::abi::{AddressSpace, Align, HasDataLayout, LayoutOf, Primitive, Scalar, Size};
|
||||
use rustc_target::abi::{
|
||||
AddressSpace, Align, AllocationRange, HasDataLayout, LayoutOf, Primitive, Scalar, Size,
|
||||
};
|
||||
use tracing::debug;
|
||||
|
||||
pub fn const_alloc_to_llvm(cx: &CodegenCx<'ll, '_>, alloc: &Allocation) -> &'ll Value {
|
||||
|
@ -59,7 +61,10 @@ pub fn const_alloc_to_llvm(cx: &CodegenCx<'ll, '_>, alloc: &Allocation) -> &'ll
|
|||
Pointer::new(alloc_id, Size::from_bytes(ptr_offset)),
|
||||
&cx.tcx,
|
||||
),
|
||||
&Scalar { value: Primitive::Pointer, valid_range: 0..=!0 },
|
||||
&Scalar {
|
||||
value: Primitive::Pointer,
|
||||
valid_range: AllocationRange { start: 0, end: !0 },
|
||||
},
|
||||
cx.type_i8p_ext(address_space),
|
||||
));
|
||||
next_offset = offset + pointer_size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue