Commit Graph

18 Commits

Author SHA1 Message Date
Roman Lebedev
c71ad5de2c [Utils] update_llc_test_checks.py: support AMDGPU backend: AMDGCN, r600 triples
Summary:
Lack of that support has taken me by surprise.
I need to add (or at least look at) some tests for https://reviews.llvm.org/D47980#1127615,
and i don't really fancy doing that by hand.

The asm pattern is quite similar to that of x86:
https://godbolt.org/g/hfgeds
just with `#` replaced with `;`

Reviewers: spatel, RKSimon, MaskRay, tstellar, arsenm

Reviewed By: arsenm

Subscribers: arsenm, kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, rampitec, bogner, mareko, llvm-commits

Tags: #amdgpu

Differential Revision: https://reviews.llvm.org/D48001

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334396 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11 09:20:21 +00:00
Simon Pilgrim
d0ebabd8a8 [Utils][X86] Help update_llc_test_checks.py to recognise retl/retq to reduce 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333749 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-01 13:37:01 +00:00
Sanjay Patel
fba895e25a [utils] improve AArch64 asm parser
If we don't mark the cfi line as optional, the script won't
work with 'nounwind' code. Without that attr, there may be
extra noise in the asm body that we don't want to see.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330453 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 17:16:23 +00:00
Daniel Cederman
63faaa5e15 Add SPARC support to update_llc_test_checks.py
Reviewers: spatel, jyknight

Reviewed By: spatel

Subscribers: fedor.sergeev, llvm-commits

Differential Revision: https://reviews.llvm.org/D45809

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330401 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-20 07:59:13 +00:00
Simon Pilgrim
d79c539c3b [UpdateTestChecks] Add update_analyze_test_checks.py for cost model analysis generation
The script allows the auto-generation of checks for cost model tests to speed up their creation and help improve coverage, which will help a lot with PR36550.

If the need arises we can add support for other analyze passes as well, but the cost models was the one I needed to get done - at the moment it just warns that any other analysis mode is unsupported.

I've regenerated a couple of x86 test files to show the effect.

Differential Revision: https://reviews.llvm.org/D45272

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329390 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-06 12:36:27 +00:00
Simon Pilgrim
93c47434af [UpdateTestChecks] Moved core functionality of add_asm_checks into add_checks
As discussed on D45272

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329270 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 10:48:38 +00:00
Simon Pilgrim
90e863357d [UpdateTestChecks] Split core functionality of add_ir_checks into add_checks
Cherry picked from D45272, also added some setup for add_asm_checks to use add_checks as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329266 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 10:26:13 +00:00
Simon Pilgrim
a9e09241ca [UpdateTestChecks] Make add_asm_checks more like add_ir_checks
Towards merging them as mentioned on D45272

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329265 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 09:50:58 +00:00
Simon Pilgrim
8caab7da3f [UpdateTestChecks] Remove unnecessary return from add_ir_checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329262 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 09:30:42 +00:00
Chandler Carruth
7e78daafdd [x86] Fix a pretty obvious think-o with my asm scrubbing. You have to in
fact use regular expression syntax to use regular expressions.

Should restore the bots. Sorry for the noise on this test.

Thanks to Philip for spotting the bug!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329057 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 10:28:56 +00:00
Chandler Carruth
6f46178ea5 [x86] Extend my goofy SP offset scrubbing for llc test cases to actually
do explicit scrubbing of the offsets of stack spills and reloads.

You can always turn this off in order to test specific stack slot usage.
We were already hiding most of this, but the new logic hides it more
generically. Notably, we should effectively hide stack slot churn in
functions that have a frame pointer now, and should also hide it when
changing a function from stack pointer to frame pointer. That transition
already changes enough to be clearly noticed in the test case diff,
showing *every* spill and reload is really noisy without benefit. See
the test case I ran this on as a classic example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329055 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-03 09:57:05 +00:00
Alexander Richardson
b18de8bdc3 [UpdateTestChecks] Handle IR variables with a '-' in the name
Summary:
I noticed that clang will emit variables such as %indirect-arg-temp when
running update_cc1_test_checks.py and therefore update_cc1_test_checks.py
wasn't adding FileCheck captures for those variables.

Reviewers: MaskRay

Reviewed By: MaskRay

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D44459

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327564 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 20:28:53 +00:00
Fangrui Song
9c2e5e4f78 Fix LLVM IR check lines in utils/update_cc_test_checks.py
Reviewers: arichardson

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D44400

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327538 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-14 17:47:07 +00:00
Fangrui Song
94497ced3c [utils] Add utils/update_cc_test_checks.py
A utility to update LLVM IR in C/C++ FileCheck test files.

Example RUN lines in .c/.cc test files:

// RUN: %clang -S -Os -DXX %s -o - | FileCheck %s
// RUN: %clangxx -S -Os %s -o - | FileCheck -check-prefix=IR %s

Usage:

% utils/update_cc_test_checks.py --llvm-bin=release/bin test/a.cc
% utils/update_cc_test_checks.py --c-index-test=release/bin/c-index-test --clang=release/bin/clang /tmp/c/a.cc

    // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
    // RUN: %clang -emit-llvm -S -Os -DXX %s -o - | FileCheck -check-prefix=AA %s
    // RUN: %clangxx -emit-llvm -S -Os %s -o - | FileCheck -check-prefix=BB %s
    using T =
    #ifdef XX
        int __attribute__((vector_size(16)))
    #else
        short __attribute__((vector_size(16)))
    #endif
        ;

    // AA-LABEL: _Z3fooDv4_i:
    // AA:       entry:
    // AA-NEXT:    %add = shl <4 x i32> %a, <i32 1, i32 1, i32 1, i32 1>
    // AA-NEXT:    ret <4 x i32> %add
    //
    // BB-LABEL: _Z3fooDv8_s:
    // BB:       entry:
    // BB-NEXT:    %add = shl <8 x i16> %a, <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
    // BB-NEXT:    ret <8 x i16> %add
    T foo(T a) {
      return a + a;
    }

Differential Revision: https://reviews.llvm.org/D42712

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326591 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-02 17:37:04 +00:00
Justin Bogner
60285814dd update_mir_test_checks: Use the regexes from UpdateTestChecks.common
Some of the update_*_test_checks regexes have been moved into a
library, so we might as well use them in update_mir_test_checks.
Also includes minor bugfixes to the regexes that are there so we
don't regress update_mir_test_checks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326288 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-28 00:56:24 +00:00
Fangrui Song
19c9b1cc72 [utils] Refactor utils/update_{,llc_}test_checks.py to share more code
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324803 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-10 05:01:33 +00:00
Fangrui Song
b02fa51730 Make utils/UpdateTestChecks/common.py Python 2/3 compatible and fix print statements.
Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D42674

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324104 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-02 16:41:07 +00:00
Fangrui Song
6ceb7d83e6 [utils] De-duplicate utils/update_{llc_,}test_checks.py
Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D42654

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323718 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-30 00:40:05 +00:00