[llvm] [WholeProgramDevirt] Add check for AvailableExternal and give up icall.branch.funnel (PR #143468)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 18 08:15:04 PDT 2025
teresajohnson wrote:
> When a customer class inherits from a libc++ class, and is built with "-flto -fwhole-program-vtables -static-libstdc++ -Wl,-plugin-opt=-whole-program-visibility", the libc++ class's vtable is available_externally, meanwhile the customer class vtable is private. And both of them are !vcall_visibility == Linkage Unit. In this case, icall.branch.funnel might be generated.
>
> But the icall.branch.funnel would cause crash in LowerTypeTests because available_externally Global_Object is skipped to save and leads to a NULL GlobalTypeMember. Even walking around the crash in LowerTypeTests, it still crashes in SelectionDAGBuilder or VerifierPass, because they ask operands of icall.branch.funnel must be the same GlobalValue.
Not sure what "skipped to save" means - do you mean "is dropped" (e.g. by the ElimAvailExtern pass)?
"walking around" should be "working around"
"they ask operands ... must be" should be "they ask operands ... to be" (maybe "they expect operands ... to be" would be clearer)
>
> This patch only fix fullLTO mode.
I would think it would also fix split-LTO-unit ThinLTO mode (e.g. "-flto=thin -fsplit-lto-unit" which splits the module into ThinLTO and regular LTO sub modules - is that not the case?)
https://github.com/llvm/llvm-project/pull/143468
More information about the llvm-commits
mailing list