1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
Commit Graph

128 Commits

Author SHA1 Message Date
Joel E. Denny
5617b5612e [UpdateCCTestChecks] Implement --global-hex-value-regex
For example, in OpenMP offload codegen tests, global variables like
`.offload_maptypes*` are much easier to read in hex.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D104743
2021-07-20 11:23:20 -04:00
Joel E. Denny
2be8d8a8b3 [UpdateCCTestChecks] Implement --global-value-regex
`--check-globals` activates checks for all global values, and
`--global-value-regex` filters them.  For example, I'd like to use it
in OpenMP offload codegen tests to check only global variables like
`.offload_maptypes*`.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D104742
2021-07-20 11:23:20 -04:00
Joel E. Denny
6ae82bea96 [UpdateCCTestChecks] Support --check-globals
This option is already supported by update_test_checks.py, but it can
also be useful in update_cc_test_checks.py.  For example, I'd like to
use it in OpenMP offload codegen tests to check global variables like
`.offload_maptypes*`.

Reviewed By: jdoerfert, arichardson, ggeorgakoudis

Differential Revision: https://reviews.llvm.org/D104714
2021-06-25 13:17:56 -04:00
Joel E. Denny
c4a535aaff [UpdateCCTestChecks][NFC] Permit other comments in common.py
Some parts of common.py already permit comment styles besides `;`.
Handle the remaining cases.  Specifically, a future patch will extend
update_cc_test_checks.py to call add_global_checks.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D104713
2021-06-23 11:12:42 -04:00
Roman Lebedev
3b18af59bd [NFC][ARM] Fix update_llc_test_checks for thumbv7-apple-darwin, autogenerate thumb2-ifcvt1.ll 2021-06-23 16:31:19 +03:00
Roman Lebedev
033b3a9ef6 [NFC][ARM] Fix update_llc_test_checks for aarch64-apple-ios/thumbv7s-apple-darwin, autogenerate a few tests 2021-06-23 16:31:19 +03:00
Roman Lebedev
4e033a7fbd [NFC][ARM] Fix update_llc_test_checks for thumbv7-apple-ios, autogenerate switch-minsize.ll 2021-06-23 16:31:19 +03:00
Roman Lebedev
06e1305748 [NFC][ARM] Fix update_llc_test_checks for armv7-apple-ios, autogenerate ifcvt5.ll/ifcvt6.ll 2021-06-23 16:31:19 +03:00
Joel E. Denny
43ea08452a [UpdateCCTestChecks] Fix --replace-value-regex across RUN lines
Without this patch, llvm/utils/update_cc_test_checks.py fails to
perform `--replace-value-regex` replacements when two RUN lines
produce the same output and use the same single FileCheck prefix.  The
problem is that replacements in a RUN line's output are not performed
until after comparing against previous RUN lines' output, where
replacements have already been performed.  This patch fixes that.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D104566
2021-06-21 17:01:17 -04:00
Roman Lebedev
9acde4873f [UpdateTestUtils] Print test filename when complaining about conflicting prefix
Now that FileCheck eagerly complains when prefixes are unused,
the update script does the same, and  is becoming very common
to need to drop some prefixes, yet figuring out the file
it complains about isn't obvious unless it actually tells us.
2021-06-20 14:12:39 +03:00
Fangrui Song
4f8014aa66 [UpdateTestChecks] Default --x86_scrub_rip to False
True is a bad default: the useful symbol names and `@GOTPCREL` are scrubbed.

Change the default and add global variable tests to x86-basic.ll
(renamed from x86_function_name.ll since we now also test variables).
I updated some tests to show the differences.

Updated LCPI regex to include Darwin style `LCPI_[0-9]+_[0-9]+` (no
leading dot).

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D102588
2021-05-21 19:26:15 -07:00
Giorgis Georgakoudis
f8c111d015 [Utils][NFC] Rename replace-function-regex in update_cc_test_checks
This patch renames the replace-function-regex to replace-value-regex to indicate that the existing regex replacement functionality can replace any IR value besides functions.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D101934
2021-05-05 14:19:30 -07:00
Giorgis Georgakoudis
a7fe8f828d [Utils] Add prof metadata to matched unnamed values
Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D101742
2021-05-03 15:15:34 -07:00
Alex Richardson
14442d2503 [update_(llc_)test_checks.py] Support pre-processing commands
This has been rather useful in our downstream CHERI target where we want
to run tests both with addrspace(0) and addrspace(200) pointers.
With this patch we can prefix the opt command with
`sed -e 's/addrspace(200)/addrspace(0)/g' -e 's/-A200-P200-G200//g'` to
test both cases using the same IR input.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D95137
2021-04-28 12:19:19 +01:00
Craig Topper
6e75027132 [X86][update_llc_test_checks] Use a less greedy regular expression for replacing constant pool labels in tests.
While working on D97208 I noticed that these greedy regular
expressions prevent tests from failing when (%rip) appears after
a constant pool label when it didn't before.

Reviewed By: RKSimon, pengfei

Differential Revision: https://reviews.llvm.org/D99460
2021-03-28 11:39:46 -07:00
Giorgis Georgakoudis
440b1626f9 [Utils] Add prefix parameter in update test checks to avoid FileCheck conflicts
IR values convert to check prefix FileCheck variables for IR checks. For example, nameless values, e.g., %0, convert to check prefix TMP FileCheck variables, e.g., [[TMP0:%.*]]. This check prefix may clash with named values that have the same name and that causes auto-generated tests to fail. Currently a warning is emitted to change the names of the IR values but this is not always possible, if for example they are generated by clang. Manual intervention to fix the FileCheck variable names is too tedious. This patch add a parameter to prefix conflicting FileCheck variable names with a user-provided string to automate the process.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D99415
2021-03-26 11:49:42 -07:00
Giorgis Georgakoudis
88425e7fcb [Utils][NFC] Fix regex substitution for update test checks
Relates to: https://reviews.llvm.org/D97107
2021-03-24 17:47:33 -07:00
Thomas Preud'homme
13d71df2c0 [UpdateTestChecks] Fix typo & copy/paste in comments 2021-03-24 16:11:36 +00:00
Giorgis Georgakoudis
4a11d40768 Replace func name with regex for update test scripts
The patch adds an argument to update test scripts, such as update_cc_test_checks, for replacing a function name matching a regex. This functionality is needed to match generated function signatures that include file hashes. Example:

The function signature for the following function:

`__omp_offloading_50_b84c41e__Z9ftemplateIiET_i_l30_worker`

with `--replace-function-regex "__omp_offloading_[0-9]+_[a-z0-9]+_(.*)"` will become:

`CHECK-LABEL: @{{__omp_offloading_[0-9]+_[a-z0-9]+__Z9ftemplateIiET_i_l30_worker}}(`

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D97107
2021-03-12 17:37:09 -08:00
Giorgis Georgakoudis
e6336f29c7 Revert "Replace func name with regex for update test scripts"
This reverts commit 5eaf70afb5f8ae6789587e60d51c60f56caf18b0.
2021-03-12 17:20:00 -08:00
Giorgis Georgakoudis
d1a2f016e5 Replace func name with regex for update test scripts
The patch adds an argument to update test scripts, such as update_cc_test_checks, for replacing a function name matching a regex. This functionality is needed to match generated function signatures that include file hashes. Example:

The function signature for the following function:

`__omp_offloading_50_b84c41e__Z9ftemplateIiET_i_l30_worker`

with `--replace-function-regex "__omp_offloading_[0-9]+_[a-z0-9]+_(.*)"` will become:

`CHECK-LABEL: @{{__omp_offloading_[0-9]+_[a-z0-9]+__Z9ftemplateIiET_i_l30_worker}}(`

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D97107
2021-03-12 17:00:42 -08:00
Johannes Doerfert
6e9991eb47 [Utils] Check for more global information in update_test_checks
This allows to check for various globals (metadata/attributes/...) and
also resolves problems with globals (metadata/attributes/...) being
reused across different prefixes.

Reviewed By: sstefan1

Differential Revision: https://reviews.llvm.org/D94741
2021-03-11 23:31:16 -06:00
Giorgis Georgakoudis
8177520036 Revert "Replace func name with regex in update_cc_test_checks"
This reverts commit bf58d6a1f92244c797a280d318a56d7d3fc4a704.

Breaks tests, fix
2021-03-10 15:05:35 -08:00
Giorgis Georgakoudis
e54be5ca88 Replace func name with regex in update_cc_test_checks
The patch adds an argument to update_cc_test_checks for replacing a function name matching a regex. This functionality is needed to match generated function signatures that include file hashes. Example:

The function signature for the following function:

`__omp_offloading_50_b84c41e__Z9ftemplateIiET_i_l30_worker`

with `--replace-function-regex "__omp_offloading_[0-9]+_[a-z0-9]+_(.*)"` will become:

`CHECK-LABEL: @{{__omp_offloading_[0-9]+_[a-z0-9]+__Z9ftemplateIiET_i_l30_worker}}(`

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D97107
2021-03-10 12:57:35 -08:00
Min-Yih Hsu
33b1222ec6 [M68k][test](6/8) Add all of the tests
And a small utilities -- extract-section.py -- that helps extracting
specific object file section and printing in textual format. This
utility is just a workaround for tests inside `Encoding`. Hopefully in
the future we can replace dependencies in those tests with existing tools
(e.g. llvm-readobj). Please refer to this bug for more context:
https://bugs.llvm.org/show_bug.cgi?id=49245

Note that since we don't have AsmParser for now, we are testing the MC
part using MIR as input and put those tests under the `Encoding` folder.
In the future when AsmParser (and disassembler) is finished, those tests
will be moved to `test/MC/M68k`.

Authors: myhsu, m4yers, glaubitz

Differential Revision: https://reviews.llvm.org/D88392
2021-03-08 12:30:57 -08:00
Mircea Trofin
8e7a42d250 [NFC] Remove spurious ';' on return line in python code 2021-02-15 08:42:02 -08:00
Mircea Trofin
40d81c99e5 Revert "[Utils] Add a switch controlling prefix warnings in UpdateTestChecks"
This reverts commit 87f8a08ce36e5bc72f11129d2cf36b5848f86f63.
2021-02-08 11:21:56 -08:00
Mircea Trofin
ea66bf2f6b [Utils] Add a switch controlling prefix warnings in UpdateTestChecks
The switch controls both unused prefix warnings, and warnings about
functions which differ under different runs for a prefix, and, thus, end
up not having asserts for that prefix.

(If the latter case spans to all functions, then the former case kicks
in)

The switch is on by default, and can be disabled.

Differential Revision: https://reviews.llvm.org/D95829
2021-02-01 18:04:18 -08:00
Ben Shi
b6991ff67e [update_llc_test_checks] Support AVR
Reviewed By: arichardson

Differential Revision: https://reviews.llvm.org/D95240
2021-01-26 17:50:56 +08:00
Qiu Chaofan
c6098f661f [UpdateTestChecks] Fix PowerPC RE to support AIX assembly
Current update_llc_test_checks.py cannot generate checks for AIX
(powerpc64-ibm-aix-xcoff) properly. Assembly generated is little bit
different from Linux. So I use begin function comment here to capture
function name.

Reviewed By: MaskRay, steven.zhang

Differential Revision: https://reviews.llvm.org/D93676
2021-01-05 10:28:00 +08:00
Fangrui Song
e9c67e8f20 [update_llc_test_checks] Support Windows .seh_proc for x86 2020-12-30 12:32:47 -08:00
Fangrui Song
d0a0143df2 [update_llc_test_checks] Support .Lfunc$local for x86 -relocation-model=pic dsolocal tests 2020-12-30 11:59:36 -08:00
Mircea Trofin
a76e040629 [NFC][utils] Factor remaining APIs under FunctionTestBuilder
Finishing the refactoring started in D93413.

Differential Revision: https://reviews.llvm.org/D93506
2020-12-17 22:13:14 -08:00
Mircea Trofin
f7ea2a809e [NFC] factor update test function test builder as a class
This allows us to have shared logic over multiple test runs, e.g. do we
have unused prefixes, or which function bodies have conflicting outputs
for a prefix appearing in different RUN lines.

This patch is just wrapping existing functionality, and replacing its uses.
A subsequent patch would then fold the current functionality into the newly
introduced class.

Differential Revision: https://reviews.llvm.org/D93413
2020-12-16 21:12:06 -08:00
Mircea Trofin
a3554dd52a [utils] The func_dict for a prefix may just be empty
Follow up from D92965 - since we try to find failed prefixes
after each RUN line, it's possible the whole list of functions for a
prefix be non-existent, which is fine - this happens when none of the
RUN lines seen so far used the prefix.
2020-12-15 08:48:37 -08:00
Mircea Trofin
03a62f3073 [utils] Fix UpdateTestChecks case where 2 runs differ for last label
Two RUN lines produce outputs that, each, have some common parts and
some different parts. The common parts are checked under label A. The
differing parts are associated to a function and checked under labels B
and C, respectivelly.
When build_function_body_dictionary is called for the first RUN line, it
will attribute the function body to labels A and C. When the second RUN
is passed to build_function_body_dictionary, it sees that the function
body under A is different from what it has. If in this second RUN line,
A were at the end of the prefixes list, A's body is still kept
associated with the first run's function.

When we output the function body (i.e. add_checks), we stop after
emitting for the first prefix matching that function. So we end up with
the wrong function body (first RUN's A-association).

There is no reason to special-case the last label in the prefixes list,
and the fix is to always clear a label association if we find a RUN line
where the body is different.

Differential Revision: https://reviews.llvm.org/D93078
2020-12-15 07:16:54 -08:00
Harald van Dijk
90e4a4c68b [UpdateTestChecks] Add --(no-)x86_scrub_sp option.
This makes it possible to use update_llc_test_checks to manage tests
that check for incorrect x86 stack offsets. It does not yet modify any
test to make use of this new option.
2020-12-12 17:11:13 +00:00
Ahmed Bougacha
fe6a3c2668 [Triple][MachO] Define "arm64e", an AArch64 subarch for Pointer Auth.
This also teaches MachO writers/readers about the MachO cpu subtype,
beyond the minimal subtype reader support present at the moment.

This also defines a preprocessor macro to allow users to distinguish
__arm64__ from __arm64e__.

arm64e defaults to an "apple-a12" CPU, which supports v8.3a, allowing
pointer-authentication codegen.
It also currently defaults to ios14 and macos11.

Differential Revision: https://reviews.llvm.org/D87095
2020-12-03 07:53:59 -08:00
Nico Weber
6640720520 clang: Make changes in 7c8bb409f31e py2.7-compatible 2020-09-18 16:15:37 -04:00
David Greene
6628767888 [UpdateCCTestChecks] Include generated functions if asked
Add the --include-generated-funcs option to update_cc_test_checks.py so that any
functions created by the compiler that don't exist in the source will also be
checked.

We need to maintain the output order of generated function checks so that
CHECK-LABEL works properly.  To do so, maintain a list of functions output for
each prefix in the order they are output.  Use this list to output checks for
generated functions in the proper order.

Differential Revision: https://reviews.llvm.org/D83004
2020-09-18 06:34:59 -05:00
David Greene
eb1409d08e [UpdateTestChecks] Allow $ in function names
Some compilers generation functions with '$' in their names, so recognize those
functions.

This also requires recognizing function names inside quotes in some contexts in
order to escape certain characters.

Differential Revision: https://reviews.llvm.org/D82995
2020-09-16 14:34:18 -05:00
Johannes Doerfert
c187f80294 [UpdateTestChecks][NFC] Fix spelling 2020-09-16 13:37:08 -05:00
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