[PATCH] D69452: [ThinLTO/WPD] Fix index-based WPD for available_externally vtables

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 26 09:11:42 PDT 2019


evgeny777 added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:846
+    // linkonce/weak ODR, or all but one must be available_externally.
     assert(P.VTableVI.getSummaryList().size() == 1 ||
+           llvm::count_if(
----------------
The code below doesn't go well along with the comment. For example it allows having multiple linkonce_odr/weak_odr summaries and multiple ones with available_externally linkage. 


================
Comment at: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:856
+               }) <= 1);
     const auto *VS = cast<GlobalVarSummary>(P.VTableVI.getSummaryList()[0].get());
+    // If there is more than one summary, and the first isn't some kind of weak
----------------
Can we use single find_if instead of lines 856-871 for the sake of simplicity?
```
auto I = llvm::find_if(
          P.VTableVI.getSummaryList(),
          [&](const std::unique_ptr<GlobalValueSummary> &Summary) {
            return !GlobalValue::isAvailableExternallyLinkage(Summary->linkage());
          });
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69452





More information about the llvm-commits mailing list