[PATCH] D53470: [ELF] Don't warn on two legitimate cases when reading .llvm.call-graph-profile

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 22 13:58:38 PDT 2018


ruiu added inline comments.


================
Comment at: ELF/Driver.cpp:687-688
     for (const Elf_CGProfile_Impl<ELFT> &CGPE : Obj->CGProfile) {
-      const InputSectionBase *FromSB =
-          FindSection(&Obj->getSymbol(CGPE.cgp_from));
-      const InputSectionBase *ToSB = FindSection(&Obj->getSymbol(CGPE.cgp_to));
-      if (!FromSB || !ToSB)
+      auto *FromSymD = dyn_cast<Defined>(&Obj->getSymbol(CGPE.cgp_from));
+      auto *ToSymD = dyn_cast<Defined>(&Obj->getSymbol(CGPE.cgp_to));
+      if (!FromSymD || !ToSymD)
----------------
SymD -> Sym


================
Comment at: ELF/Driver.cpp:691
         continue;
-      Config->CallGraphProfile[{FromSB, ToSB}] += CGPE.cgp_weight;
+      auto *FromSB = dyn_cast_or_null<InputSectionBase>(FromSymD->Section);
+      auto *ToSB = dyn_cast_or_null<InputSectionBase>(ToSymD->Section);
----------------
SB -> Sec

by convention.


================
Comment at: ELF/Driver.cpp:693
+      auto *ToSB = dyn_cast_or_null<InputSectionBase>(ToSymD->Section);
+      if (!FromSB || FromSB->Repl->Live) {
+        warnUnorderableSymbol(FromSymD);
----------------
This needs a comment.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D53470





More information about the llvm-commits mailing list