[PATCH] D79379: Don't add function to import list if it's defined in the same module

Xun Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 17:14:01 PDT 2020


lxfind updated this revision to Diff 261967.
lxfind added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79379

Files:
  llvm/include/llvm/ProfileData/SampleProf.h
  llvm/test/Transforms/SampleProfile/function_metadata.ll


Index: llvm/test/Transforms/SampleProfile/function_metadata.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/function_metadata.ll
+++ llvm/test/Transforms/SampleProfile/function_metadata.ll
@@ -36,7 +36,7 @@
 ; Check GUIDs for both foo and foo_available are included in the metadata to
 ; make sure the liveness analysis can capture the dependency from test_liveness
 ; to foo_available.
-; CHECK: ![[ENTRY_TEST_LIVENESS]] = !{!"function_entry_count", i64 1, i64 4005816710939881937, i64 6699318081062747564}
+; CHECK: ![[ENTRY_TEST_LIVENESS]] = !{!"function_entry_count", i64 1, i64 6699318081062747564}
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!8, !9}
Index: llvm/include/llvm/ProfileData/SampleProf.h
===================================================================
--- llvm/include/llvm/ProfileData/SampleProf.h
+++ llvm/include/llvm/ProfileData/SampleProf.h
@@ -527,7 +527,11 @@
                             uint64_t Threshold) const {
     if (TotalSamples <= Threshold)
       return;
-    S.insert(getGUID(Name));
+    auto *F = M->getFunction(getFuncName());
+    if (!F || !F->getSubprogram()) {
+      // Add to the import list only when it's defined out of module.
+      S.insert(getGUID(Name));
+    }
     // Import hot CallTargets, which may not be available in IR because full
     // profile annotation cannot be done until backend compilation in ThinLTO.
     for (const auto &BS : BodySamples)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79379.261967.patch
Type: text/x-patch
Size: 1485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200505/406705d8/attachment-0001.bin>


More information about the llvm-commits mailing list