[PATCH] D144209: [ThinLTO/WPD] Handle function alias in vtable correctly

Mingming Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 16 12:46:50 PST 2023


mingmingl accepted this revision.
mingmingl added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:380-381
 // conditions
 //   1) All summaries are live.
 //   2) All function summaries indicate it's unreachable
 bool mustBeUnreachableFunction(ValueInfo TheFnVI) {
----------------



================
Comment at: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:398-400
+    // Be conservative if a non-function has the same GUID (which is rare).
+    else
+      return false;
----------------
For my understanding, is this conservative change orthogonal with function aliases in vtable (since `auto *FS = dyn_cast<FunctionSummary>(Summary->getBaseObject())` should be true for an alias)?


================
Comment at: llvm/test/ThinLTO/X86/devirt_function_alias.ll:26
+; RUN:   -r=%t1.o,_ZN1B1mEi,px \
+; RUN:   2>&1 | FileCheck %s --implicit-check-not evirtualized --allow-empty
+; RUN: llvm-dis %t2.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR
----------------



================
Comment at: llvm/test/ThinLTO/X86/devirt_function_alias.ll:47
+; RUN:   -r=%t3.o,_ZN1B1mEi, \
+; RUN:   2>&1 | FileCheck %s --implicit-check-not evirtualized --allow-empty
+; RUN: llvm-dis %t4.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR
----------------



================
Comment at: llvm/test/ThinLTO/X86/devirt_function_alias.ll:62
+; RUN:   -r=%t5.o,_ZN1B1mEi,px \
+; RUN:   2>&1 | FileCheck %s --implicit-check-not evirtualized --allow-empty
+; RUN: llvm-dis %t6.0.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144209/new/

https://reviews.llvm.org/D144209



More information about the llvm-commits mailing list