[all-commits] [llvm/llvm-project] 6001a8: [WholeProgramDevirt] Add check for AvailableExtern...

Tianle Liu via All-commits all-commits at lists.llvm.org
Thu Jun 19 17:01:54 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6001a8bb945762fd128f025bb8d7969d92096772
      https://github.com/llvm/llvm-project/commit/6001a8bb945762fd128f025bb8d7969d92096772
  Author: Tianle Liu <tianle.l.liu at intel.com>
  Date:   2025-06-20 (Fri, 20 Jun 2025)

  Changed paths:
    M llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
    A llvm/test/Transforms/WholeProgramDevirt/availableexternal-check.ll

  Log Message:
  -----------
  [WholeProgramDevirt] Add check for AvailableExternal and give up icall.branch.funnel (#143468)

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's GlobalTypeMember would not be
saved and finally leads to a NULL GlobalTypeMember which causes a crash.
Even saving the available_externally GO's GlobalTypeMember so that it is
not NULL to avoid the crash in LowerTypeTests, it still will crash in
SelectionDAGBuilder or Verifier, because operands linkage type
consistency
check of icall.branch.funnel can not pass.

So any one of available externally vtable would stop to generate
icall.branch.funnel.
This patch fixes FullLTO mode and split-LTO-unit ThinLTO mode.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list