From 1a33cdb2e245dcfdde147aa2089dc1e862d9e0e5 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Wed, 18 Oct 2017 15:37:09 +0000 Subject: [PATCH] update_mir_test_checks: Do a better job of disambiguating names Matching prefixes isn't good enough, because it leads to things like calling the first constant C3 just because there were two copies before it. Tighten up the check to match more precisely, but also be careful about ambiguity when dealing with target opcodes that end in a number. llvm-svn: 316088 --- llvm/utils/update_mir_test_checks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llvm/utils/update_mir_test_checks.py b/llvm/utils/update_mir_test_checks.py index 48f3eea..7b91974 100755 --- a/llvm/utils/update_mir_test_checks.py +++ b/llvm/utils/update_mir_test_checks.py @@ -266,10 +266,13 @@ def mangle_vreg(opcode, current_names): INSERT_VECTOR_ELT='IVEC', EXTRACT_VECTOR_ELT='EVEC', SHUFFLE_VECTOR='SHUF').get(base, base) + # Avoid ambiguity when opcodes end in numbers + if len(base.rstrip('0123456789')) < len(base): + base += '_' i = 0 for name in current_names: - if name.startswith(base): + if name.rstrip('0123456789') == base: i += 1 if i: return '{}{}'.format(base, i) -- 2.7.4