Merge commit 'ba315abda789c9f59f2100102232bddb30b0d3d3' into sync_cg_clif-2025-03-30
This commit is contained in:
@@ -71,7 +71,7 @@ fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Typ
|
||||
},
|
||||
ty::FnPtr(..) => pointer_ty(tcx),
|
||||
ty::RawPtr(pointee_ty, _) | ty::Ref(_, pointee_ty, _) => {
|
||||
if has_ptr_meta(tcx, *pointee_ty) {
|
||||
if tcx.type_has_metadata(*pointee_ty, ty::TypingEnv::fully_monomorphized()) {
|
||||
return None;
|
||||
} else {
|
||||
pointer_ty(tcx)
|
||||
@@ -91,7 +91,7 @@ fn clif_pair_type_from_ty<'tcx>(
|
||||
(clif_type_from_ty(tcx, types[0])?, clif_type_from_ty(tcx, types[1])?)
|
||||
}
|
||||
ty::RawPtr(pointee_ty, _) | ty::Ref(_, pointee_ty, _) => {
|
||||
if has_ptr_meta(tcx, *pointee_ty) {
|
||||
if tcx.type_has_metadata(*pointee_ty, ty::TypingEnv::fully_monomorphized()) {
|
||||
(pointer_ty(tcx), pointer_ty(tcx))
|
||||
} else {
|
||||
return None;
|
||||
@@ -101,20 +101,6 @@ fn clif_pair_type_from_ty<'tcx>(
|
||||
})
|
||||
}
|
||||
|
||||
/// Is a pointer to this type a wide ptr?
|
||||
pub(crate) fn has_ptr_meta<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
if ty.is_sized(tcx, ty::TypingEnv::fully_monomorphized()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let tail = tcx.struct_tail_for_codegen(ty, ty::TypingEnv::fully_monomorphized());
|
||||
match tail.kind() {
|
||||
ty::Foreign(..) => false,
|
||||
ty::Str | ty::Slice(..) | ty::Dynamic(..) => true,
|
||||
_ => bug!("unexpected unsized tail: {:?}", tail),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn codegen_icmp_imm(
|
||||
fx: &mut FunctionCx<'_, '_, '_>,
|
||||
intcc: IntCC,
|
||||
|
||||
Reference in New Issue
Block a user