summaryrefslogtreecommitdiffstats
path: root/llvm/utils/update_llc_test_checks.py
Commit message (Collapse)AuthorAgeFilesLines
* [UpdateTestChecks] Change shebang from python to python3Fangrui Song2019-12-031-2/+2
| | | | | | | | | | 'python' means Python 2 on some platforms while Python 3 on others. 'python3' is Python 3 only. Python 2.7 End of Life is set to January 1, 2020. Getting rid of Python 2 support reduces maintenance burden. Reviewed By: lebedev.ri Differential Revision: https://reviews.llvm.org/D70730
* [UpdateTestChecks] Share the code to parse RUN: lines between all scriptsAlex Richardson2019-12-021-29/+11
| | | | | | | | | | | | | | | | Summary: This commit also introduces a common.debug() function to avoid many `if args.verbose:` statements. Depends on D70428. Reviewers: xbolva00, MaskRay, jdoerfert Reviewed By: MaskRay Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70432
* [UptestTestChecks][NFC] Share some common command line options codeAlex Richardson2019-11-201-5/+1
| | | | | | | | | | | | | | | | | | | Summary: Add a function common.parse_commandline_args() that adds options common to all tools (--verbose and --update-only) and returns the parsed commandline arguments. I plan to use the shared parsing of --verbose in a follow-up commit to remove most of the `if args.verbose:` checks in the scripts. Reviewers: xbolva00, MaskRay Reviewed By: MaskRay Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70428
* [utils] Add minimal support for MIR inputs to update_llc_test_checks.pyRoman Tereshin2019-09-181-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | update_{llc,mir}_test_checks.py applicability is determined by the output (assembly or MIR), not the input, which makes update_llc_test_checks.py the right tool to generate tests that start at MIR and stop at the final assembly. This commit adds the minimal support for this path. Main limitation that remains: - MIR has to have LLVM IR section, and the CHECK lines will be inserted into the LLVM IR functions that correspond to the MIR functions. Running ../utils/update_llc_test_checks.py --llc-binary ./bin/llc on a slightly modified ../test/CodeGen/X86/bad-tls-fold.mir produces the following diff: +# NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +# RUN: llc %s -o - | FileCheck %s --- | target triple = "x86_64-unknown-linux-gnu" @@ -6,17 +7,31 @@ @i = external thread_local global i32 define i32 @or() { + ; CHECK-LABEL: or: + ; CHECK: # %bb.0: # %entry + ; CHECK-NEXT: movq {{.*}}(%rip), %rax + ; CHECK-NEXT: orq $7, %rax + ; CHECK-NEXT: movq i@{{.*}}(%rip), %rcx + ; CHECK-NEXT: orq %rax, %rcx + ; CHECK-NEXT: movl %fs:(%rcx), %eax + ; CHECK-NEXT: retq entry: ret i32 undef } - define i32 @and() { + ; CHECK-LABEL: and: + ; CHECK: # %bb.0: # %entry + ; CHECK-NEXT: movq {{.*}}(%rip), %rax + ; CHECK-NEXT: orq $7, %rax + ; CHECK-NEXT: movq i@{{.*}}(%rip), %rcx + ; CHECK-NEXT: andq %rax, %rcx + ; CHECK-NEXT: movl %fs:(%rcx), %eax + ; CHECK-NEXT: retq entry: ret i32 undef } ... (not applied) llvm-svn: 372277
* [utils] Amend update_llc_test_checks.py to non-llc tooling, NFCRoman Tereshin2019-09-181-3/+4
| | | | | | | | Very minor change aiming to make it easier to extend the script downstream to support non-llc, but llc-like tools. The main objective is to decrease the probability of merge conflicts. llvm-svn: 372276
* [UpdateTestChecks] Update tests optionDavid Bolvansky2019-08-071-3/+20
| | | | | | | | | | | | | | | | | | | | | Summary: Port of new feature introduced https://reviews.llvm.org/D65610 to other update scripts. - update_*_checks.py: add an alias -u for --update-only - port --update-only to other update_*_test_checks.py scripts - update script aborts if the test file was generated by another update_*_test_checks.py utility Reviewers: lebedev.ri, RKSimon, MaskRay, reames, gbedwell Reviewed By: MaskRay Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65793 llvm-svn: 368174
* [UpdateTestChecks] Emit warning when invalid value for -check-prefix(es) optionDavid Bolvansky2019-07-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The script is silent for the following issue: FileCheck %s -check-prefix=CHECK,POPCOUNT FileCheck will catch it later, but I think we can warn here too. Now it warns: ./update_llc_test_checks.py file.ll WARNING: Supplied prefix 'CHECK,POPCOUNT' is invalid. Prefix must contain only alphanumeric characters, hyphens and underscores. Did you mean --check-prefixes=CHECK,POPCOUNT? Reviewers: lebedev.ri, spatel, RKSimon, craig.topper, nikic, gbedwell Reviewed By: RKSimon Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64589 llvm-svn: 367244
* UpdateTestChecks: fix AMDGPU handlingRoman Lebedev2019-05-181-5/+11
| | | | | | | | | | | | | | | | | | | | | | | Summary: Was looking into supporting `(srl (shl x, c1), c2)` with c1 != c2 in dagcombiner, this test changes, but makes `update_llc_test_checks.py` unhappy. **Many** AMDGPU tests specify `-march`, not `-mtriple`, which results in `update_llc_test_checks.py` defaulting to x86 asm function detection heuristics, which don't work here. I propose to fix this by adding an infrastructure to map from `-march` to `-mtriple`, in the UpdateTestChecks tooling. Reviewers: RKSimon, MaskRay, arsenm Reviewed By: arsenm Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62099 llvm-svn: 361101
* Add wildcard support to all update_*_test_checks.py scripts (PR37500)Simon Pilgrim2019-03-051-1/+3
| | | | | | | | We can already update multiple files in each update call, this extends it to work with wildcards as well in the same way as update_mca_test_checks.py (to support shells that won't do this for us - windows command prompt etc.) Differential Revision: https://reviews.llvm.org/D58817 llvm-svn: 355386
* [utils] Fix update scripts output when run on python3.Simon Pilgrim2019-01-301-1/+1
| | | | | | This fixes a "bytes-like object is required, not 'str'" python3 error I hit on update_llc_test_checks.py (but present on the other scripts as well) by matching what update_mca_test_checks.py already does, plus I've added an explicit 'utf-8' encoding. llvm-svn: 352633
* Python compat - no explicit reference to Python versionSerge Guelton2019-01-031-1/+1
| | | | | | | | Update documentation and shebang. Differential Revision: https://reviews.llvm.org/D56252 llvm-svn: 350327
* Python compat - print statementSerge Guelton2019-01-031-10/+12
| | | | | | | | | Make sure all print statements are compatible with Python 2 and Python3 using the `from __future__ import print_function` statement. Differential Revision: https://reviews.llvm.org/D56249 llvm-svn: 350307
* Re-land r335297 "[X86] Implement more of x86-64 large and medium PIC code ↵Reid Kleckner2018-07-231-0/+5
| | | | | | | | | | | | | | models" Don't try to generate large PIC code for non-ELF targets. Neither COFF nor MachO have relocations for large position independent code, and users have been using "large PIC" code models to JIT 64-bit code for a while now. With this change, if they are generating ELF code, their JITed code will truly be PIC, but if they target MachO or COFF, it will contain 64-bit immediates that directly reference external symbols. For a JIT, that's perfectly fine. llvm-svn: 337740
* Revert "Re-land r335297 "[X86] Implement more of x86-64 large and medium PIC ↵Jonas Devlieghere2018-06-281-5/+0
| | | | | | | | | | | | | code models"" Reverting because this is causing failures in the LLDB test suite on GreenDragon. LLVM ERROR: unsupported relocation with subtraction expression, symbol '__GLOBAL_OFFSET_TABLE_' can not be undefined in a subtraction expression llvm-svn: 335894
* Re-land r335297 "[X86] Implement more of x86-64 large and medium PIC code ↵Reid Kleckner2018-06-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | models" The large code model allows code and data segments to exceed 2GB, which means that some symbol references may require a displacement that cannot be encoded as a displacement from RIP. The large PIC model even relaxes the assumption that the GOT itself is within 2GB of all code. Therefore, we need a special code sequence to materialize it: .LtmpN: leaq .LtmpN(%rip), %rbx movabsq $_GLOBAL_OFFSET_TABLE_-.LtmpN, %rax # Scratch addq %rax, %rbx # GOT base reg From that, non-local references go through the GOT base register instead of being PC-relative loads. Local references typically use GOTOFF symbols, like this: movq extern_gv@GOT(%rbx), %rax movq local_gv@GOTOFF(%rbx), %rax All calls end up being indirect: movabsq $local_fn@GOTOFF, %rax addq %rbx, %rax callq *%rax The medium code model retains the assumption that the code segment is less than 2GB, so calls are once again direct, and the RIP-relative loads can be used to access the GOT. Materializing the GOT is easy: leaq _GLOBAL_OFFSET_TABLE_(%rip), %rbx # GOT base reg DSO local data accesses will use it: movq local_gv@GOTOFF(%rbx), %rax Non-local data accesses will use RIP-relative addressing, which means we may not always need to materialize the GOT base: movq extern_gv@GOTPCREL(%rip), %rax Direct calls are basically the same as they are in the small code model: They use direct, PC-relative addressing, and the PLT is used for calls to non-local functions. This patch adds reasonably comprehensive testing of LEA, but there are lots of interesting folding opportunities that are unimplemented. I restricted the MCJIT/eh-lg-pic.ll test to Linux, since the large PIC code model is not implemented for MachO yet. Differential Revision: https://reviews.llvm.org/D47211 llvm-svn: 335508
* Revert r335297 "[X86] Implement more of x86-64 large and medium PIC code models"Reid Kleckner2018-06-211-5/+0
| | | | | | MCJIT can't handle R_X86_64_GOT64 yet. llvm-svn: 335300
* [X86] Implement more of x86-64 large and medium PIC code modelsReid Kleckner2018-06-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The large code model allows code and data segments to exceed 2GB, which means that some symbol references may require a displacement that cannot be encoded as a displacement from RIP. The large PIC model even relaxes the assumption that the GOT itself is within 2GB of all code. Therefore, we need a special code sequence to materialize it: .LtmpN: leaq .LtmpN(%rip), %rbx movabsq $_GLOBAL_OFFSET_TABLE_-.LtmpN, %rax # Scratch addq %rax, %rbx # GOT base reg From that, non-local references go through the GOT base register instead of being PC-relative loads. Local references typically use GOTOFF symbols, like this: movq extern_gv@GOT(%rbx), %rax movq local_gv@GOTOFF(%rbx), %rax All calls end up being indirect: movabsq $local_fn@GOTOFF, %rax addq %rbx, %rax callq *%rax The medium code model retains the assumption that the code segment is less than 2GB, so calls are once again direct, and the RIP-relative loads can be used to access the GOT. Materializing the GOT is easy: leaq _GLOBAL_OFFSET_TABLE_(%rip), %rbx # GOT base reg DSO local data accesses will use it: movq local_gv@GOTOFF(%rbx), %rax Non-local data accesses will use RIP-relative addressing, which means we may not always need to materialize the GOT base: movq extern_gv@GOTPCREL(%rip), %rax Direct calls are basically the same as they are in the small code model: They use direct, PC-relative addressing, and the PLT is used for calls to non-local functions. This patch adds reasonably comprehensive testing of LEA, but there are lots of interesting folding opportunities that are unimplemented. Reviewers: chandlerc, echristo Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D47211 llvm-svn: 335297
* [Utils][X86] Help update_llc_test_checks.py to recognise retl/retq to reduce ↵Simon Pilgrim2018-06-011-2/+2
| | | | | | | | | | | | | | | | CHECK duplication (PR35003) This patch replaces the --x86_extra_scrub command line argument to automatically support a second level of regex-scrubbing if it improves the matching of nearly-identical code patterns. The argument '--extra_scrub' is there now to force extra matching if required. This is mostly useful to help us share 32-bit/64-bit x86 vector tests which only differs by retl/retq instructions, but any scrubber can now technically support this, meaning test checks don't have to be needlessly obfuscated. I've updated some of the existing checks that had been manually run with --x86_extra_scrub, to demonstrate the extra "ret{{[l|q]}}" scrub now only happens when useful, and re-run the sse42-intrinsics file to show extra matches - most sse/avx intrinsics files should be able to now share 32/64 checks. Tested with the opt/analysis scripts as well which share common code - AFAICT the other update scripts use their own versions. Differential Revision: https://reviews.llvm.org/D47485 llvm-svn: 333749
* [utils] Refactor utils/update_{,llc_}test_checks.py to share more codeFangrui Song2018-02-101-25/+1
| | | | | | | | | | | | | | Summary: This revision refactors 1. parser 2. CHECK line adder of utils/update_{,llc_}test_checks.py so that thir functionality can be re-used by other utility scripts (e.g. D42712) Reviewers: asb, craig.topper, RKSimon, echristo Subscribers: llvm-commits, spatel Differential Revision: https://reviews.llvm.org/D42805 llvm-svn: 324803
* [utils] De-duplicate utils/update_{llc_,}test_checks.pyFangrui Song2018-01-301-263/+16
| | | | | | | | Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42654 llvm-svn: 323718
* [utils] Make .cfi_startproc optional for powerpcFangrui Song2018-01-171-1/+1
| | | | | | | | | | Summary: llc sometimes may not emit .cfi_startproc which makes func_dict to have less entries. Subscribers: nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D42144 llvm-svn: 322725
* Add more triples to llc_test_checks.pySam Parker2017-12-011-0/+17
| | | | | | | | | Added some commonly used Arm triples to the script, with and without the -eabi suffix. Differential Revision: https://reviews.llvm.org/D40708 llvm-svn: 319545
* [utils][mips] Add support for mips for update_llc_checks.pySimon Dardis2017-11-261-0/+20
| | | | | | | | | | | Add support for mips, particularly skipping the matching of .frame, .(f)mask and LLVM's usage of the .set no(reorder|at|macro) directives. Reviewers: spatel Differential Revision: https://reviews.llvm.org/D40268 llvm-svn: 319001
* [utils] Fix RISC-V support in update_llc_test_checks.pyAlex Bradbury2017-11-091-1/+1
| | | | | | scrub_asm_riscv now takes two arguments rather than one. llvm-svn: 317826
* [utils] Add RISC-V support to update_llc_test_checks.pyAlex Bradbury2017-11-081-0/+18
| | | | | | | | | | | | This should be a trivial change, and I've started using it for generating all tests at https://github.com/lowrisc/riscv-llvm (i.e. it's been tested in action quite a lot). Note that the regex does not attempt to match .cfi_startproc, as I want to ensure compatibility with functions that have the nounwind attribute. Differential Revision: https://reviews.llvm.org/D39789 llvm-svn: 317693
* [utils] make retq/retl regex an option that is off by defaultSanjay Patel2017-10-241-10/+14
| | | | | | | | | Ideally, we should compare 32- and 64-bit versions to see if the ret line is the only difference and then insert the regex only in that case. But this is a quick hack to avoid a bunch of noise as existing tests are updated. llvm-svn: 316443
* [utils] Support -mtriple=powerpc64Fangrui Song2017-10-221-2/+3
| | | | | | | | | | Summary: test/CodeGen/PowerPC/pr33093.ll uses both powerpc64 (big-endian) and powerpc64le while the former was unsupported. Subscribers: nemanjai Differential Revision: https://reviews.llvm.org/D39164 llvm-svn: 316297
* [utils, x86] add regex for retl/retq to reduce duplicated FileChecking (PR35003)Sanjay Patel2017-10-201-0/+3
| | | | llvm-svn: 316242
* Util: Improve update_llc_test_checks to scrub macosx-style assembly annotationsZvi Rackover2017-09-061-1/+1
| | | | | | | | | | | | | | | | | | | Summary: In D37523 Sanjay pointed out that the tool does not scrub macosx-style 'End of Function' annotations, where the comments begin with a double-#. I tested this patch by verifying all existing occurences of 'End function' are scrubbed: find ./test/CodeGen/X86 -name '*.ll' | xargs grep -l "End function" | xargs utils/update_llc_test_checks.py --llc-binary build/bin/llc Reviewers: spatel, chandlerc, craig.topper Reviewed By: spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37532 llvm-svn: 312678
* [utils] add aarch64 target as an optionSanjay Patel2017-08-251-19/+29
| | | | | | I don't know enough to add a custom scrubber for AArch64, so I just re-used ARM. llvm-svn: 311795
* Teach the llc check updater to recognize the end-of-function commentChandler Carruth2017-08-251-2/+2
| | | | | | | used on Windows and sometimes Darwin. Cleans up generated patterns for me quite a bit. llvm-svn: 311752
* Fix update_llc_test_checks.py ARM parsingEli Friedman2017-07-281-1/+1
| | | | | | | | | | | | When I tried running the script, the ARM regex parser could not parse my code. It failed because the .Lfunc_end line has a comment at the end of it, so this commit removes the newline at the end of the regex. Patch by Joel Galenson! Differential Revision: https://reviews.llvm.org/D35641 llvm-svn: 309457
* [PPC] Add generated tests for all atomic operationsTim Shen2017-03-231-0/+4
| | | | | | | | | | | | Summary: Add tests for all atomic operations for powerpc64le, so that all changes can be easily examined. Reviewers: kbarton, hfinkel, echristo Subscribers: mehdi_amini, nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D31285 llvm-svn: 298614
* Add SystemZ to utils/update_llc_test_checks.py.Jonas Paulsson2017-03-171-0/+18
| | | | | | | | | Extend script for auto-generating CHECK lines so that it works for SystemZ. This is a pre-commit for the new tests resulting from https://reviews.llvm.org/D29489 llvm-svn: 298048
* [utils] allow auto-generation of checks for thumb triplesSanjay Patel2017-02-241-0/+2
| | | | | | | If there's some reason not to do this, feel free to revert and/or fix, but for the cases I'm looking at, the script appears to do fine for these targets. llvm-svn: 296181
* Add some testcases for bitfields with illegal widths.Eli Friedman2017-02-241-0/+1
| | | | | | | | clang will generate IR like this for input using packed bitfields; very simple semantically, but it's a bit tricky to actually generate good code. llvm-svn: 296080
* [utils] Improve extraction of check prefixes from RUN linesNikolai Bozhenov2017-01-141-3/+3
| | | | | | | | | | | | Correct handling of the following FileCheck options is implemented in update_llc_test_checks.py and update_test_checks.py scripts: 1) -check-prefix (with a single dash) 2) -check-prefixes (with multiple prefixes) Differential Revision: https://reviews.llvm.org/D28572 llvm-svn: 292008
* Fix indentation in r290716.Bryant Wong2016-12-291-4/+4
| | | | | | Use two-space indentation like the rest of the file. llvm-svn: 290722
* Correctly handle multi-lined RUN lines.Bryant Wong2016-12-291-1/+8
| | | | | | | | | | `utils/update_{llc_test,test}_checks` ought to be able to handle RUN commands that span multiple lines, as shown in the example at http://llvm.org/docs/CommandGuide/FileCheck.html#the-filecheck-check-prefix-option Differential Revision: https://reviews.llvm.org/D26523 llvm-svn: 290716
* [PowerPC] Add ppc support to update_llc_test_checks.py, and ppc tests. NFC.Tim Shen2016-12-221-17/+72
| | | | | | | | | | Reviewers: chandlerc, hfinkel, echristo, iteratee Subscribers: mehdi_amini, nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D28036 llvm-svn: 290370
* Add ARM support to update_llc_test_checks.pyEli Friedman2016-12-191-9/+34
| | | | | | | | | | Just the minimal support to get it working at the moment. Includes checks for test/CodeGen/ARM/vzip.ll as an example. Differential Revision: https://reviews.llvm.org/D27829 llvm-svn: 290144
* [X86] Fix test checks script to satisfy pyflakesZvi Rackover2016-11-071-5/+4
| | | | | | | | - Remove unused imports. - Initialize the variable 'name' before its (static) uses, and rename it to a more descriptive name. llvm-svn: 286128
* [X86] Fix test checks script to handle run lines with no pipe checksZvi Rackover2016-11-071-1/+5
| | | | | | | Fixes crashes in tests such as test/CodeGen/X86/masked_gather_scatter.ll which contains a RUN: with no pipe chain. llvm-svn: 286125
* [X86][AVX512] Add support for masked shuffle commentsSimon Pilgrim2016-07-031-1/+1
| | | | | | | | | | This patch adds support for including the avx512 mask register information in the mask/maskz versions of shuffle instruction comments. This initial version just adds support for MOVDDUP/MOVSHDUP/MOVSLDUP to reduce the mass of test regenerations, other shuffle instructions can be added in due course. Differential Revision: http://reviews.llvm.org/D21953 llvm-svn: 274459
* [X86] Updated test checks script to generalise LCPI symbol refsSimon Pilgrim2016-06-111-1/+4
| | | | | | | | The script now replace '.LCPI888_8' style asm symbols with the {{\.LCPI.*}} re pattern - this helps stop hardcoded symbols in 32-bit x86 tests changing with every edit of the file Refreshed some tests to demonstrate the new check llvm-svn: 272488
* don't hardcode the name of the llc checks scriptSanjay Patel2016-03-241-5/+2
| | | | | | | | | | We lose the 'utils' directory name in our advertising line with this change. We could retain that, but I don't see the point. This removes a dependency for making the script apply to more than 'llc'. Ie, we'll want to change the script name if it works with opt/clang too. llvm-svn: 264310
* reorganize llc checks script to allow more flexibility, part 2; NFCISanjay Patel2016-03-241-73/+104
| | | | | | | | The goal is to enhance this script to be used with opt and clang: Break 'main' into functions and change variable names to be more generic because we want to handle more than x86 asm output. llvm-svn: 264307
* reorganize llc checks script to allow more flexibility; NFCISanjay Patel2016-03-231-28/+31
| | | | | | | | | The goal is to enhance this script to be used with opt and clang: Group all of the regexes together, so it's easier to see what's going on. This will make it easier to break main() up into pieces too. Also, note that some of the regexes are for x86-specific asm. llvm-svn: 264197
* [utils] Add windows support to update_llc_test_checks.pySimon Pilgrim2016-01-271-1/+3
| | | | | | | | Strip dos line endings from llc generated files to allow the regex patterns to match them. Ensure updated *.ll files are generated with unix style line endings. llvm-svn: 258987
* Make utils/update_llc_test_checks.py note that the assertions areJames Y Knight2015-11-231-1/+7
| | | | | | | | | autogenerated. Also update existing test cases which appear to be generated by it and weren't modified (other than addition of the header) by rerunning it. llvm-svn: 253917
OpenPOWER on IntegriCloud