llvm-project
49e7f33c - [llvm][LowerTypeTests] Drop MD_vcall_visibility with typetests (#241597)

Commit
1 day ago
[llvm][LowerTypeTests] Drop MD_vcall_visibility with typetests (#241597) When compiling FatLTO objects with -fvirtual-function-elimination, FatLTOCleanup removes llvm.type.checked.load intrinsics after embedding the pre-link bitcode section. Because FatLTOCleanup lowered llvm.type.checked.load without removing !vcall_visibility metadata, and DropTypeTestsPass only erased the metadata if type test or checked load intrinsics were still present in the module. Because of this, vtables retained !vcall_visibility during non-LTO compilation. When GlobalDCE ran later in the pipeline, it saw !vcall_visibility with no remaining llvm.type.checked.load calls and incorrectly zeroed out live virtual function slots in the native object. This patch updates cleanUpTypeCheckedLoad and dropTypeTests to erase !vcall_visibility metadata whenever checked loads or all type tests are dropped. This keeps the behavior uniform for both FatLTO and existing usage of the LowerTypeTestsPass Fixes #240258 Assited-by: Gemini
Author
Parents
Loading