Rollup merge of #130734 - Luv-Ray:fix_vfe, r=lcnr

Fix: ices on virtual-function-elimination about principal trait

Extract `load_vtable` function to ensure the `virtual_function_elimination` option is always checked.
It's okay not to use `llvm.type.checked.load` to load the vtable if there is no principal trait.

Fixes #123955
Fixes #124092
This commit is contained in:
Matthias Krüger
2024-09-25 10:09:23 +02:00
committed by GitHub
7 changed files with 61 additions and 51 deletions

View File

@@ -126,7 +126,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
sym::vtable_align => ty::COMMON_VTABLE_ENTRIES_ALIGN,
_ => bug!(),
};
let value = meth::VirtualIndex::from_index(idx).get_usize(bx, vtable);
let value = meth::VirtualIndex::from_index(idx).get_usize(bx, vtable, callee_ty);
match name {
// Size is always <= isize::MAX.
sym::vtable_size => {