Do not intern too large aggregates.

This commit is contained in:
Camille GILLOT 2023-09-23 14:55:28 +00:00
parent 38c86b0798
commit db9bd9bd8c

View File

@ -291,6 +291,9 @@ fn eval_to_const(&mut self, value: VnIndex) -> Option<OpTy<'tcx>> {
.collect::<Option<Vec<_>>>()?;
let variant = if ty.is_enum() { Some(variant) } else { None };
let ty = self.ecx.layout_of(ty).ok()?;
if ty.is_zst() {
ImmTy::uninit(ty).into()
} else if matches!(ty.abi, Abi::Scalar(..) | Abi::ScalarPair(..)) {
let alloc_id = self
.ecx
.intern_with_temp_alloc(ty, |ecx, dest| {
@ -309,6 +312,9 @@ fn eval_to_const(&mut self, value: VnIndex) -> Option<OpTy<'tcx>> {
let mplace =
self.ecx.raw_const_to_mplace(ConstAlloc { alloc_id, ty: ty.ty }).ok()?;
mplace.into()
} else {
return None;
}
}
Projection(base, elem) => {