summaryrefslogtreecommitdiffstats
path: root/llvm/utils/UpdateTestChecks/common.py
diff options
context:
space:
mode:
authorJohannes Doerfert <johannes@jdoerfert.de>2019-10-10 20:23:17 -0500
committerJohannes Doerfert <johannes@jdoerfert.de>2019-12-31 02:35:18 -0600
commita6c59e0792edc46df937b338fe0e68d00cabf90b (patch)
tree0c87c5e09c22317e04c13c776d3c5e1c8fa2170c /llvm/utils/UpdateTestChecks/common.py
parent751336340dabc58f178a24f7b169f33366316f70 (diff)
downloadbcm5719-llvm-a6c59e0792edc46df937b338fe0e68d00cabf90b.tar.gz
bcm5719-llvm-a6c59e0792edc46df937b338fe0e68d00cabf90b.zip
[Utils] Deal with occasionally deleted functions
When functions exist for some but not all run lines we need to be careful when selecting the prefix. So far, a common prefix was potentially chosen as there was never a "conflict" that would have caused otherwise. With this patch we avoid common prefixes if they are used by run lines that do not emit the function. Reviewed By: lebedev.ri Differential Revision: https://reviews.llvm.org/D68850
Diffstat (limited to 'llvm/utils/UpdateTestChecks/common.py')
-rw-r--r--llvm/utils/UpdateTestChecks/common.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index 44e0186ae3a..985c0b074c5 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -265,16 +265,37 @@ def genericize_check_lines(lines, is_analyze, vars_seen):
def add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, check_label_format, is_asm, is_analyze):
+ # prefix_blacklist are prefixes we cannot use to print the function because it doesn't exist in run lines that use these prefixes as well.
+ prefix_blacklist = set()
printed_prefixes = []
for p in prefix_list:
checkprefixes = p[0]
+ # If not all checkprefixes of this run line produced the function we cannot check for it as it does not
+ # exist for this run line. A subset of the check prefixes might know about the function but only because
+ # other run lines created it.
+ if any(map(lambda checkprefix: func_name not in func_dict[checkprefix], checkprefixes)):
+ prefix_blacklist |= set(checkprefixes)
+ continue
+
+ # prefix_blacklist is constructed, we can now emit the output
+ for p in prefix_list:
+ checkprefixes = p[0]
+ saved_output = None
for checkprefix in checkprefixes:
if checkprefix in printed_prefixes:
break
- # TODO func_dict[checkprefix] may be None, '' or not exist.
- # Fix the call sites.
- if func_name not in func_dict[checkprefix] or not func_dict[checkprefix][func_name]:
- continue
+
+ # prefix is blacklisted. We remember the output as we might need it later but we will not emit anything for the prefix.
+ if checkprefix in prefix_blacklist:
+ if not saved_output and func_name in func_dict[checkprefix]:
+ saved_output = func_dict[checkprefix][func_name]
+ continue
+
+ # If we do not have output for this prefix but there is one saved, we go ahead with this prefix and the saved output.
+ if not func_dict[checkprefix][func_name]:
+ if not saved_output:
+ continue
+ func_dict[checkprefix][func_name] = saved_output
# Add some space between different check prefixes, but not after the last
# check line (before the test code).
OpenPOWER on IntegriCloud