1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00
Commit Graph

86 Commits

Author SHA1 Message Date
sstefan1
470e74fc55 [UpdateTestChecks] Don't skip attributes when comparing functions 2020-08-29 15:37:36 +02:00
sstefan1
0afdba7e67 [UpdateTestChecks] include { in function signature check line
After D85099, if we have attribute group in the function signature that hasn't
been seen before, and later a callsite with the same attribute group, filecheck will evaluate
the first attribute group to for example '#0 {'. We now include { in the args_and_sig group to avoid this.

Differential Revision: https://reviews.llvm.org/D86769
2020-08-28 23:44:03 +02:00
Alex Richardson
65d5b3b1e2 Fix update_llc_test_checks function regex for RV64
Some functions also include a `.Lfunc$local:` label due to
-fno-semantic-interposition

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D85888
2020-08-25 12:20:33 +01:00
Sam Parker
c6eebcc686 [UpdatesTestChecks] Fix typo in common.py
global_vars_see_dict -> global_vars_seen_dict
2020-08-25 11:13:33 +01:00
Johannes Doerfert
fdfc525664 [UpdateTestChecks][FIX] Python 2.7 compatibility and use right prefix 2020-08-12 11:58:08 -05:00
Johannes Doerfert
bd4a02e66e [UpdateTestChecks] Match unnamed values like "@[0-9]+" and "![0-9]+"
With this patch we will match most *uses* of "temporary" named things in
the IR via regular expressions, not their name at creation time. The new
"values" we match are:
  - "unnamed" globals: `@[0-9]+`
  - debug metadata: `!dbg ![0-9]+`
  - loop metadata: `!loop ![0-9]+`
  - tbaa metadata: `!tbaa ![0-9]+`
  - range metadata: `!range ![0-9]+`
  - generic metadata: `metadata ![0-9]+`
  - attributes groups: `#[0-9]`

We still don't match the declarations but that can be done later. This
patch can introduce churn when existing check lines contain the old
hardcoded versions of the above "values". We can add a flag to opt-out,
or opt-in, if necessary.

Reviewed By: arichardson, MaskRay

Differential Revision: https://reviews.llvm.org/D85099
2020-08-12 01:04:16 -05:00
Alex Richardson
8a7212b0e5 Fix update_cc_test_checks.py --llvm-bin after D78478
Not passing --clang would result in a python exception after this change:
(TypeError: expected str, bytes or os.PathLike object, not NoneType)
because the --clang argument default was only being populated in the
initial argument parsing pass but not later on.
Fix this by adding an argparse callback to set the default values.

Reviewed By: vitalybuka, MaskRay

Differential Revision: https://reviews.llvm.org/D84511
2020-08-03 11:18:01 +01:00
sstefan1
2831dc56cb [Utils][Fix] remove unnecessary ; at the end 2020-07-19 20:48:28 +02:00
sstefan1
cd779b624c [Utils] Check function attributes in update_test_checks
Summary:
This introduces new flag to the update_test_checks and
update_cc_test_checks that allows for function attributes
to be checked in a check-line. If the flag is not set,
the behavior should remain the same.

Reviewers: jdoerfert

Subscribers: arichardson, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D83629
2020-07-19 20:07:24 +02:00
Alex Richardson
199e49d00e [UpdateTestChecks] Move more update_test_checks.py logic to common.py
I intend to reuse this to add UTC_ARGS support for update_llc_test_checks.py
and update_cc_test_checks.py in D78478.

Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D78618
2020-07-08 10:59:28 +01:00
Eric Christopher
71f2701c0a [UpdateTestChecks] As part of using inclusive language within the
llvm project, migrate away from the use of blacklist and whitelist.
2020-06-19 21:35:11 -07:00
Sanjay Patel
804d4bd875 [utils] change default nameless value to "TMP"
This is effectively reverting rGbfdc2552664d to avoid test churn
while we figure out a better way forward.

We at least salvage the warning on name conflict from that patch
though.

If we change the default string again, we may want to mass update
tests at the same time. Alternatively, we could live with the poor
naming if we change -instnamer.

This also adds a test to LLVM as suggested in the post-commit
review. There's a clang test that is also affected. That seems
like a layering violation, but I have not looked at fixing that yet.

Differential Revision: https://reviews.llvm.org/D80584
2020-06-01 06:54:45 -04:00
Sanjay Patel
2ca9a76699 [utils] change update_test_checks.py use of 'TMP' value names
As discussed in PR45951:
https://bugs.llvm.org/show_bug.cgi?id=45951

There's a potential name collision between update_test_checks.py and -instnamer
and/or manually-generated IR test files because all of them try to use the
variable name that should never be used: "tmp".

This patch proposes to reduce the odds of collision and adds a warning if we
detect the problem. This will cause regression test churn when regenerating
CHECK lines on existing files.

Differential Revision: https://reviews.llvm.org/D80584
2020-05-31 10:46:11 -04:00
Alex Richardson
425ae3721b [UpdateTestChecks] Make generation of UTC_ARGS: comment more robust
We now use the argparse Action objects to determine the name of the flags.
This fixes cases where the key for the stored result ('dest') is not the
same as the command line flag (e.g. --enable/--disable).
Also add a test that --disabled can be part of the initial UTC_ARGS.

This is split out from D78478

Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D78617
2020-04-23 13:12:27 +01:00
Jinsong Ji
7f4648c85e [NFC][UpdateTestChecks] Fix typos in comments 2020-04-10 15:04:10 +00:00
Kang Zhang
367540d524 [PowerPC][UpdateTestChecks] Remove the extra # when scrubbing loop comments
Summary:
The patch D63957 is to avoid empty string when scrubbing loop comments,
it will replace loop comments to a `#`, that's correct.
But if the line has something else not only loop comments, we will get
a extra `#`.
The patch is to remove the extra `#`.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D77357
2020-04-10 06:09:01 +00:00
Kang Zhang
fb0145ca24 [NFC][update_llc_test_checks] Remove the redundant SCRUB_LOOP_COMMENT_RE in asm.py
Summary:
In the patch: https://reviews.llvm.org/D42654
De-duplicate utils/update_{llc_,}test_checks.py, Some common part has
been move to common.py. The SCRUB_LOOP_COMMENT_RE has been moved to
common.py, but forgetting to remove from asm.py.
This patch is to remove the redundant SCRUB_LOOP_COMMENT_RE in asm.py
and use common.SCRUB_LOOP_COMMENT_RE.
2020-04-02 09:46:45 +00:00
Johannes Doerfert
a5b1746df2 [Utils][FIX] Properly deal with occasionally deleted functions
While D68850 allowed functions to be deleted I accidentally saved some
version of the function to be used once a suitable prefix was found.
This turned out to be problematic when the occasionally deleted function
is also occasionally modified. The test case is adjusted to resemble the
case in which the problem was found.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D76586
2020-04-01 21:56:18 -05:00
Simon Pilgrim
bb10a9825b [UpdateTestChecks] Use common ir function name matcher and extend to accept periods in names (PR37586)
Remove the local versions of the IR_FUNCTION_RE matcher (they weren't doing anything different), and ensure all the function name matchers accept '.' and '-'.

We don't need to use '\.' inside python regex sets either, or '\-' as long as thats at the end of the set.
2020-03-24 10:59:30 +00:00
Sanjay Patel
6cb1ff7fe4 [Utils][x86] add an option to reduce scrubbing of shuffles with memops
I was drafting a patch that would increase broadcast load usage,
but our shuffle scrubbing makes it impossible to see if the memory
operand offset was getting created correctly. I'm proposing to make
that an option (defaulted to 'off' for now to reduce regression
test churn).

The updated files provide examples of tests where we can now verify
that the pointer offset for a loaded memory operand is correct. We
still have stack and constant scrubbing that can obscure the operand
even if we don't scrub the entire instruction.

Differential Revision: https://reviews.llvm.org/D74775
2020-02-20 09:33:05 -05:00
Simon Pilgrim
c00ec168b5 [UpdateTestChecks] Add support for '.' in ir function names
Will let us regenerate from amdgpu float constant tests
2020-02-19 18:58:44 +00:00
Johannes Doerfert
824188d4da [Utils] Allow "on-the-fly" argument changes for update_test_check scripts
Update test scripts were limited because they performed a single action
on the entire file and if that action was controlled by arguments, like
the one introduced in D68819, there was no record of it.

This patch introduces the capability of changing the arguments passed to
the script "on-the-fly" while processing a test file. In addition, an
"on/off" switch was added so that processing can be disabled for parts
of the file where the content is simply copied. The last extension is a
record of the invocation arguments in the auto generated NOTE. These
arguments are also picked up in a subsequent invocation, allowing
updates with special options enabled without user interaction.

To change the arguments the string `UTC_ARGS:` has to be present in a
line, followed by "additional command line arguments". That is
everything that follows `UTC_ARGS:` will be added to a growing list
of "command line arguments" which is reparsed after every update.

Reviewed By: arichardson

Differential Revision: https://reviews.llvm.org/D69701
2020-02-11 16:29:46 -06:00
James Y Knight
c5ea5f2943 update_test_checks: match CHECK-EMPTY lines for replacement.
In a8a89c77ea3c16b45763fca6940bbfd3bef7884f, the script started adding
CHECK-EMPTY lines, but the regex for which lines to replace was not
updated.
2020-01-02 12:17:37 -05:00
Johannes Doerfert
d2f438d283 [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
2019-12-31 02:35:18 -06:00
Johannes Doerfert
5396197fa0 [Utils] Reuse argument variable names in the body
If we have `int foo(int a) { return a; }` and we run with --function-signature
enabled, we want a single variable declaration for `a` which is reused
later.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D69722
2019-12-31 01:58:36 -06:00
Johannes Doerfert
ab978d2cdd [Utils] Allow update_test_checks to scrub attribute annotations
Attribute annotations on calls, e.g., #0, are not useful on their own.
This patch adds a flag to update_test_checks.py to scrub them.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D68851
2019-12-31 01:51:22 -06:00
Alex Richardson
e5b5d732ec [UpdateTestChecks] Fix parsing of RUN: lines with line continuations
I accidentally broke this in d9542db49e90457de62af3bfe395aaf4c47b68a5 due
to incorrectly placed parentheses.
2019-12-03 08:24:48 +00:00
Alex Richardson
d1d332153d [update_cc_test_checks.py] Use CHECK_RE from common
Summary:
This change modifies the common.CHECK_RE regex to also handle '//'
comment prefixes which allows us to share it between clang and IR tests.
Using the regex from common means that *-SAME lines are also stripped
now. Before this change using the --function-signature flag would result
in -SAME: lines from previous runs not being removed.

Reviewers: MaskRay, jdoerfert

Reviewed By: jdoerfert

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70890
2019-12-02 18:18:47 +00:00
Alex Richardson
3ab7b9b96f [UpdateTestChecks] Share the code to parse RUN: lines between all scripts
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
2019-12-02 11:06:30 +00:00
Alex Richardson
b8a003f5ca [UptestTestChecks][NFC] Share some common command line options code
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
2019-11-20 13:23:26 +00:00
Johannes Doerfert
904ec54f8e [Utils] Hide the default behavior change of D68819 under a flag
With D69701, the options used when running the script on a file will be
recorded and reused on a rerun. This allows us to hide new features
behind flags, starting with the "define" that was introduced in D68819.
2019-11-01 11:34:00 -05:00
Simon Atanasyan
63c8773887 [utils] Reflow asm check generation to tolerate blank lines
This change introduces two fixes. The second fix allows to generate
a test to check the first fix.

- Output `CHECK-EMPTY` prefix for an empty line in ASM output. Before that
  fix `update_llc_test_checks.py` incorrectly emits `CHECK-NEXT: <space>`
  prefix.
- Fix the `ASM_FUNCTION_MIPS_RE` regex to stop on a real function
  epilogue not on an inline assembler prologue and include inline
  assembler code into a test.

Differential Revision: https://reviews.llvm.org/D47192
2019-11-01 09:42:48 +03:00
Johannes Doerfert
649bdfef2e [Utils][FIX] Unbreak update_XXX_test_checks after 3598b810029d
The users of build_function_body_dictionary and add_checks need to be
adjusted after the changes in UpdateTestChecks/common.py.
2019-10-31 13:43:27 -05:00
Johannes Doerfert
16ae1f547b [Utils] Allow update_test_checks to check function information
Summary:
This adds a switch to the update_test_checks that triggers arguments and
other function annotations, e.g., personality, to be present in the
check line. If not set, the behavior should be the same as before.
If arguments are recorded, their names are scrubbed from the IR to allow
merging.

This patch includes D68153.

Reviewers: lebedev.ri, greened, spatel, xbolva00, RKSimon, mehdi_amini

Subscribers: bollu, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68819
2019-10-30 20:40:42 -05:00
Alex Richardson
bc49add214 [UpdateTestChecks] Fix invalid python string escapes 2019-10-30 09:36:20 +00:00
David Greene
0a43648281 Allow update_test_checks.py to not scrub names.
Add a --preserve-names option to tell the script not to replace IR names.
Sometimes tests want those names.  For example if a test is looking for a
modification to an existing instruction we'll want to make the names.

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

llvm-svn: 373912
2019-10-07 14:37:20 +00:00
Sanjay Patel
b652f24f0d [UpdateTestChecks] add basic support for parsing msp430 asm
llvm-svn: 373605
2019-10-03 14:34:28 +00:00
David Bolvansky
0ca0595e45 [UpdateTestChecks] Update tests option
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
2019-08-07 14:44:50 +00:00
Simon Pilgrim
18a1548ed6 [UpdateTestChecks] Add end_function directive to regex matcher for wasm32 function body
llvm-svn: 367786
2019-08-04 16:28:37 +00:00
David Bolvansky
7065b45db3 [UpdateTestChecks] Emit warning when invalid value for -check-prefix(es) option
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
2019-07-29 17:41:00 +00:00
Fangrui Song
e85621ae56 [utils] Clean up UpdateTestChecks/common.py
llvm-svn: 366664
2019-07-22 04:59:01 +00:00
Alex Bradbury
5c30999a59 [UpdateTestChecks] Skip over .Lfunc_begin for RISC-V
This mirrors the change made for X86 in rL336987. Without this patch,
update_llc_test_checks will completely skip functions with personality
functions.

llvm-svn: 365297
2019-07-08 08:34:16 +00:00
Jinsong Ji
94bc407832 [UpdateTestChecks][PowerPC] Avoid empty string when scrubbing loop comments
Summary:
SCRUB_LOOP_COMMENT_RE was introduced in https://reviews.llvm.org/D31285
This works for some loops.

However, we may generate lines with loop comments only.
And since we don't scrub leading white spaces, this will leave an empty
line there, and FileCheck will complain it.

eg: llvm/test/CodeGen/PowerPC/PR35812-neg-cmpxchg.ll:27:15:
error: found empty check string with prefix 'CHECK:'
; CHECK-NEXT:

This prevented us from using the `update_llc_test_checks.py` for quite some cases.

We should still keep the comment token there, so that we can safely
scrub the loop comment without breaking FileCheck.

Reviewers: timshen, hfinkel, lebedev.ri, RKSimon

Subscribers: nemanjai, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 364775
2019-07-01 14:37:48 +00:00
Jinsong Ji
d8b5b763b2 [UpdateChecks] Add support for armv7-apple-darwin
armv7-apple-darwin was not supported well, the script can't generate
checks.

https://reviews.llvm.org/D60601/new/#inline-568671

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

llvm-svn: 364668
2019-06-28 18:07:19 +00:00
Jinsong Ji
567b20e96f [UpdateTestChecks][NFC] Remove entries with same prefix
Matching is 'lossy', triples with same prefix can be dropped.

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

llvm-svn: 364471
2019-06-26 20:35:19 +00:00
Jinsong Ji
17dfc77db2 [PowerPC][UpdateTestChecks] powerpc- triple support
There are quite some old testcases with powerpc- triple,
we should add this triple support so that we can update them with script.

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

llvm-svn: 364213
2019-06-24 18:00:34 +00:00
Diogo N. Sampaio
66545ae9c9 [NFC] Improve triple match of scripts that update tests
Summary:
The prior behavior of the triple matcher would stop
in the first matched triple. It was not possible to
create specific matches for sub-sets of a triple
(e.g aarch64-apple-darwin would never be used after
aarch64 was matched).

This patch:
1) Allows that specialized triples take priority,
considering that the string lenght of the triple
indentifies how specialized a triple is. If two
triples of same lenght match, the one matched first
prevails, preserving the old behavior.

2) Remove 20 duplicated triples of arm, thumb,
aarch64 options with same arguments, matching
the common prefix (aarch64, arm, thumb) of them.

3) Creates three new function matching regexes and
five triple options for arm64-apple-ios,
(arm|thumb)-apple-ios and thumb(v5)?-macho

Reviewers: lebedev.ri, RKSimon, MaskRay, gbedwell

Reviewed By: MaskRay

Subscribers: javed.absar, kristof.beyls, llvm-commits, carwil

Tags: #llvm

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

llvm-svn: 363656
2019-06-18 10:04:36 +00:00
Matt Arsenault
d4b5b30e5d UpdateTestChecks: Consider .section as end of function for AMDGPU
Kernels seem to go directly to a section switch instead of emitting
.Lfunc_end. This fixes including all of the kernel metadata in the
check lines, which is undesirable most of the time.

llvm-svn: 363452
2019-06-14 20:40:15 +00:00
Roman Lebedev
169313ec4b UpdateTestChecks: hexagon support
Summary:
These tests are being affected by an upcoming patch,
so having an understandable (autogenerated) diff is helpful.

This target, again, prefers `-march`:
```
llvm/test/CodeGen/Hexagon$ grep -r triple | wc -l
467
llvm/test/CodeGen/Hexagon$ grep -r march | wc -l
1167
```

Reviewers: RKSimon, kparzysz

Reviewed By: kparzysz

Subscribers: xbolva00, llvm-commits

Tags: #llvm

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

llvm-svn: 362605
2019-06-05 14:08:01 +00:00
Simon Pilgrim
828a13e476 [UpdateTestChecks] Add support for -march=r600 to match existing -march=amdgcn support
llvm-svn: 362228
2019-05-31 15:05:06 +00:00