Auto merge of #123781 - RalfJung:miri-fn-identity, r=oli-obk
Miri function identity hack: account for possible inlining Having a non-lifetime generic is not the only reason a function can be duplicated. Another possibility is that the function may be eligible for cross-crate inlining. So also take into account the inlining attribute in this Miri hack for function pointer identity. That said, `cross_crate_inlinable` will still sometimes return true even for `inline(never)` functions: - when they are `DefKind::Ctor(..) | DefKind::Closure` -- I assume those cannot be `InlineAttr::Never` anyway? - when `cross_crate_inline_threshold == InliningThreshold::Always` so maybe this is still not quite the right criterion to use for function pointer identity.
This commit is contained in:
commit
489233170a
14 changed files with 80 additions and 47 deletions
|
@ -1160,10 +1160,10 @@ fn collect_alloc<'tcx>(tcx: TyCtxt<'tcx>, alloc_id: AllocId, output: &mut MonoIt
|
|||
});
|
||||
}
|
||||
}
|
||||
GlobalAlloc::Function(fn_instance) => {
|
||||
if should_codegen_locally(tcx, fn_instance) {
|
||||
trace!("collecting {:?} with {:#?}", alloc_id, fn_instance);
|
||||
output.push(create_fn_mono_item(tcx, fn_instance, DUMMY_SP));
|
||||
GlobalAlloc::Function { instance, .. } => {
|
||||
if should_codegen_locally(tcx, instance) {
|
||||
trace!("collecting {:?} with {:#?}", alloc_id, instance);
|
||||
output.push(create_fn_mono_item(tcx, instance, DUMMY_SP));
|
||||
}
|
||||
}
|
||||
GlobalAlloc::VTable(ty, trait_ref) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue