1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

7939 Commits

Author SHA1 Message Date
Joel E. Denny
2c2c40daf4 [lit] Try again to fix new tests that fail on Windows bots
Based on the bot logs, when lit's internal diff runs on Windows, it
looks like binary diffs must be decoded also for Python 2.7.
Otherwise, writing the diff to stdout fails with:

```
UnicodeEncodeError: 'ascii' codec can't encode characters in position 7-8: ordinal not in range(128)
```

I did not need to decode using Python 2.7.15 under Ubuntu.  When I do
it anyway in that case, `errors="backslashreplace"` fails for me:

```
TypeError: don't know how to handle UnicodeDecodeError in error callback
```

However, `errors="ignore"` works, so this patch uses that, hoping
it'll work on Windows as well.

This patch leaves `errors="backslashreplace"` for Python >= 3.5 as
there's no evidence yet that doesn't work and it produces more
informative binary diffs.  This patch also adjusts some lit tests to
succeed for either error handler.

This patch adjusts changes introduced by D68664.

llvm-svn: 374657
2019-10-12 14:58:43 +00:00
Joel E. Denny
c7a6363e4e Revert r374654: "[lit] Try to fix new tests that fail on Windows bots"
llvm-svn: 374656
2019-10-12 14:58:30 +00:00
Joel E. Denny
54241b4586 [lit] Try to fix new tests that fail on Windows bots
llvm-svn: 374654
2019-10-12 13:08:21 +00:00
Joel E. Denny
4e060cb8b6 [lit] Fix a few oversights in r374651 that broke some bots
llvm-svn: 374653
2019-10-12 12:32:00 +00:00
Joel E. Denny
f27acb89d1 [lit] Fix internal diff's --strip-trailing-cr and use it
Using GNU diff, `--strip-trailing-cr` removes a `\r` appearing before
a `\n` at the end of a line.  Without this patch, lit's internal diff
only removes `\r` if it appears as the last character.  That seems
useless.  This patch fixes that.

This patch also adds `--strip-trailing-cr` to some tests that fail on
Windows bots when D68664 is applied.  Based on what I see in the bot
logs, I think the following is happening.  In each test there, lit
diff is comparing a file with `\r\n` line endings to a file with `\n`
line endings.  Without D68664, lit diff reads those files with
Python's universal newlines support activated, causing `\r` to be
dropped.  However, with D68664, lit diff reads the files in binary
mode instead and thus reports that every line is different, just as
GNU diff does (at least under Ubuntu).  Adding `--strip-trailing-cr`
to those tests restores the previous behavior while permitting the
behavior of lit diff to be more like GNU diff.

Reviewed By: rnk

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

llvm-svn: 374652
2019-10-12 11:58:30 +00:00
Joel E. Denny
57c8d7e7d7 Reland r374392: [lit] Extend internal diff to support -U
To avoid breaking some tests, D66574, D68664, D67643, and D68668
landed together.  However, D68664 introduced an issue now addressed by
D68839, with which these are now all relanding.

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

llvm-svn: 374651
2019-10-12 11:58:03 +00:00
Joel E. Denny
c9e5247388 Reland r374390: [lit] Extend internal diff to support - argument
To avoid breaking some tests, D66574, D68664, D67643, and D68668
landed together.  However, D68664 introduced an issue now addressed by
D68839, with which these are now all relanding.

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

llvm-svn: 374650
2019-10-12 11:57:41 +00:00
Joel E. Denny
9fc517081f Reland r374389: [lit] Clean up internal diff's encoding handling
To avoid breaking some tests, D66574, D68664, D67643, and D68668
landed together.  However, D68664 introduced an issue now addressed by
D68839, with which these are now all relanding.

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

llvm-svn: 374649
2019-10-12 11:57:20 +00:00
Joel E. Denny
c14a613f67 Reland r374388: [lit] Make internal diff work in pipelines
To avoid breaking some tests, D66574, D68664, D67643, and D68668
landed together.  However, D68664 introduced an issue now addressed by
D68839, with which these are now all relanding.

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

llvm-svn: 374648
2019-10-12 11:56:57 +00:00
Martin Storsjo
1f4415f55d [lit] Remove setting of the target-windows feature
No other OSes use a target-<os> feature, and no tests depend on it
any lomger.

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

llvm-svn: 374639
2019-10-12 06:40:24 +00:00
Nico Weber
28d3266ff9 gn build: (manually) merge r374606 better
llvm-svn: 374611
2019-10-11 23:22:36 +00:00
GN Sync Bot
adce698aaa gn build: Merge r235758
llvm-svn: 374610
2019-10-11 23:12:04 +00:00
Nico Weber
99ffec2f44 gn build: Cmanually) merge r374590
llvm-svn: 374608
2019-10-11 23:05:24 +00:00
Julian Lettner
90fe48ddb1 [lit] Small cleanups in main.py
* Extract separate function for running tests from main
* Push single-usage imports to point of usage
* Remove unnecessary sys.exit(0) calls

Reviewed By: rnk

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

llvm-svn: 374602
2019-10-11 21:57:09 +00:00
Julian Lettner
7efdea3492 [lit] Change regex filter to ignore case
Make regex filter `--filter=REGEX` option more lenient via
`re.IGNORECASE`.

Reviewed By: yln

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

llvm-svn: 374601
2019-10-11 21:57:06 +00:00
Nico Weber
4645e6d90c gn build: (manually) merge r374110
llvm-svn: 374575
2019-10-11 17:42:24 +00:00
GN Sync Bot
e5fe136dc8 gn build: Merge r374558
llvm-svn: 374560
2019-10-11 14:48:31 +00:00
Kai Nacke
f65b9d0379 [FileCheck] Implement --ignore-case option.
The FileCheck utility is enhanced to support a `--ignore-case`
option. This is useful in cases where the output of Unix tools
differs in case (e.g. case not specified by Posix).

Reviewers: Bigcheese, jakehehrlich, rupprecht, espindola, alexshap, jhenderson, MaskRay

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

llvm-svn: 374538
2019-10-11 11:59:14 +00:00
QingShan Zhang
e50b92cbce [TableGen] Fix a bug that MCSchedClassDesc is interfered between different SchedModel
Assume that, ModelA has scheduling resource for InstA and ModelB has scheduling resource for InstB. This is what the llvm::MCSchedClassDesc looks like:

llvm::MCSchedClassDesc ModelASchedClasses[] = {
...
InstA, 0, ...
InstB, -1,...
};

llvm::MCSchedClassDesc ModelBSchedClasses[] = {
...
InstA, -1,...
InstB, 0,...
};
The -1 means invalid num of macro ops, while it is valid if it is >=0. This is what we look like now:

llvm::MCSchedClassDesc ModelASchedClasses[] = {
...
InstA, 0, ...
InstB, 0,...
};

llvm::MCSchedClassDesc ModelBSchedClasses[] = {
...
InstA, 0,...
InstB, 0,...
};
And compiler hit the assertion here because the SCDesc is valid now for both InstA and InstB.

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

llvm-svn: 374524
2019-10-11 08:36:54 +00:00
GN Sync Bot
66fee5e609 gn build: Merge r374476
llvm-svn: 374482
2019-10-10 23:49:59 +00:00
Julian Lettner
55783a412b [lit] Break main into smaller functions
This change is purely mechanical.  I will do further cleanups of
parameter usages.

Reviewed By: rnk

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

llvm-svn: 374452
2019-10-10 21:24:41 +00:00
Julian Lettner
3804b50d83 [lit] Add comment explaining the LIT_OPTS env var overrides command line options
Normally, command line options override environment variables.  Add
comment to state that we are doing the reverse on purpose.

llvm-svn: 374441
2019-10-10 20:23:28 +00:00
Julian Lettner
f3c91b5401 [lit] Bring back --threads option alias
Bring back `--threads` option which was lost in the move of the
command line argument parsing code to cl_arguments.py.  Update docs
since `--workers` is preferred.

llvm-svn: 374432
2019-10-10 19:43:57 +00:00
Joel E. Denny
ba60d540ee Revert r374388: "[lit] Make internal diff work in pipelines"
This breaks a Windows bot.

llvm-svn: 374429
2019-10-10 19:25:39 +00:00
Joel E. Denny
3276ea0ee1 Revert r374389: "[lit] Clean up internal diff's encoding handling"
This breaks a Windows bot.

llvm-svn: 374427
2019-10-10 19:25:24 +00:00
Joel E. Denny
f913d299b3 Revert r374390: "[lit] Extend internal diff to support - argument"
This breaks a Windows bot.

llvm-svn: 374426
2019-10-10 19:25:11 +00:00
Joel E. Denny
58b08e30e4 Revert r374392: "[lit] Extend internal diff to support -U"
This breaks a Windows bot.

llvm-svn: 374425
2019-10-10 19:24:57 +00:00
Julian Lettner
d563d768c2 [lit] Leverage argparse features to remove some code
Reviewed By: rnk, serge-sans-paille

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

llvm-svn: 374405
2019-10-10 18:03:37 +00:00
Julian Lettner
a744b18634 [lit] Move argument parsing/validation to separate file
Reviewed By: serge-sans-paille

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

llvm-svn: 374400
2019-10-10 17:58:38 +00:00
Nico Weber
b337fb8fb1 gn build: restore tablegen restat optimization after r373664
llvm-svn: 374395
2019-10-10 17:47:18 +00:00
Joel E. Denny
f9b6fc5126 [lit] Extend internal diff to support -U
When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff -U1 file -
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` doesn't
recognize `-U` as a command-line option.  This patch adds `-U`
support.

Reviewed By: rnk

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

llvm-svn: 374392
2019-10-10 17:40:12 +00:00
Nico Weber
4ec7ef2a3a gn build: merge r374381 more (effectively a no-op)
llvm-svn: 374391
2019-10-10 17:40:00 +00:00
Joel E. Denny
01cd19bfb8 [lit] Extend internal diff to support - argument
When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff file -
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` doesn't
recognize `-` as a command-line option.  This patch adds support for
`-` to mean stdin.

Reviewed By: probinson, rnk

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

llvm-svn: 374390
2019-10-10 17:39:57 +00:00
Joel E. Denny
adfa3a9471 [lit] Clean up internal diff's encoding handling
As suggested by rnk at D67643#1673043, instead of reading files
multiple times until an appropriate encoding is found, read them once
as binary, and then try to decode what was read.

For python >= 3.5, don't fail when attempting to decode the
`diff_bytes` output in order to print it.

Finally, add some tests for encoding handling.

Reviewed By: rnk

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

llvm-svn: 374389
2019-10-10 17:39:41 +00:00
Joel E. Denny
3ba08ebf8d [lit] Make internal diff work in pipelines
When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff file -
 # RUN: not diff file1 file2 | FileCheck %s
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` cannot
currently be used in pipelines and doesn't recognize `-` as a
command-line option.

To enable pipelines, this patch moves lit's `diff` implementation into
an out-of-process script, similar to lit's `cat` implementation.  A
follow-up patch will implement `-` to mean stdin.

Reviewed By: probinson, stella.stamenova

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

llvm-svn: 374388
2019-10-10 17:39:24 +00:00
GN Sync Bot
acb0135aa6 gn build: Merge r374381
llvm-svn: 374383
2019-10-10 17:14:20 +00:00
Dmitri Gribenko
0c3e83e627 Revert "[FileCheck] Implement --ignore-case option."
This reverts commit r374339. It broke tests:
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/19066

llvm-svn: 374359
2019-10-10 14:27:14 +00:00
Kai Nacke
28535e7629 [FileCheck] Implement --ignore-case option.
The FileCheck utility is enhanced to support a `--ignore-case`
option. This is useful in cases where the output of Unix tools
differs in case (e.g. case not specified by Posix).

Reviewers: Bigcheese, jakehehrlich, rupprecht, espindola, alexshap, jhenderson, MaskRay

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

llvm-svn: 374339
2019-10-10 13:15:41 +00:00
Simon Tatham
927a8eed5c [update_cc_test_checks] Support 'clang | opt | FileCheck'
Some clang lit tests use a pipeline of the form

// RUN: %clang [args] -O0 %s | opt [specific optimizations] | FileCheck %s

to make the expected test output depend on as few optimization phases
as possible, for stability. But when you write a RUN line of this
form, you lose the ability to use update_cc_test_checks.py to
automatically generate the expected output, because it only supports
two-stage pipelines consisting of '%clang | FileCheck' (or %clang_cc1).

This change extends the set of supported RUN lines so that pipelines
with an invocation of `opt` in the middle can still be automatically
handled.

To implement it, I've adjusted `get_function_body()` so that it can
cope with an arbitrary sequence of intermediate pipeline commands. But
the code that decides which RUN lines to consider is more
conservative: it only adds clang | opt | FileCheck to the set of
supported lines, because I didn't want to accidentally include some
other kind of line that doesn't output IR at all.

(Also in this commit is the minimal change to make this script work at
all, after r373912 added an extra parameter to `add_ir_checks`.)

Reviewers: MaskRay, xbolva00

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 374287
2019-10-10 08:25:34 +00:00
GN Sync Bot
275cbdf702 gn build: Merge r374277
llvm-svn: 374278
2019-10-10 04:29:49 +00:00
Nico Weber
edd0e82a9b gn build: (manually) merge r374271
llvm-svn: 374272
2019-10-10 02:48:47 +00:00
GN Sync Bot
83375fb2e2 gn build: Merge r374245
llvm-svn: 374260
2019-10-09 23:10:49 +00:00
Nico Weber
7342fc9534 gn build: (manually) merge r374219
llvm-svn: 374249
2019-10-09 22:22:36 +00:00
Julian Lettner
6485fb95d4 [lit] Refactor ProgressDisplay
Move progress display to separate file.  Simplify some code paths.
Decouple from other components via progress callback.  Remove unused
`_Display` class.

Reviewed By: serge-sans-paille

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

llvm-svn: 374194
2019-10-09 18:23:30 +00:00
James Molloy
b8dff35c25 [TableGen] Fix crash when using HwModes in CodeEmitterGen
When an instruction has an encoding definition for only a subset of
the available HwModes, ensure we just avoid generating an encoding
rather than crash.

llvm-svn: 374150
2019-10-09 09:15:34 +00:00
Hans Wennborg
70269b4845 Unify the two CRC implementations
David added the JamCRC implementation in r246590. More recently, Eugene
added a CRC-32 implementation in r357901, which falls back to zlib's
crc32 function if present.

These checksums are essentially the same, so having multiple
implementations seems unnecessary. This replaces the CRC-32
implementation with the simpler one from JamCRC, and implements the
JamCRC interface in terms of CRC-32 since this means it can use zlib's
implementation when available, saving a few bytes and potentially making
it faster.

JamCRC took an ArrayRef<char> argument, and CRC-32 took a StringRef.
This patch changes it to ArrayRef<uint8_t> which I think is the best
choice, and simplifies a few of the callers nicely.

Differential revision: https://reviews.llvm.org/D68570

llvm-svn: 374148
2019-10-09 09:06:30 +00:00
Nico Weber
6aa0bc0789 gn build: unbreak libcxx build after r374116 by restoring gen_link_script.py for gn
llvm-svn: 374129
2019-10-08 23:08:18 +00:00
Daniel Sanders
a562501cd0 [tblgen] Add getOperatorAsDef() to Record
Summary:
While working with DagInit's, it's often the case that you expect the
operator to be a reference to a def. This patch adds a wrapper for this
common case to reduce the amount of boilerplate callers need to duplicate
repeatedly.

getOperatorAsDef() returns the record if the DagInit has an operator that is
a DefInit. Otherwise, it prints a fatal error.

There's only a few pre-existing examples in LLVM at the moment and I've
left a few instances of the code this simplifies as they had more specific
error messages than the generic one this produces. I'm going to be using
this a fair bit in my subsequent patches.

Reviewers: bogner, volkan, nhaehnle

Reviewed By: nhaehnle

Subscribers: nhaehnle, hiraditya, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, lenary, s.egerton, pzheng, llvm-commits

Tags: #llvm

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

llvm-svn: 374101
2019-10-08 18:41:32 +00:00
David Greene
bea2f8fa2d [UpdateCCTestChecks] Detect function mangled name on separate line
Sometimes functions with large comment blocks in front of them have their
declarations output on several lines by c-index-test.  Hence the one-line
function name/line/mangled pattern will not work to detect them.  Break the
pattern up into two patterns and keep state after seeing the name/line
information until we finally see the mangled name.

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

llvm-svn: 374078
2019-10-08 16:25:42 +00:00
GN Sync Bot
c5067996f2 gn build: Merge r374062
llvm-svn: 374065
2019-10-08 15:34:52 +00:00