[llvm] r293263 - [opt-viewer] Make sorting for the index page deterministic

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 22:39:03 PST 2017


Author: anemet
Date: Fri Jan 27 00:39:02 2017
New Revision: 293263

URL: http://llvm.org/viewvc/llvm-project?rev=293263&view=rev
Log:
[opt-viewer] Make sorting for the index page deterministic

Break the tie between entries with identical hotness deterministically.

Modified:
    llvm/trunk/utils/opt-viewer/opt-viewer.py

Modified: llvm/trunk/utils/opt-viewer/opt-viewer.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/opt-viewer/opt-viewer.py?rev=293263&r1=293262&r2=293263&view=diff
==============================================================================
--- llvm/trunk/utils/opt-viewer/opt-viewer.py (original)
+++ llvm/trunk/utils/opt-viewer/opt-viewer.py Fri Jan 27 00:39:02 2017
@@ -365,9 +365,9 @@ def generate_report(pool, all_remarks, f
     pool.map(_render_file_bound, file_remarks.items())
 
     if Remark.should_display_hotness():
-        sorted_remarks = sorted(all_remarks.itervalues(), key=lambda r: r.Hotness, reverse=True)
+        sorted_remarks = sorted(all_remarks.itervalues(), key=lambda r: (r.Hotness, r.__dict__), reverse=True)
     else:
-        sorted_remarks = sorted(all_remarks.itervalues(), key=lambda r: (r.File, r.Line, r.Column))
+        sorted_remarks = sorted(all_remarks.itervalues(), key=lambda r: (r.File, r.Line, r.Column, r.__dict__))
     IndexRenderer(args.output_dir).render(sorted_remarks)
 
     shutil.copy(os.path.join(os.path.dirname(os.path.realpath(__file__)),




More information about the llvm-commits mailing list