[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 09:19:06 PDT 2017


modocache planned changes to this revision.
modocache added inline comments.


================
Comment at: utils/opt-viewer/opt-viewer.py:193-195
+        sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.Hotness, r.File, r.Line, r.Column), reverse=True)
     else:
+        sorted_remarks = sorted(optrecord.itervalues(all_remarks), key=lambda r: (r.File, r.Line, r.Column))
----------------
anemet wrote:
> The idea for sticking r.__dict__ at the end was to have a deterministic index page.  This allows diffing the before and after html directories to make sure a change is in fact NFC.
> 
> Is __dict__ no longer available in Python3?
> 
`dict` is still available in Python 3, but it doesn't have a built-in sort order (that is, it no longer implements `__cmp__`). For details, see: https://stackoverflow.com/a/22334235/679254.

In any case, sorry about that, I'll take another look. Maybe instead of comparing the dict representation of the remark, I could compare more of its comparable attributes?


https://reviews.llvm.org/D34647





More information about the llvm-commits mailing list