summaryrefslogtreecommitdiff
path: root/utils/perf-training
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@quarkslab.com>2018-12-18 16:04:21 +0000
committerSerge Guelton <sguelton@quarkslab.com>2018-12-18 16:04:21 +0000
commitbd8d3419e1b6a1c7ec82e1ceb1f22b407a38dac9 (patch)
tree560bc893dd4d59a78b0bc277418faeb97299917c /utils/perf-training
parent38ed7e5d7917d18c9c7af9c49c5d83a112c6222a (diff)
downloadclang-bd8d3419e1b6a1c7ec82e1ceb1f22b407a38dac9.tar.gz
Portable Python script across Python version
In Python3, dict.items, dict.keys, dict.values, zip, map and filter no longer return lists, they create generator instead. The portability patch consists in forcing an extra `list` call if the result is actually used as a list. `map` are replaced by list comprehension and `filter` by filtered list comprehension. Differential Revision: https://reviews.llvm.org/D55197 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/perf-training')
-rw-r--r--utils/perf-training/perf-helper.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/utils/perf-training/perf-helper.py b/utils/perf-training/perf-helper.py
index 30b9caeffd..6337a9b19a 100644
--- a/utils/perf-training/perf-helper.py
+++ b/utils/perf-training/perf-helper.py
@@ -295,8 +295,8 @@ def form_by_frequency(symbol_lists):
for a in symbols:
counts[a] = counts.get(a,0) + 1
- by_count = counts.items()
- by_count.sort(key = lambda (_,n): -n)
+ by_count = list(counts.items())
+ by_count.sort(key = lambda __n: -__n[1])
return [s for s,n in by_count]
def form_by_random(symbol_lists):
@@ -333,7 +333,7 @@ def genOrderFile(args):
help="write a list of the unordered symbols to PATH (requires --binary)",
default=None, metavar="PATH")
parser.add_argument("--method", dest="method",
- help="order file generation method to use", choices=methods.keys(),
+ help="order file generation method to use", choices=list(methods.keys()),
default='call_order')
opts = parser.parse_args(args)