[PATCH] D25854: [lto] Kill undefined extern_weak declarations before opt

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 17:35:29 PDT 2016


mehdi_amini added inline comments.


================
Comment at: include/llvm/LTO/LTO.h:469
+
+  /// This symbol has no definition.
+  unsigned Undefined : 1;
----------------
Add that it is only valid for `extern_weak`


================
Comment at: lib/LTO/LTO.cpp:253
+  if (Res.Undefined && GV && GV->isDeclarationForLinker())
+    GlobalRes.Partition = GlobalResolution::Undefined;
+  else if (Res.VisibleToRegularObj || (GV && Used.count(GV)) ||
----------------
This logic isn't clear to me, mostly because it is testing redundant thing.
We should not allow `Res.Undefined` to be used with a non extern_weak, so I expect some error handling instead.



================
Comment at: lib/LTO/LTO.cpp:475
+
+      if (GV && GV->hasExternalWeakLinkage() &&
+          R.second.Partition == GlobalResolution::Undefined) {
----------------
Comment.


Repository:
  rL LLVM

https://reviews.llvm.org/D25854





More information about the llvm-commits mailing list