summaryrefslogtreecommitdiffstats
path: root/llvm/tools/opt-viewer/optrecord.py
Commit message (Collapse)AuthorAgeFilesLines
* Revert Autogenerate the shebang lines for tools/opt-viewerReid Kleckner2019-08-271-0/+345
| | | | | | | | | | This reverts r369486 (git commit 8d18384809957cc923752e10a86adab129e3df48) The opt-viewer tests don't pass after this change, and fixing them isn't trivial. opt-viewer.py imports optmap, which requires adjusting pythonpath, which is more work than I'm willing to do to fix forward. llvm-svn: 370095
* Autogenerate the shebang lines for tools/opt-viewerChris Bieneman2019-08-211-345/+0
| | | | | | | | | | | | | | | | | | | | | Summary: Since these files depend on the built python modules, they need to use the right python binary to run them. So use configure_file to set the right shebang line. Patch By: cbiesinger (Christian Biesinger) Reviewers: chandlerc, beanz, anemet Reviewed By: anemet Subscribers: compnerd, JDevlieghere, mgorny, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65983 llvm-svn: 369486
* [opt-viewer] Teach optrecord.py about !Failure tagsJessica Paquette2019-03-271-0/+2
| | | | | | | | | | | | | WarnMissedTransforms.cpp produces remarks that use !Failure tags. These weren't supported in optrecord.py, so if you encountered one in any of the tools, the tool would crash. Add them as a type of missed optimization. Differential Revision: https://reviews.llvm.org/D59895 llvm-svn: 357110
* [opt-viewer] Make filter_=None by default in get_remarks and gather_resultsJessica Paquette2019-03-271-4/+6
| | | | | | | | | | | | | Right now, if you try to use optdiff.py on any opt records, it will fail because its calls to gather_results weren't updated to support filtering. Since filters are supposed to be optional, this makes them None by default in get_remarks and in gather_results. This allows other tools that don't support filtering to still use the functions as is. Differential Revision: https://reviews.llvm.org/D59894 llvm-svn: 357106
* [opt-viewer] Add --filter option to select remarks for displaying.Florian Hahn2019-02-061-3/+11
| | | | | | | | | | | | | | | | | This allows limiting the displayed remarks to the ones with names matching the filter (regular) expression. Generating html pages for a larger project with optimization remarks can result in a huge HTML documents and using --filter allows to focus on a set of interesting remarks. Reviewers: hfinkel, anemet, thegameg, serge-sans-paille Reviewed By: anemet Differential Revision: https://reviews.llvm.org/D57827 llvm-svn: 353322
* Python compat - no explicit reference to Python versionSerge Guelton2019-01-031-1/+1
| | | | | | | | Update documentation and shebang. Differential Revision: https://reviews.llvm.org/D56252 llvm-svn: 350327
* opt-viewer: also find thinlto opt.yaml filesAdam Nemet2018-02-261-1/+1
| | | | llvm-svn: 326124
* [opt-viewer] Also demangle indirect-call promotion targetsAdam Nemet2017-12-201-1/+1
| | | | llvm-svn: 321206
* [opt-viewer] Support unicode characters in function namesAdam Nemet2017-12-141-2/+6
| | | | | | | | | | This is a Swift feature. The output stream for the index page and the source HTML page is utf-8 now. The next patch will add the HTML magic to properly render these characters in the browser. llvm-svn: 320725
* [opt-viewer] Suppress noisy Swift remarksAdam Nemet2017-12-061-0/+26
| | | | | | | | | Most likely, this is not how we want to handle this in the long term. This code should probably be in the Swift repo and somehow plugged into the opt-viewer. This is still however very experimental at this point so I don't want to over-engineer it at this point. llvm-svn: 319902
* Add opt-viewer testingAdam Nemet2017-11-291-14/+19
| | | | | | | | | | | | | | | | | | | | Detects whether we have the Python modules (pygments, yaml) required by opt-viewer and hooks this up to REQUIRES. This fixes https://bugs.llvm.org/show_bug.cgi?id=34129 (the lack of opt-viewer testing). It's also related to https://github.com/apple/swift/pull/12938 and the idea is to expose LLVM_HAVE_OPT_VIEWER_MODULES to the Swift cmake. Differential Revision: https://reviews.llvm.org/D40202 Fixes since the first commit: 1. Disable syntax highlighting as different versions of pygments generate different HTML 2. Use llvm-cxxfilt from the build llvm-svn: 319324
* Display relative hotness with two decimal digits after the decimal pointAdam Nemet2017-09-291-1/+1
| | | | | | | | | I've seen cases where tiny inlined functions have such a high execution count that most everything would show up with a relative of hotness of 0%. Since the inlined functions effectively disappear you need to tune in the lower range, thus we need more precision. llvm-svn: 314537
* Make find_opt_files varargAdam Nemet2017-09-291-1/+1
| | | | | | | This is slightly less verbose for the common case of a single build directory and more intuitive when using this API directly from the interpreter. llvm-svn: 314491
* [opt-viewer] Listify `dict_items` for Py3 indexingBrian Gesiak2017-08-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: In Python 2, calling `dict.items()` returns an indexable `list`, whereas on Python 3 it returns a set-like `dict_items` object, which cannot be indexed. Explicitly onvert the `dict_items` object so that it can be indexed when using Python 3. In combination with D36622, D36623, and D36624, this change allows `opt-viewer.py` to exit successfully when run with Python 3.4. Test Plan: Run `opt-viewer.py` using Python 3.4 and confirm it does not encounter a runtime error when when indexing into `dict.items()`. Reviewers: anemet Reviewed By: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36630 llvm-svn: 310810
* [opt-viewer] Use Python 3-compatible iteritemsBrian Gesiak2017-08-111-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: Replace a usage of a Python 2-specific `dict.iteritems()` with the Python 3-compatible definition provided at the top of the same file. Test Plan: Run `opt-viewer.py` using Python 3 and confirm it no longer encounters a runtime error when calling `dict.iteritems()`. Reviewers: anemet Reviewed By: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36623 llvm-svn: 310740
* [opt-viewer] Use Python 3-compatible `intern()`Brian Gesiak2017-08-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | Summary: In Python 2, `intern()` is a builtin function available to all programs. In Python 3, it was moved into the `sys` module, available as `sys.intern`. Import it such that, within `optrecord.py`, `intern()` is available whether run using Python 2 or 3. Test Plan: Run `opt-viewer.py` using Python 3, confirm it no longer encounters a runtime error when `intern()` is called. Reviewers: anemet Reviewed By: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36622 llvm-svn: 310739
* [opt-viewer] Reduce memory consumption by another 20-25%Adam Nemet2017-07-191-17/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | The Args field of the remark which consists of a list of mappings in YAML is translated into a list of (small) dicts on Python. An empty dict is 280 bytes on my system so we can save memory by using a tuple of tuples instead. Making a tuple of tuples rather than a list of tuples allows Args to be shared with the key of the remark. This is actually an even greater saving. (Keys are alive throughout the entire run in all_remarks.) Here are a few opt-stats runs with different input sizes while measuring heap usage with heapy. Avg remark size is simply estimated as heap-size / # of remarks: | # of files | 60 | 114 | 308 | 605 | 1370 | | # of remarks | 20K | 37K | 146K | 180K | 640K | | total file size (MB) | 22 | 51 | 219 | 202 | 1034 | |------------------------+------+------+------+------+------| | Avg remark size before | 4339 | 4792 | 4761 | 4096 | 4607 | | Avg remark size after | 3446 | 3641 | 3567 | 3146 | 3347 | | Rate | 0.79 | 0.76 | 0.75 | 0.77 | 0.73 | Differential Revision: https://reviews.llvm.org/D35611 llvm-svn: 308538
* [opt-viewer] Reduce memory consumptionAdam Nemet2017-07-191-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | The observation is that we have a lot of similar remarks with lots of identical strings (e.g. file paths, text from the remark). Storing a copy of each of those strings in memory is wasteful. This makes all the strings in the remark interned which maintains a single immutable instance that is referenced everywhere. I get an average 20% heap size reduction with this but it's possible that this varies with the typical length of the file paths used. (I used heapy to report the heap size.) Runtime is same or a tiny bit better. | # of files | 60 | 114 | 308 | 605 | 1370 | | # of remarks | 20K | 37K | 146K | 180K | 640K | | total file size (MB) | 22 | 51 | 219 | 202 | 1034 | |-----------------------+------+------+------+------+------| | Heap size before (MB) | 106 | 226 | 894 | 934 | 3573 | | Heap size after | 86 | 179 | 694 | 739 | 2798 | | Rate | 0.81 | 0.79 | 0.78 | 0.79 | 0.78 | |-----------------------+------+------+------+------+------| | Average remark size | 4.30 | 4.84 | 4.75 | 4.11 | 4.37 | | Mem2disk ratio | 3.91 | 3.51 | 3.17 | 3.66 | 2.71 | Differential Revision: https://reviews.llvm.org/D35534 llvm-svn: 308536
* [opt-viewer] Handle file names that contain '#'Brian Gesiak2017-07-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: When using opt-viewer.py with files with '#' in their name, such as 'foo#bar.cpp', opt-viewer.py would generate links such as '/path/to/foo#bar.cpp.opt.yaml#L42'. In this case, the link is interpreted by browsers as a link to the file '/path/to/foo', and to the section within that file with ID 'bar.cpp.opt.yaml#L42'. To work around this issue, replace '#' with '_' in file names and links in opt-viewer.py. Reviewers: anemet, davidxl Reviewed By: davidxl Subscribers: llvm-commits, fhahn Differential Revision: https://reviews.llvm.org/D34646 llvm-svn: 308346
* [opt-viewer] Accept directories that are searched for opt.yaml filesAdam Nemet2017-07-171-0/+18
| | | | | | | | | | | | This allows to pass the build directory where all the opt.yaml files are rather than find | xargs which may invoke opt-viewer multiple times producing incomplete html output. The patch generalizes the same functionality from opt-diff. Differential Revision: https://reviews.llvm.org/D35491 llvm-svn: 308200
* [opt-viewer] Move under tools, install itAdam Nemet2017-07-061-0/+235
We weren't installing opt-viewer and co before, this fixes the omission. I am also moving the tools from utils/ to tools/. I believe that this is more appropriate since these tools have matured greatly in the past year through contributions by multiple people (thanks!) so they are ready to become external tools. The tools are installed under <install>/share/opt-viewer/. I am *not* adding the llvm- prefix. If people feel strongly about adding that, this is probably a good time since the new location will require some mental adjustment anyway. Fixes PR33521 Differential Revision: https://reviews.llvm.org/D35048 llvm-svn: 307285
OpenPOWER on IntegriCloud