[PATCH] D41297: [ThinLTO] Implement summary visualizer

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 15 09:43:32 PST 2017


evgeny777 added a comment.

Thanks for looking at it!
Currently I'm annotating graph in the following way

1. I use this shell command to generate file containing GUIDs and their identifiers from bitcode files:

`find ./ -iname '*.o' | xargs llvm-modextract -n=0 -o - | llvm-lto -thin-lto -print-summary-global-ids - >& hashnames.txt`

2. Use this python script (annotate.py) to annotate dot file (`cat hashnames.txt | python annotate.py my.index.dot > annotated.dot`)

  import sys
  import re
  
  pat = re.compile(r'GUID [0-9]+\(([0-9]+)\) is (.*)')
  pairs = []
  
  for line in sys.stdin:
      m = pat.match(line)
      if m:
          pairs += [(m.group(1), m.group(2))]
  
  with open(sys.argv[1]) as f:
      for line in f:
          l2 = line
          for p in pairs:
              l2 = line.replace("@" + str(p[0]), p[1])
              if l2 != line: break
          sys.stdout.write(l2)



3. Make graph png image using graphviz:

`dot -Tpng -oannotate.png annotate.dot`


https://reviews.llvm.org/D41297





More information about the llvm-commits mailing list