Compute unsizing casts in GVN.
This commit is contained in:
parent
1f544ca0cc
commit
304b4ad8b9
7 changed files with 33 additions and 21 deletions
|
@ -551,6 +551,16 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
|
|||
}
|
||||
value.offset(Size::ZERO, to, &self.ecx).ok()?
|
||||
}
|
||||
CastKind::PointerCoercion(ty::adjustment::PointerCoercion::Unsize) => {
|
||||
let src = self.evaluated[value].as_ref()?;
|
||||
let to = self.ecx.layout_of(to).ok()?;
|
||||
let dest = self.ecx.allocate(to, MemoryKind::Stack).ok()?;
|
||||
self.ecx.unsize_into(src, to, &dest.clone().into()).ok()?;
|
||||
self.ecx
|
||||
.alloc_mark_immutable(dest.ptr().provenance.unwrap().alloc_id())
|
||||
.ok()?;
|
||||
dest.into()
|
||||
}
|
||||
_ => return None,
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue