aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/UpdateTestChecks
AgeCommit message (Collapse)AuthorFilesLines
6 days[UpdateTestChecks] Don't fail silently when conflicting CHECK lines means no ↵Alex Bradbury1-20/+45
checks are generated for some functions (#159321) There is a warning that triggers if you (for instance) run `update_llc_test_checks.py` on an input where _all_ functions have conflicting check lines and so no checks are generated. However, there are no warnings emitted at all for the case where some functions have non-conflicting check lines but others don't. This is a source of frustration because running update_llc_test_checks can result in all check lines being removed for certain functions when such a conflict exists with no warning, meaning we have to be extra vigilant inspecting the diff. I've also personally wasted time tracking down the source of the dropped lines assuming that update_test_checks would emit a warning in such cases. This change adds logic to emit warnings on a function-by-function basis for any RUN that has conflicting prefixes meaning no output is generated. This subsumes the previous warning for when _all_ functions conflict.
2025-09-11ARM: Move remaining half convert libcall config into tablegen (#153408)Matt Arsenault1-0/+1
The __truncdfhf2 handling is kind of convoluted, but reproduces the existing, likely wrong, handling.
2025-09-10[UTC] Record TBAA semantics when autogenerating check linesAntonio Frighetto1-3/+104
UpdateTestChecks have been updated to take into account TBAA semantics as well, when emitting checks. This is achieved by parsing TBAA metadata for each tool invocation – whose tool is identified by their prefixes –, and maintaining a global dict of prefixes, TBAA nodes.
2025-09-02[Utils] Fix AArch64 ASM regex after #148287 (#156460)Benjamin Maxwell1-1/+1
PR #148287 removed the "\s*" before ".Lfunc_end" for AArch64, which broke `update_llc_test_checks.py` for a number of tests including: - `llvm/test/CodeGen/AArch64/sme-za-exceptions.ll` - `llvm/test/CodeGen/AArch64/win-sve.ll` This patch adds the "\s*" back.
2025-08-29[SCEVDivision] Add SCEVDivisionPrinterPass with corresponding tests (#155832)Ryotaro Kasuga1-0/+1
This patch introduces `SCEVDivisionPrinterPass` and registers it under the name `print<scev-division>`, primarily for testing purposes. This pass invokes `SCEVDivision::divide` upon encountering `sdiv`, and prints the numerator, denominator, quotient, and remainder. It also adds several test cases, some of which are currently incorrect and require fixing. Along with that, this patch added some comments to clarify the behavior of `SCEVDivision::divide`, as follows: - This function does NOT actually perform the division - Given the `Numerator` and `Denominator`, find a pair `(Quotient, Remainder)` s.t. `Numerator = Quotient * Denominator + Remainder` - The common condition `Remainder < Denominator` is NOT necessarily required - There may be multiple solutions for `(Quotient, Remainder)`, and this function finds one of them - Especially, there is always a trivial solution `(0, Numerator)` - The following computations may wrap - The multiplication of `Quotient` and `Denominator` - The addition of `Quotient * Denominator` and `Remainder` Related discussion: #154745
2025-08-21[delinearize] use update_analyze_test_checks.py in delinearization testcases ↵Sebastian Pop1-0/+1
(#153831) In this patch: 1. Adapt the output of printDelinearization() to match what the script expects to see, "Printing analysis 'Delinearization' for function". 2. Register the "Delinearization" pass in the update script. 3. Automatically remove the existing CHECK statements. 4. Update the tests with a run of: ``` $ ~/llvm-project/llvm/utils/update_analyze_test_checks.py --opt=~/llvm-project/build/bin/opt ~/llvm-project/llvm/test/Analysis/Delinearization/*.ll ``` 5. Drop llvm/test/Analysis/Delinearization/undef.ll because the test does not pass the github-actions "undef deprecator." 6. Only run delinearization pretty-print pass on the most internal loop. 7. Only run delinearization pretty-print pass on load and store instructions.
2025-08-12[Utils] update_llc_test_checks.py: updated the regexp for ARM target (#148287)Tommaso Fellegara1-8/+8
Fixes #147485. I changed the regexp for the ARM targets making the part `@+[\t]*@"?(?P=func)"?` optional since when the -asm-verbose=false is passed it is not generated and this led to the issue.
2025-08-12[utils][UpdateTestChecks] Warn about possible target triple mismatch (#149645)Tomer Shafir1-0/+6
Aims to improve error reporting by printing a warning if the target function regex that has been selected finds no matches. For example, a `-mtriple=arm64-apple-darwin` runline, would map to the `arm64` prefix by `update_llc_test_checks.py` and wouldn't match Apple's function layout, generating some not understandable garbage checks. The implementation changes `common.process_run_line` to return an abstract indicator of number of functions processed, without breaking the drivers. Then `update_llc_test_checks.py` prints a driver specific error message.
2025-07-30[utils][UpdateTestChecks] update_llc_test_checks.py - armv7-apple-darwin ↵woruyu1-5/+3
triple no longer working (#150906) ### Summary This PR resolves https://github.com/llvm/llvm-project/issues/150207
2025-07-24[utils] Add spirv triple to update_llc_test_checks (#150223)Nathan Gauër1-0/+1
The 32bit and 64bit flavors of SPIR-V were supported, but the logical version of the triple was lacking. Adding it.
2025-06-14[utils] Add "aarch64-apple-macosx" triple to update_llc_test_checks.py (#144023)Tomer Shafir1-0/+1
Add a missing valid triple "aarch64-apple-macosx" for usability.
2025-05-22[GlobalISel] Add a update_givaluetracking_test_checks.py script (#140296)David Green1-0/+238
As with the other update scripts this takes the output of -passes=print<gisel-value-tracking> and inserts the results into an existing mir file. This means that the input is a lot like update_analysis_test_checks.py, and the output needs to insert into a mir file similarly to update_mir_test_checks.py. The code used to do the inserting has been moved to common, to allow it to be reused. Otherwise it tries to reuse the existing infrastructure, and update_givaluetracking_test_checks is kept relatively short.
2025-05-21[LAA] Tweak debug output for UTC stability (#140764)Ramkumar Ramachandra1-0/+1
UpdateTestChecks has a make_analyzer_generalizer to replace pointer addressess from the debug output of LAA with a pattern, which is an acceptable solution when there is one RUN line. However, when there are multiple RUN lines with a common pattern, UTC fails to recognize common output due to mismatched pointer addresses. Instead of hacking UTC scrub the output before comparing the outputs from the different RUN lines, fix the issue once and for all by making LAA not output unstable pointer addresses in the first place. The removal of the now-dead make_analyzer_generalizer is left as a non-trivial exercise for a follow-up.
2025-05-18[MC][AArch64][ARM][X86] Push target-dependent assembler flags into targets ↵Jessica Clarke1-5/+11
(#139844) The .syntax unified directive and .codeX/.code X directives are, other than some simple common printing code, exclusively implemented in the targets themselves. Thus, remove the corresponding MCAF_* flags and reimplement the directives solely within the targets. This avoids exposing all targets to all other targets' flags. Since MCAF_SubsectionsViaSymbols is all that remains, convert it to its own function like other directives, simplifying its implementation. Note that, on X86, we now always need a target streamer when parsing assembly, as it's now used for directives that aren't COFF-specific. It still does not however need to do anything when producing a non-COFF object file, so this commit does not introduce any new target streamers. There is some churn in test output, and corresponding UTC regex changes, due to comments no longer being flushed by these various directives (and EmitEOL is not exposed outside MCAsmStreamer.cpp so we couldn't do so even if we wanted to), but that was a bit odd to be doing anyway. This is motivated by Morello LLVM, which adds yet another assembler flag to distinguish A64 and C64 instruction sets, but did not update every switch and so emits warnings during the build. Rather than fix those warnings it seems better to instead make the problem not exist in the first place via this change.
2025-05-09update_test_checks: indent dbg records (#139230)Orlando Cazalet-Hyams1-0/+2
LLVM prints debug records like `#dbg_value` indented 2 additional spaces.
2025-04-24update_test_checks: Relax DIFile filename checks (#135692)Scott Linder1-1/+1
Avoid baking in absolute paths in check lines generated for DIFile metadata. Generated test checks cannot be sensitive to absolute paths anyway, as those vary with the environment, but there could be situations where some sensitivity to partial paths is required for certain tests. This implementation just assumes such tests aren't worth the effort to support, but it could be supported in the future. This is most useful for update_cc_test_checks with debug info enabled, where the test writer cannot manipulate the paths within the generated IR directly.
2025-03-18update_test_checks: add new --filter-out-after option (#129739)David Sherwood1-12/+59
Whilst trying to clean up some loop vectoriser IR tests (see test/Transforms/LoopVectorize/AArch64/partial-reduce-chained.ll for example) a reviewer on PR #129047 suggested it would be nice to have an option to stop generating CHECK lines after a certain point. Typically when performing a transformation with the loop vectoriser we don't usually care about any CHECK lines generated for the scalar tail of the loop, since the scalar loop is kept intact. Previously if you wanted to eliminate such unwanted CHECK lines you had to run the update script, then manually delete all the lines corresponding to the scalar loop. This can be very time consuming if the tests ever need changing. What I've tried to do here is add a new --filter-out-after option alongside the existing --filter* options that provides support for stopping the generation of any CHECK lines beyond the line that matches the filter. With the existing filter options we never generate CHECK-NEXT lines, but we still care about ordering with --filter-out-after so I've amended the code to ensure we treat this filter differently.
2025-02-19UpdateTestChecks: Don't check meta details in func definition w/--global ↵Jinsong Ji1-2/+15
none (#124205) When --check-globals none, we skipped all the globals in check lines. However, we are still checking the meta info in function defintion. The generated checks are still sensitive to metadata changes. This is to scrub the meta info and match them with {{.*}} instead.
2025-01-29[DA] enable update_analyze_test_checks.py (#123435)Sebastian Pop1-0/+1
Modify the DA pretty printer to match the output of other analysis passes. This enables update_analyze_test_checks.py to also work on DA tests. Auto generate all the Dependence Analysis tests.
2025-01-13Handle leading underscores in update_cc_test_checks.py (#121800)Momchil Velikov1-0/+16
For some ABIs `update_cc_test_checks.py` is unable to generate tests because of the mismatch between the mangled function names reported by clang's `-asd-dump` and the function names in LLVM IR. This patch fixes it by striping the leading underscore from the mangled name for global functions if the data layout string says they have one.
2025-01-08[UpdateTestChecks][NFC] - Fix typos (#121964)Jessica Del1-1/+1
substition -> substitution in-betweem -> in-between
2024-11-23[UTC] Add support for Xtensa (#117441)Sergei Barannikov1-0/+17
Regenerate the failing test as well.
2024-10-30[AMDGPU][test] fix the error case in update_mc_test_check script (#112731)Brox Chen1-0/+1
update_mc_test_check script handle the "error case testline" wrong in three cases: 1. when user select "--llvm-mc-binary" with a path, the script does not add "not" on top of the "--llvm-mc-binary" and thus getting non-zero exit code and failed. 2. When "not" is presented in runline while not all testlines are expected to fail, the script need to check if the "not" is needed when it execute llvm-mc line by line. Otherwise the script will fail on testline which is passing. 3. When there are multiple runlines, the error checkline need to use correct line offset for "[[LINE-X]]" This patch solve these three issues
2024-10-29[AMDGPU][test]added unique and sort options for update_mc_test_check script ↵Brox Chen1-1/+3
(#111769) add a unique and a sort option to the update_mc_test_check script. These mc asm/dasm files are usually large in number of lines, and these lines are mostly similar to each other. These options can be useful when maintainer is merging or resolving conflicts by making the file identifical Also fixed a small issue in asm/dasm such that the auto generated header line is 1. asm using ";" instead of "//" as comment marker 2. dasm using ";" instead of "#" as comment marker
2024-10-07update_test_checks: fix a simple regression (#111347)Nicolai Hähnle1-1/+1
Reported-by: Yingwei Zheng <dtcxzyw2333@gmail.com> Fixes: 02debcef12793b5 ("update_test_checks: improve IR value name stability (#110940)")
2024-10-04update_test_checks: collect original check lines for old versions of lit ↵Nicolai Hähnle1-1/+4
tests (#111148) Old versions of UTC produced function labels like: ; CHECK-LABEL: @func( Fix the regular expression used when scanning for old check lines to recognize this form of label. This allows meta variable stability to apply when running UTC on tests using this form of label. Reported-by: Nikita Popov <npopov@redhat.com>
2024-10-04update_test_checks: improve IR value name stability (#110940)Nicolai Hähnle1-27/+103
By default, UTC attempts to keep the produced diff small by keeping IR value name variables stable. The old algorithm was roughly: 1. Compute a diff between the old and new check lines, where "uncommitted" variable names are replaced by a wildcard. This leads to a set of non-crossing "candidate" pairs of (old line, new line) that we can try to make equal. 2. Greedily walk this list of candidates, committing to variable names that make candidate lines equal if possible. The greedy approach in the second step has the downside that committing to a variable name greedily can sometimes prevent many subsequent candidates from getting the variable name assignment that would make them equal. We keep the first step as-is, but replace the second one by an algorithm that finds a large independent set of candidates, i.e. candidate pairs of (old line, new line) which are non-conflicting in the sense that their desired variable name mappings are not in conflict. We find the large independent set by greedily assigning a coloring to the conflict graph and taking the largest color class. We then commit to all the variable name mappings which are desired by candidates in this largest color class. As before, we then recurse into regions between matching lines. This is required in large cases. For example, running this algorithm at the top-level of the new test case (stable_ir_values5.ll) matches up most of the instructions, but not the names of the result values of all the `load`s. This is because (unlike e.g. the getelementptrs) the load instructions are all equal except for variable names, and so step 1 (the diff algorithm) doesn't consider them as candidates. However, they are trivially matched by recursion. This also happens to fix a bug in tracking line indices that went unnoticed previously... As is usually the case with these changes, the quality improvement is hard to see from the diff of this patch. However, it becomes obvious when comparing the diff of stable_ir_values5.ll against stable_ir_value5.ll.expected before and after this change.
2024-09-23added a script to update llvm-mc test file (#107246)Brox Chen1-1/+1
Added a script to update the test file generated by llvm-mc binary. The script accepts .s and .txt for asm and dasm. For mc test I am targetting there is no function name which can be used as a key, thus no clear mapping between input and output. The script assumes the test are always line-by-line and it update the output marker for each test line-by-line. --------- Co-authored-by: Alexander Richardson <mail@alexrichardson.me>
2024-08-30[NFC] Prefer subprocess.DEVNULL over os.devnull (#106500)Nicolas van Kempen1-9/+7
There is no need to support Python 2.7 anymore, Python 3.3+ has `subprocess.DEVNULL`. This is good practice and also prevents file handles from staying open unnecessarily. Also remove a couple unused or unneeded `__future__` imports.
2024-08-28[NVPTX] Support __usAtomicCAS builtin (#99646)Denis.G1-0/+1
Supported `__usAtomicCAS` builtin originally defined in `/usr/local/cuda/inlcude/crt/sm_70_rt.hpp` --------- Co-authored-by: Denis Gerasimov <Denis.Gerasimov@baikalelectronics.ru> Co-authored-by: Gonzalo Brito Gadeschi <gonzalob@nvidia.com> Co-authored-by: Denis.Gerasimov <dengzmm@gmail.com>
2024-08-09[update_llc_test_checks][AMDGPU] Update AMDGPU regexp in ↵Juan Manuel Martinez Caamaño1-0/+1
update_llc_test_checks.py (#102480) Updating `llvm/test/CodeGen/AMDGPU/GlobalISel/extractelement.ll` with `update_llc_test_checks.py` ended with several kernels with no checks. Llc's output contained the line ".amdgpu_hsa_kernel <funcname>" after the ".type <funcname>,@function" entry which was not considered by the regexp.
2024-07-03UTC: support debug output from LDist (#93208)Ramkumar Ramachandra1-2/+4
Tweak the LoopDistribute debug output to be prefixed with "LDist: ", get it to be stable, and extend update_analyze_test_checks.py trivially to support this output.
2024-06-04update_test_checks: drop the other arm64_32 handlersJon Roelofs1-5/+0
2024-06-03update_test_checks: support more arm64_32-apple-watchos triplesJon Roelofs1-1/+2
Having the version in `get_run_handlers` meant that a RUN line without the version in it would not match, and therefore UTC would generate a useless catch-all check of the form: ``` ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: ; CHECK: {{.*}} ``` This patch also adds `arm64_32` as a base-level run handler, and assumes it will always apply to a darwin target (which is currently the case for all arm64_32-* triples I see in tree currently).
2024-05-27update_llc_test_checks: better support for non-llc tools (#93135)Nicolai Hähnle1-1/+2
A full downstream fork can already hack up update_llc_test_checks.py to support custom tools that output assembly. An out-of-tree frontend which is meant to build against upstream llvm-project cannot do this, and so providing additional arguments to support a non-standard tool is useful. This also makes a minor adjustment to the regular expression for matching AMDGPU functions when fewer comments are enabled, which happens to be the case for our out-of-tree shader compiler (which motivated this change).
2024-05-23Fix update-test-checks.py on Python 3.6 (#93116)Eli Friedman1-1/+1
re.Match apparently doesn't exist in older versions.
2024-05-19update_test_checks: match IR basic block labels (#88979)Nicolai Hähnle3-462/+473
Labels are matched using a regexp of the form '^(pattern):', which requires the addition of a "suffix" concept to NamelessValue. Aside from that, the key challenge is that block labels are values, and we typically capture values including the prefix '%'. However, when labels appear at the start of a basic block, the prefix '%' is not included, so we must capture block label values *without* the prefix '%'. We don't know ahead of time whether an IR value is a label or not. In most cases, they are prefixed by the word "label" (their type), but this isn't the case in phi nodes. We solve this issue by leveraging the two-phase nature of variable generalization: the first pass finds all occurences of a variable and determines whether the '%' prefix can be included or not. The second pass does the actual substitution. This change also unifies the generalization path for assembly with that for IR and analysis, in the hope that any future changes avoid diverging those cases future. I also considered the alternative of trying to detect the phi node case using more regular expression special cases but ultimately decided against that because it seemed more fragile, and perhaps the approach of keeping a tentative prefix that may later be discarded could also be eventually applied to some metadata and attribute cases. Note that an early version of this change was reviewed as https://reviews.llvm.org/D142452, before version numbers were introduced. This is a substantially updated version of that change.
2024-04-17[RemoveDIs] Update update_test_checks script to recognize dbg_records (#87388)Stephen Tozer1-1/+1
As we've added new IR elements for the RemoveDIs project, we need the update_test_checks script to understand them. For the records themselves this is already done automatically, but their metadata arguments are not recognized as such due to lacking the `metadata` prefix, which means they won't be checked by the script. This patch fixes this by adding a check for all `![0-9]+` patterns as long as they are not at the start of a line (which avoids matching global values).
2024-04-17update_test_checks: keep names stable with generated functions (#87988)Nicolai Hähnle1-24/+35
Collect the original check lines in a manner that is independent of where the check lines appear in the file. This is so that we keep FileCheck variable names stable even when --include-generated-funcs is used. Reported-by: Ruiling Song <ruiling.song@amd.com>
2024-04-16update_test_checks: remove an unused functionNicolai Hähnle1-4/+0
2024-03-08update_test_checks: keep meta variables stable by defaultNicolai Hähnle1-18/+496
Resubmitting this after previous revert with the following changes: - Split table into table_rhs_idx and table_candidate_idx so that bisect.bisect_left can be used without the `key` argument, which was introduced in Python 3.10 - Remove a re.Pattern type annotation Original commit message: Prior to this change, running UTC on larger tests, especially tests with unnamed IR values, often resulted in a spuriously large diff because e.g. TMPnn variables in the CHECK lines were renumbered. This change attempts to reduce the diff by keeping those variable names the same. There are cases in which this "drift" of variable names can end up being more confusing. The old behavior can be re-enabled with the --reset-variable-names command line argument. The improvement may not be immediately apparent in the diff of this change. The point is that the diff of stable_ir_values.ll against stable_ir_values.ll.expected after this change is smaller. Ideally, we'd also keep meta variables for "global" objects stable, e.g. for attributes (#nn) and metadata (!nn). However, that would require a much more substantial refactoring of how we generate check lines, so I left it for future work.
2024-03-08Revert "update_test_checks: keep meta variables stable by default"Nicolai Hähnle1-494/+19
This reverts commit fb02f9ac84a6151e41aba8f7391edd132a9aaf14. Looks like some Python version incompatibility, will investigate.
2024-03-08update_test_checks: keep meta variables stable by defaultNicolai Hähnle1-19/+494
Prior to this change, running UTC on larger tests, especially tests with unnamed IR values, often resulted in a spuriously large diff because e.g. TMPnn variables in the CHECK lines were renumbered. This change attempts to reduce the diff by keeping those variable names the same. There are cases in which this "drift" of variable names can end up being more confusing. The old behavior can be re-enabled with the --reset-variable-names command line argument. The improvement may not be immediately apparent in the diff of this change. The point is that the diff of stable_ir_values.ll against stable_ir_values.ll.expected after this change is smaller. Ideally, we'd also keep meta variables for "global" objects stable, e.g. for attributes (#nn) and metadata (!nn). However, that would require a much more substantial refactoring of how we generate check lines, so I left it for future work.
2024-03-08update_test_checks: simplify get_ir_regexNicolai Hähnle1-2/+2
The match argument isn't used.
2024-03-08update_test_checks: simplify is_local_def_ir_valueNicolai Hähnle1-5/+5
The match argument is unused.
2024-02-28[UTC] Don't leave dangling CHECK-SAME when removing CHECK lines (#82569)Henrik G. Olsson1-2/+13
When removing only lines that are global value CHECK lines, a related CHECK-SAME line could be left dangling without a previous line to belong to. Resolves #78517
2024-02-20[UTC] Fix SyntaxWarning on Python 3.12 (#82327)Luke Lau1-1/+1
On Python 3.12 we now get a warning in common.py: llvm/utils/UpdateTestChecks/common.py:488: SyntaxWarning: invalid escape sequence '\s' This fixes it by using a raw string literal, see https://github.com/llvm/llvm-project/pull/78036 and https://docs.python.org/3/library/re.html
2024-02-08Fix test failure if CLANG_VENDOR contains spaces (#81017)Yi Kong1-1/+1
2023-12-05Include LLVM_VERSION_SUFFIX in the Clang version string. (#74469)James Y Knight1-1/+1
This causes current mainline to now report "18.0.0git" instead of "18.0.0". Fixes #53825
2023-11-28[UTC] Support arm64-apple-macosx in update_llc_test_checks.py. (#73568)Florian Hahn1-0/+1
arm64-apple-macosx is the default triple (usually with the macOS version number) on arm64 macOS. Support it in update_llc_test_checks.py.