[PATCH] D112655: [CGProfile] Don't emit call graph profile edges with zero weight

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 28 08:33:01 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG793b481f54f8: [CGProfile] Don't emit call graph profile edges with zero weight (authored by lgrey, committed by thakis).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112655

Files:
  llvm/lib/Transforms/Instrumentation/CGProfile.cpp
  llvm/test/Instrumentation/cgprofile.ll


Index: llvm/test/Instrumentation/cgprofile.ll
===================================================================
--- llvm/test/Instrumentation/cgprofile.ll
+++ llvm/test/Instrumentation/cgprofile.ll
@@ -14,6 +14,7 @@
 declare i32 @func3()
 declare i32 @func4()
 declare dllimport i32 @func5()
+declare i32 @func6()
 
 define void @freq(i1 %cond) !prof !1 {
   %tmp = load i32 ()*, i32 ()** @foo, align 8
@@ -29,7 +30,7 @@
 
 !1 = !{!"function_entry_count", i64 32}
 !2 = !{!"branch_weights", i32 5, i32 10}
-!3 = !{!"VP", i32 0, i64 1600, i64 7651369219802541373, i64 1030, i64 -4377547752858689819, i64 410, i64 -6929281286627296573, i64 150, i64 -2545542355363006406, i64 10, i64 3667884930908592509, i64 0}
+!3 = !{!"VP", i32 0, i64 1600, i64 7651369219802541373, i64 1030, i64 -4377547752858689819, i64 410, i64 -6929281286627296573, i64 150, i64 -2545542355363006406, i64 10, i64 3667884930908592509, i64 1, i64 15435711456043681792, i64 0}
 
 ; CHECK: !llvm.module.flags = !{![[cgprof:[0-9]+]]}
 ; CHECK: ![[cgprof]] = !{i32 5, !"CG Profile", ![[prof:[0-9]+]]}
@@ -41,4 +42,5 @@
 ; CHECK: ![[e4]] = !{void (i1)* @freq, i32 ()* @func1, i64 10}
 ; CHECK: ![[e5]] = !{void (i1)* @freq, void ()* @a, i64 11}
 ; CHECK: ![[e6]] = !{void (i1)* @freq, void ()* @b, i64 21}
-; CHECK-NOT: !{void (i1)* @freq, void ()* @func5, i64 0}
\ No newline at end of file
+; CHECK-NOT: !{void (i1)* @freq, void ()* @func5, i64 1}
+; CHECK-NOT: !{void (i1)* @freq, void ()* @func6, i64 0}
Index: llvm/lib/Transforms/Instrumentation/CGProfile.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/CGProfile.cpp
+++ llvm/lib/Transforms/Instrumentation/CGProfile.cpp
@@ -53,6 +53,8 @@
   InstrProfSymtab Symtab;
   auto UpdateCounts = [&](TargetTransformInfo &TTI, Function *F,
                           Function *CalledF, uint64_t NewCount) {
+    if (NewCount == 0)
+      return;
     if (!CalledF || !TTI.isLoweredToCall(CalledF) ||
         CalledF->hasDLLImportStorageClass())
       return;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112655.383044.patch
Type: text/x-patch
Size: 2039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211028/7f4b0a52/attachment.bin>


More information about the llvm-commits mailing list