[PATCH] D48105: [llvm][Instrumentation] Add Call Graph Profile pass
    Michael Spencer via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Jun 12 16:03:13 PDT 2018
    
    
  
Bigcheese created this revision.
Bigcheese added reviewers: mehdi_amini, tejohnson, ruiu, compnerd, pcc.
Herald added a reviewer: espindola.
This patch adds support for generating a call graph profile from Branch Frequency Info.
Generating the CG Profile
-------------------------
The CGProfile module pass simply gets the block profile count for each BB and scans for call instructions.  For each call instruction it adds an edge from the current function to the called function with the current BB block profile count as the weight.
After scanning all the functions, it generates an appending module flag containing the data. The format looks like:
  !llvm.module.flags = !{!0} 
   
  !0 = !{i32 5, !"CG Profile", !1} 
  !1 = !{!2, !3, !4} ; List of edges
  !2 = !{!"a", !"b", i64 32} ; Edge from a to b with a weight of 32
  !3 = !{!"freq", !"a", i64 11} 
  !4 = !{!"freq", !"b", i64 20} 
Repository:
  rL LLVM
https://reviews.llvm.org/D48105
Files:
  include/llvm/InitializePasses.h
  include/llvm/LinkAllPasses.h
  include/llvm/Transforms/Instrumentation.h
  lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/Instrumentation/CGProfile.cpp
  lib/Transforms/Instrumentation/CMakeLists.txt
  lib/Transforms/Instrumentation/Instrumentation.cpp
  test/Instrumentation/cgprofile.ll
  test/MC/ELF/cgprofile.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48105.151059.patch
Type: text/x-patch
Size: 10732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180612/7d27e2ae/attachment.bin>
    
    
More information about the llvm-commits
mailing list