[PATCH] D104080: [LLD][LLVM] CG Graph profile using relocations

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 23 13:09:07 PDT 2021


ayermolo marked an inline comment as done.
ayermolo added inline comments.


================
Comment at: lld/ELF/Driver.cpp:866
     auto *obj = cast<ObjFile<ELFT>>(file);
-
-    for (const Elf_CGProfile_Impl<ELFT> &cgpe : obj->cgProfile) {
-      auto *fromSym = dyn_cast<Defined>(&obj->getSymbol(cgpe.cgp_from));
-      auto *toSym = dyn_cast<Defined>(&obj->getSymbol(cgpe.cgp_to));
+    assert(obj->cgProfileRela.size() == obj->cgProfile.size() * 2 &&
+           "Number of relocations doesn't match Weights.");
----------------
MaskRay wrote:
> This can happen so assert is not appropriate. You can use `if (...) fatal`
What is general guideline for fatal vs assert in llvm? I looked at Coding Standard, and didn't see anything (might have missed it)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104080



More information about the llvm-commits mailing list