[PATCH] D34647: [opt-viewer] Python 3 support in opt-viewer.py

Brian Gesiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 11:45:39 PDT 2017


modocache updated this revision to Diff 104710.
modocache added a comment.

Yes, good catch. Use function name instead of demangled function name.


https://reviews.llvm.org/D34647

Files:
  utils/opt-viewer/opt-viewer.py
  utils/opt-viewer/optrecord.py


Index: utils/opt-viewer/optrecord.py
===================================================================
--- utils/opt-viewer/optrecord.py
+++ utils/opt-viewer/optrecord.py
@@ -42,8 +42,9 @@
 
 def demangle(name):
     with p_lock:
-        p.stdin.write(name + '\n')
-        return p.stdout.readline().rstrip()
+        p.stdin.write((name + '\n').encode('utf-8'))
+        p.stdin.flush()
+        return p.stdout.readline().rstrip().decode('utf-8')
 
 
 def html_file_name(filename):
Index: utils/opt-viewer/opt-viewer.py
===================================================================
--- utils/opt-viewer/opt-viewer.py
+++ utils/opt-viewer/opt-viewer.py
@@ -169,7 +169,7 @@
 def map_remarks(all_remarks):
     # Set up a map between function names and their source location for
     # function where inlining happened
-    for remark in all_remarks.itervalues():
+    for remark in optrecord.itervalues(all_remarks):
         if isinstance(remark, optrecord.Passed) and remark.Pass == "inline" and remark.Name == "Inlined":
             for arg in remark.Args:
                 caller = arg.get('Caller')
@@ -190,9 +190,9 @@
     pmap(_render_file_bound, file_remarks.items())
 
     if should_display_hotness:
-        sorted_remarks = sorted(all_remarks.itervalues(), key=lambda r: (r.Hotness, r.File, r.Line, r.Column, r.__dict__), reverse=True)
+        sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.Hotness, r.File, r.Line, r.Column, r.PassWithDiffPrefix, r.yaml_tag, r.Function), reverse=True)
     else:
-        sorted_remarks = sorted(all_remarks.itervalues(), key=lambda r: (r.File, r.Line, r.Column, r.__dict__))
+        sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.File, r.Line, r.Column, r.PassWithDiffPrefix, r.yaml_tag, r.Function))
     IndexRenderer(args.output_dir).render(sorted_remarks)
 
     shutil.copy(os.path.join(os.path.dirname(os.path.realpath(__file__)),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34647.104710.patch
Type: text/x-patch
Size: 1956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170629/68b66056/attachment.bin>


More information about the llvm-commits mailing list