summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
authorGreg Bedwell <greg_bedwell@sn.scee.net>2018-10-04 14:42:19 +0000
committerGreg Bedwell <greg_bedwell@sn.scee.net>2018-10-04 14:42:19 +0000
commitdee7bfdb9fb839973b9635530a270189bb7d94b3 (patch)
tree261c70e3aeed011eead58209d0c4f062e399a216 /llvm/utils
parenta4e0ab3a22c52754522c264b9885f75d1ebe698b (diff)
downloadbcm5719-llvm-dee7bfdb9fb839973b9635530a270189bb7d94b3.tar.gz
bcm5719-llvm-dee7bfdb9fb839973b9635530a270189bb7d94b3.zip
[utils] Ensure that update_mca_test_checks.py writes prefixes in alphabetical order
llvm-svn: 343783
Diffstat (limited to 'llvm/utils')
-rwxr-xr-xllvm/utils/update_mca_test_checks.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/utils/update_mca_test_checks.py b/llvm/utils/update_mca_test_checks.py
index c1f89e006fa..a83186cd336 100755
--- a/llvm/utils/update_mca_test_checks.py
+++ b/llvm/utils/update_mca_test_checks.py
@@ -502,18 +502,29 @@ def _write_output(test_path, input_lines, prefix_list, block_infos, # noqa
else:
# _break_down_block() was unable to do do anything so output the block
# as-is.
+
+ # Rather than writing out each block as soon we encounter it, save it
+ # indexed by prefix so that we can write all of the blocks out sorted by
+ # prefix at the end.
+ output_blocks = defaultdict(list)
+
for block_text in sorted(block_infos[block_num]):
+
if not block_text:
continue
lines = block_text.split('\n')
for prefix in block_infos[block_num][block_text]:
- used_prefixes |= _write_block(output_check_lines,
+ assert prefix not in output_blocks
+ used_prefixes |= _write_block(output_blocks[prefix],
[(prefix, line) for line in lines],
not_prefix_set,
common_prefix,
prefix_pad)
+ for prefix in sorted(output_blocks):
+ output_check_lines.extend(output_blocks[prefix])
+
unused_prefixes = (prefix_set - not_prefix_set) - used_prefixes
if unused_prefixes:
raise Error('unused prefixes: {}'.format(sorted(unused_prefixes)))
OpenPOWER on IntegriCloud