diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2022-07-19 09:43:58 +0200 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2022-07-20 11:23:49 +0200 |
commit | 5a4033c36716de0cee75eb28b95cce44ae239cd9 (patch) | |
tree | 440f656bcde89deb5a46b05c886a0967994c7e08 /llvm/utils/UpdateTestChecks/common.py | |
parent | 8ba794be31a314dccba8b4be309b463fdfc5cec5 (diff) | |
download | llvm-5a4033c36716de0cee75eb28b95cce44ae239cd9.zip llvm-5a4033c36716de0cee75eb28b95cce44ae239cd9.tar.gz llvm-5a4033c36716de0cee75eb28b95cce44ae239cd9.tar.bz2 |
update-test-checks: safely handle tests with #if's
There is at least one Clang test (clang/test/CodeGen/arm_acle.c) which
has functions guarded by #if's that cause those functions to be compiled
only for a subset of RUN lines.
This results in a case where one RUN line has a body for the function
and another doesn't. Treat this case as a conflict for any prefixes that
the two RUN lines have in common.
This change exposed a bug where functions with '$' in the name weren't
properly recognized in ARM assembly (despite there being a test case
that was supposed to catch the problem!). This bug is fixed as well.
Differential Revision: https://reviews.llvm.org/D130089
Diffstat (limited to 'llvm/utils/UpdateTestChecks/common.py')
-rw-r--r-- | llvm/utils/UpdateTestChecks/common.py | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index a1e883d8..8e02488 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -496,6 +496,7 @@ class FunctionTestBuilder: self._func_dict = {} self._func_order = {} self._global_var_dict = {} + self._processed_prefixes = set() for tuple in run_list: for prefix in tuple[0]: self._func_dict.update({prefix:dict()}) @@ -584,30 +585,43 @@ class FunctionTestBuilder: scrubbed_body) if func in self._func_dict[prefix]: - if (self._func_dict[prefix][func] is None or - str(self._func_dict[prefix][func]) != scrubbed_body or - self._func_dict[prefix][func].args_and_sig != args_and_sig or - self._func_dict[prefix][func].attrs != attrs): - if (self._func_dict[prefix][func] is not None and - self._func_dict[prefix][func].is_same_except_arg_names( + if (self._func_dict[prefix][func] is not None and + (str(self._func_dict[prefix][func]) != scrubbed_body or + self._func_dict[prefix][func].args_and_sig != args_and_sig or + self._func_dict[prefix][func].attrs != attrs)): + if self._func_dict[prefix][func].is_same_except_arg_names( scrubbed_extra, args_and_sig, attrs, - is_backend)): + is_backend): self._func_dict[prefix][func].scrub = scrubbed_extra self._func_dict[prefix][func].args_and_sig = args_and_sig - continue else: # This means a previous RUN line produced a body for this function # that is different from the one produced by this current RUN line, # so the body can't be common accross RUN lines. We use None to # indicate that. self._func_dict[prefix][func] = None - continue - - self._func_dict[prefix][func] = function_body( - scrubbed_body, scrubbed_extra, args_and_sig, attrs, func_name_separator) - self._func_order[prefix].append(func) + else: + if prefix not in self._processed_prefixes: + self._func_dict[prefix][func] = function_body( + scrubbed_body, scrubbed_extra, args_and_sig, attrs, + func_name_separator) + self._func_order[prefix].append(func) + else: + # An earlier RUN line used this check prefixes but didn't produce + # a body for this function. This happens in Clang tests that use + # preprocesser directives to exclude individual functions from some + # RUN lines. + self._func_dict[prefix][func] = None + + def processed_prefixes(self, prefixes): + """ + Mark a set of prefixes as having had at least one applicable RUN line fully + processed. This is used to filter out function bodies that don't have + outputs for all RUN lines. + """ + self._processed_prefixes.update(prefixes) def get_failed_prefixes(self): # This returns the list of those prefixes that failed to match any function, |