1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

6876 Commits

Author SHA1 Message Date
Nico Weber
cc3d32505c [gn build] Merge r347530 to gn.
llvm-svn: 347639
2018-11-27 06:04:49 +00:00
Nico Weber
3fa3a9903c Move a file I forgot to move in r347636.
llvm-svn: 347638
2018-11-27 05:49:08 +00:00
Nico Weber
32dd8bd084 [gn build] Create abi-breaking.h, config.h, llvm-config.h, and add a build file for llvm/lib/Support.
The comments at the top of
llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn and
llvm/utils/gn/build/write_cmake_config.py should explain the main bits
happening in this patch. The main parts here are that these headers are
generated at build time, not gn time, and that currently they don't do any
actual feature checks but just hardcode most things based on the current OS,
which seems to work well enough. If this stops being enough, the feature checks
should each be their own action writing the result to somewhere, and the config
write step should depend on those checks (so that they can run in parallel and
as part of the build) -- utils/llvm/gn/README.rst already has some more words
on that in "Philosophy".

(write_cmake_config.py is also going to be used to write clang's
clang/include/clang/Config/config.h)

This also adds a few files for linking to system libraries in a consistent way
if needed in llvm/utils/gn/build/libs (and moves pthread to that model).0

I'm also adding llvm/utils/gn/secondary/llvm/lib/Target/targets.gni in this
patch because $native_arch is needed for writing llvm-config.h -- the rest of
it will be used later, when the build files for llvm/lib/Target get added. That
file describes how to select which archs to build.

As a demo, also add a build file for llvm-undname and make it the default build
target (it depends on everything that can currently be built).

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

llvm-svn: 347636
2018-11-27 05:19:17 +00:00
Evandro Menezes
c46bcdb565 [TableGen] Emit more variant transitions
`llvm-mca` relies on the predicates to be based on `MCSchedPredicate` in order
to resolve the scheduling for variant instructions.  Otherwise, it aborts
the building of the instruction model early.

However, the scheduling model emitter in `TableGen` gives up too soon, unless
all processors use only such predicates.

In order to allow more processors to be used with `llvm-mca`, this patch
emits scheduling transitions if any processor uses these predicates.  The
transition emitted for the processors using legacy predicates is the one
specified with `NoSchedPred`, which is based on `MCSchedPredicate`.

Preferably, `llvm-mca` should instead assume a reasonable default when a
variant transition is not based on `MCSchedPredicate` for a given processor.
This issue should be revisited in the future.

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

llvm-svn: 347504
2018-11-23 21:17:33 +00:00
Peter Collingbourne
5e94e2fc8e Add a ubsan blacklist entry for libstdc++ 8.0.1.
llvm-svn: 347436
2018-11-21 23:04:39 +00:00
Reid Kleckner
dd0c93dcd8 Fix clang test suite on Windows by reverting part of r347216
Otherwise, the clang analyzer tests fail on Windows when attempting to
unpickle AnalyzerTest objects in the worker processes. The pattern of,
add to path, import, remove from path, serialize, deserialize, doesn't
work. Once something gets added to the path, if we want to move it
across the wire for multiprocessing, we need to keep the module on
sys.path.

llvm-svn: 347254
2018-11-19 19:36:28 +00:00
Zachary Turner
8d498b9044 Fix some issues with LLDB's lit configuration files.
Recently I tried to port LLDB's lit configuration files over to use a
on the surface, but broke some cases that weren't broken before and also
exposed some additional problems with the old approach that we were just
getting lucky with.

When we set up a lit environment, the goal is to make it as hermetic as
possible. We should not be relying on PATH and enabling the use of
arbitrary shell commands. Instead, only whitelisted commands should be
allowed. These are, generally speaking, the lit builtins such as echo,
cd, etc, as well as anything for which substitutions have been
explicitly set up for. These substitutions should map to the build
output directory, but in some cases it's useful to be able to override
this (for example to point to an installed tools directory).

This is, of course, how it's supposed to work. What was actually
happening is that we were bringing in PATH and LD_LIBRARY_PATH and then
just running the given run line as a shell command. This led to problems
such as finding the wrong version of clang-cl on PATH since it wasn't
even a substitution, and flakiness / non-determinism since the
environment the tests were running in would change per-machine. On the
other hand, it also made other things possible. For example, we had some
tests that were explicitly running cl.exe and link.exe instead of
clang-cl and lld-link and the only reason it worked at all is because it
was finding them on PATH. Unfortunately we can't entirely get rid of
these tests, because they support a few things in debug info that
clang-cl and lld-link don't (notably, the LF_UDT_MOD_SRC_LINE record
which makes some of the tests fail.

The high level changes introduced in this patch are:

1. Removal of functionality - The lit test suite no longer respects
   LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER. This means there is no
   more support for gcc, but nobody was using this anyway (note: The
   functionality is still there for the dotest suite, just not the lit test
   suite). There is no longer a single substitution %cxx and %cc which maps
   to <arbitrary-compiler>, you now explicitly specify the compiler with a
   substitution like %clang or %clangxx or %clang_cl. We can revisit this
   in the future when someone needs gcc.

2. Introduction of the LLDB_LIT_TOOLS_DIR directory. This does in spirit
   what LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER used to do, but now
   more friendly. If this is not specified, all tools are expected to be
   the just-built tools. If it is specified, the tools which are not
   themselves being tested but are being used to construct and run checks
   (e.g. clang, FileCheck, llvm-mc, etc) will be searched for in this
   directory first, then the build output directory.

3. Changes to core llvm lit files. The use_lld() and use_clang()
   functions were introduced long ago in anticipation of using them in
   lldb, but since they were never actually used anywhere but their
   respective problems, there were some issues to be resolved regarding
   generality and ability to use them outside their project.

4. Changes to .test files - These are all just replacing things like
   clang-cl with %clang_cl and %cxx with %clangxx, etc.

5. Changes to lit.cfg.py - Previously we would load up some system
   environment variables and then add some new things to them. Then do a
   bunch of work building out our own substitutions. First, we delete the
   system environment variable code, making the environment hermetic. Then,
   we refactor the substitution logic into two separate helper functions,
   one which sets up substitutions for the tools we want to test (which
   must come from the build output directory), and another which sets up
   substitutions for support tools (like compilers, etc).

6. New substitutions for MSVC -- Previously we relied on location of
   MSVC by bringing in the entire parent's PATH and letting
   subprocess.Popen just run the command line. Now we set up real
   substitutions that should have the same effect. We use PATH to find
   them, and then look for INCLUDE and LIB to construct a substitution
   command line with appropriate /I and /LIBPATH: arguments. The nice thing
   about this is that it opens the door to having separate %msvc-cl32 and
   %msvc-cl64 substitutions, rather than only requiring the user to run
   vcvars first. Because we can deduce the path to 32-bit libraries from
   64-bit library directories, and vice versa. Without these substitutions
   this would have been impossible.

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

llvm-svn: 347216
2018-11-19 15:12:34 +00:00
Nico Weber
de3429242c Add initial scaffolding for the GN build.
See "GN build roundtable summary; adding GN build files to the repo" on
llvm-dev and cfe-dev for discussion.

In particular, this build is completely unsupported. People adding new files to
LLVM are not expected to update the GN build files, and reviewers are not
supposed to request the gn build files to be updated.

This adds just enough to be able to build llvm/lib/Demangle. It requires using
a monorepo.

This adds a few build config options you can set in args.gn
(`gn args out/foo --list` for all):
- is_debug = true to enable debug builds (defaults to release)
- llvm_enable_assertions to toggle assertions (defaults to true)
- clang_base_path, if set an absolute path to a locally-built clang to be used
  as host compiler

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

llvm-svn: 347128
2018-11-17 02:21:53 +00:00
James Y Knight
d25837ed5d Make git-llvm python3 compatible again. Hopefully. :)
llvm-svn: 347113
2018-11-16 23:59:23 +00:00
James Y Knight
a089eed482 Speed up git-llvm script by only svn up'ing affected directories.
Also, support modifications to toplevel files in git (which need to be
committed to "monorepo-root" in svn).

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

llvm-svn: 347103
2018-11-16 22:36:17 +00:00
Vedant Kumar
d61070716c Mark @llvm.trap cold
A call to @llvm.trap can be expected to be cold (i.e. unlikely to be
reached in a normal program execution).

Outlining paths which unconditionally trap is an important memory
saving. As the hot/cold splitting pass (imho) should not treat all
noreturn calls as cold, explicitly mark @llvm.trap cold so that it can
be outlined.

Split out of https://reviews.llvm.org/D54244.

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

llvm-svn: 346885
2018-11-14 19:53:41 +00:00
Matt Arsenault
d002202938 Add fneg instruction to syntax highlighting lists
llvm-svn: 346785
2018-11-13 19:50:38 +00:00
Thomas Lively
40bba35cf8 Revert "Exclude wasm target from Windows packaging due to PR39448"
Summary:
This reverts r346122 now that the failing tests have been
disabled. Depends on D54353.

Reviewers: aheejin, dschuff

Subscribers: fedor.sergeev, sunfish, llvm-commits

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

llvm-svn: 346559
2018-11-09 22:05:51 +00:00
James Y Knight
11b6c9c654 Branch/tag all projects with a single commit in release-tagging script.
This change updates the release script to use svnmucc to create all
the branches with one commit.

This will ensure that the git tag won't bounce around if the git
migration runs in-between separate commits creating a branch.

Additionally, update the list of projects to include all of the
projects in the monorepo, plus test-suite.

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

llvm-svn: 346550
2018-11-09 19:45:13 +00:00
Clement Courbet
21390a9b77 [llvm-exegesis][NFC] Add a way to declare the default counter binding for unbound CPUs for a target.
Summary:
This simplifies the code and moves everything to tablegen for consistency. This
also prepares the ground for adding issue counters.

Reviewers: gchatelet, john.brawn, jsji

Subscribers: nemanjai, mgorny, javed.absar, kbarton, tschuett, llvm-commits

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

llvm-svn: 346489
2018-11-09 13:15:32 +00:00
Thomas Lively
7f5a773b3e [WebAssembly] Read prefixed opcodes as ULEB128s
Summary: Depends on D54126.

Reviewers: aheejin, dschuff, aardappel

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 346465
2018-11-09 01:57:00 +00:00
Jonas Devlieghere
6c9b7e9e90 [not] Improve error reporting consistency.
Makes `not` use WithColor from Support so it prints 'error' in color
when applicable.

llvm-svn: 346460
2018-11-09 01:17:22 +00:00
Joel E. Denny
3e75c39923 [FileCheck] Parse command-line options from FILECHECK_OPTS
This feature makes it easy to tune FileCheck diagnostic output when
running the test suite via ninja, a bot, or an IDE.  For example:

```
$ FILECHECK_OPTS='-color -v -dump-input-on-failure' \
  LIT_FILTER='OpenMP/for_codegen.cpp' ninja check-clang \
  | less -R
```

Reviewed By: probinson

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

llvm-svn: 346272
2018-11-06 22:07:03 +00:00
Justin Bogner
302a2bf57b [utils] Update SmallVector lldb formatter for r337514
SmallVector was changed to store a begin and a size rather than a
begin and an end a while back. Update the formatter to look at the
correct members.

llvm-svn: 346252
2018-11-06 18:52:30 +00:00
Elizabeth Andrews
480f539a7c [benchmark] Disable exceptions in Microsoft STL
This patch disables exceptions in Microsoft STL when exception 
handling is not enabled in Benchmark project. It fixes Windows 
builds that were failing due to C4530 warnings thrown by MS STL.

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

llvm-svn: 346237
2018-11-06 15:57:59 +00:00
Hans Wennborg
1e7f6dc2af Exclude wasm target from Windows packaging due to PR39448
llvm-svn: 346122
2018-11-05 09:31:43 +00:00
Zachary Turner
d9307b7341 Refactor the lit configuration files
A year or so ago, I re-wrote most of the lit infrastructure in LLVM so
that it wasn't so boilerplate-y. I added lots of common helper type
stuff, simplifed usage patterns, and made the code more elegant and
maintainable.

We migrated to this in LLVM, clang, and lld's lit files, but not in
LLDBs. This started to bite me recently, as the 4 most recent times I
tried to run the lit test suite in LLDB on a fresh checkout the first
thing that would happen is that python would just start crashing with
unhelpful backtraces and I would have to spend time investigating.

You can reproduce this today by doing a fresh cmake generation, doing
ninja lldb and then python bin/llvm-lit.py -sv ~/lldb/lit/SymbolFile at
which point you'll get a segfault that tells you nothing about what your
problem is.

I started trying to fix the issues with bandaids, but it became clear
that the proper solution was to just bring in the work I did in the rest
of the projects. The side benefit of this is that the lit configuration
files become much cleaner and more understandable as a result.

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

llvm-svn: 346008
2018-11-02 17:49:01 +00:00
Nicolai Haehnle
923c98bd61 TableGen: Fix ASAN error
Summary:
As a bonus, this arguably improves the code by making it simpler.

gcc 8 on Ubuntu 18.10 reports the following:

==39667==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7fffffff8ae0 at pc 0x555555dbfc68 bp 0x7fffffff8760 sp 0x7fffffff8750
WRITE of size 8 at 0x7fffffff8ae0 thread T0
    #0 0x555555dbfc67 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider::_Alloc_hider(char*, std::allocator<char>&&) /usr/include/c++/8/bits/basic_string.h:149
    #1 0x555555dbfc67 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) /usr/include/c++/8/bits/basic_string.h:542
    #2 0x555555dbfc67 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) /usr/include/c++/8/bits/basic_string.h:6009
    #3 0x555555dbfc67 in searchableFieldType /home/nha/amd/build/san/llvm-src/utils/TableGen/SearchableTableEmitter.cpp:168
    (...)

Address 0x7fffffff8ae0 is located in stack of thread T0 at offset 864 in frame
    #0 0x555555dbef3f in searchableFieldType /home/nha/amd/build/san/llvm-src/utils/TableGen/SearchableTableEmitter.cpp:148

Reviewers: fhahn, simon_tatham, kparzysz

Subscribers: llvm-commits

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

llvm-svn: 345749
2018-10-31 17:46:21 +00:00
Andrea Di Biagio
b2b609ef71 [tblgen][PredicateExpander] Add the ability to describe more complex constraints on instruction operands.
Before this patch, class PredicateExpander only knew how to expand simple
predicates that performed checks on instruction operands.
In particular, the new scheduling predicate syntax was not rich enough to
express checks like this one:

  Foo(MI->getOperand(0).getImm()) == ExpectedVal;

Here, the immediate operand value at index zero is passed in input to function
Foo, and ExpectedVal is compared against the value returned by function Foo.

While this predicate pattern doesn't show up in any X86 model, it shows up in
other upstream targets. So, being able to support those predicates is
fundamental if we want to be able to modernize all the scheduling models
upstream.

With this patch, we allow users to specify if a register/immediate operand value
needs to be passed in input to a function as part of the predicate check. Now,
register/immediate operand checks all derive from base class CheckOperandBase.

This patch also changes where TIIPredicate definitions are expanded by the
instructon info emitter. Before, definitions were expanded in class
XXXGenInstrInfo (where XXX is a target name).
With the introduction of this new syntax, we may want to have TIIPredicates
expanded directly in XXXInstrInfo. That is because functions used by the new
operand predicates may only exist in the derived class (i.e. XXXInstrInfo).

This patch is a non functional change for the existing scheduling models.
In future, we will be able to use this richer syntax to better describe complex
scheduling predicates, and expose them to llvm-mca.

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

llvm-svn: 345714
2018-10-31 12:28:05 +00:00
Fangrui Song
fe0ae144eb Use the container form llvm::sort(C)
llvm-svn: 345682
2018-10-31 00:31:06 +00:00
Greg Bedwell
8616ffdf42 [llvm-mca][UpdateTestChecks] Don't try to align blocks that have already been subject to alignment in update_mca_test_checks.py
This fixes PR39466.

llvm-svn: 345499
2018-10-29 13:24:20 +00:00
Fangrui Song
5d0ea63d0a [utils] collect_and_build_with_pgo.py: revert part already fixed in rL345461
The change was inadvertently included in my last commit.

llvm-svn: 345467
2018-10-27 23:10:09 +00:00
Fangrui Song
4f32f8ac21 [utils] Fix _run_benchmark in collect_and_build_with_pgo.py
Summary: Also fix a FIXME in _build_stage1_clang: clang llvm-profdata profile are sufficient

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

llvm-svn: 345466
2018-10-27 22:56:04 +00:00
George Burgess IV
4182c8fe4c [utils] Run tests in the proper directory.
The intent here was to run check-llvm/check-clang in the instrumented
clang's build directory, not the maybe-not-yet-created uninstrumented
clang's. Oops. :)

llvm-svn: 345461
2018-10-27 20:02:06 +00:00
George Burgess IV
ceddc90d3f Add docs+a script for building clang/LLVM with PGO
Depending on who you ask, PGO grants a 15%-25% improvement in build
times when using clang. Sadly, hooking everything up properly to
generate a profile and apply it to clang isn't always straightforward.
This script (and the accompanying docs) aim to make this process easier;
ideally, a single invocation of the given script.

In terms of testing, I've got a cronjob on my Debian box that's meant to
run this a few times per week, and I tried manually running it on a puny
Gentoo box I have (four whole Atom cores!). Nothing obviously broke.
¯\_(ツ)_/¯

I don't know if we have a Python style guide, so I just shoved this
through yapf with all the defaults on.

Finally, though the focus is clang at the moment, the hope is that this
is easily applicable to other LLVM-y tools with minimal effort (e.g.
lld, opt, ...). Hence, this lives in llvm/utils and tries to be somewhat
ambiguous about naming.

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

llvm-svn: 345427
2018-10-26 20:56:03 +00:00
Vlad Tsyrklevich
8964735b22 Revert "UBSan blacklist workaround for bot timeouts"
This reverts commit r335525. This workaround is no longer necessary
because PR37929 has been fixed.

llvm-svn: 345397
2018-10-26 16:07:50 +00:00
Nemanja Ivanovic
bf43826c8b [NFC] Fix the regular expression for BE PPC in update_llc_test_checks.py
Currently, the regular expression that matches the lines of assembly for PPC LE
(ELFv2) does not work for the assembly for BE (ELFv1). This patch fixes it.

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

llvm-svn: 345363
2018-10-26 03:30:28 +00:00
Clement Courbet
dc9ae03db9 [MCSched] Bind PFM Counters to the CPUs instead of the SchedModel.
Summary:
The pfm counters are now in the ExegesisTarget rather than the
MCSchedModel (PR39165).

This also compresses the pfm counter tables (PR37068).

Reviewers: RKSimon, gchatelet

Subscribers: mgrang, llvm-commits

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

llvm-svn: 345243
2018-10-25 07:44:01 +00:00
Joel E. Denny
f5d23d3609 [SourceMgr][FileCheck] Obey -color by extending WithColor
(Relands r344930, reverted in r344935, and now hopefully fixed for
Windows.)

While this change specifically targets FileCheck, it affects any tool
using the same SourceMgr facilities.

Previously, -color was documented in FileCheck's -help output, but
-color had no effect.  Now, -color obeys its documentation: it forces
colors to be used in FileCheck diagnostics even when stderr is not a
terminal.

-color is especially helpful when combined with FileCheck's -v, which
can produce a long series of diagnostics that you might wish to pipe
to a pager, such as less -R.  The WithColor extensions here will also
help to clean up color usage in FileCheck's annotated dump of input,
which is proposed in D52999.

Reviewed By: JDevlieghere, zturner

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

llvm-svn: 345202
2018-10-24 21:46:42 +00:00
Daniel Sanders
a073f1f188 Fix MSVC build by correcting placement of declspec after r345056
Going by the MSVC toolchains at godbolt.org, declspec comes after the template<...>.

llvm-svn: 345059
2018-10-23 17:41:39 +00:00
Daniel Sanders
fbf4de965c [tblgen] Allow FixedLenDecoderEmitter to use APInt-like objects as InsnType
Summary:
Some targets have very long encodings and uint64_t isn't sufficient. uint128_t
isn't portable so such targets need to use an object instead.

There is one catch with this at the moment, no string of bits extracted
from the encoding may exceeed 64-bits. Fields are still permitted to
exceed 64-bits so long as they aren't one contiguous string of bits. If
this proves to be a problem then we can modify the generation of
fieldFromInstruction() calls to account for it but for now I've added an
assertion for this.

InsnType must either be integral or an APInt-like object that must:
* Have a static const max_size_in_bits equal to the number of bits in the encoding.
* be default-constructible and copy-constructible
* be constructible from a uint64_t (this is the key area the interface deviates
  from APInt since this constructor does not take the bit width)
* be constructible from an APInt (this can be private)
* be convertible to uint64_t
* Support the ~, &,, ==, !=, and |= operators with other objects of the same type
* Support shift (<<, >>) with signed and unsigned integers on the RHS
* Support put (<<) to raw_ostream&

Reviewers: bogner, charukcs

Subscribers: nhaehnle, llvm-commits

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

llvm-svn: 345056
2018-10-23 17:23:31 +00:00
Greg Bedwell
d4e97d7b6a [lit] Only return a found bash executable on Windows if it can understand Windows paths
Some versions of bash.exe, for example WSL's version expect paths in the form
/mnt/c/path/to/dir rather than c:\\path\\to\\dir so will cause failures
for any tests that require an external shell if used by lit.  If we're on
Windows and looking for an external shell, check that the found version
of bash is able to parse a native path before returning that version.

This patch also partially reverts the behaviour of r228221 by
restoring the warning if bash cannot be found.  This shouldn't pollute
the lit stderr anymore as we're now using internal shell by default on
Windows.  If someone is explicitly specifying to use an external shell, it's
probably worth alerting them to the fact that bash could not be found.

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

llvm-svn: 345019
2018-10-23 11:34:04 +00:00
Thomas Lively
e3205431fe [WebAssembly][NFC] Remove WebAssemblyStackifier TableGen backend
Summary:
Replace its functionality with a TableGen InstrInfo relational
instruction mapping. Although arguably more complex than the TableGen
backend, the relational mapping is a smaller maintenance burden than a
TableGen backend.

Reviewers: aardappel, aheejin, dschuff

Subscribers: mgorny, sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 344962
2018-10-22 21:55:26 +00:00
David Greene
b00650ec4a Document bisect-skip-count
Provide an example of how to use bisect-skip count to find bugs.

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

llvm-svn: 344903
2018-10-22 14:04:13 +00:00
Fangrui Song
db2f6ced8d Use llvm::{all,any,none}_of instead std::{all,any,none}_of. NFC
llvm-svn: 344774
2018-10-19 06:12:02 +00:00
Renato Golin
641346ab8c [VPlan] Script to extract VPlan digraphs from log
The vectoriser's debug log prints VPlan digraphs, but it's a bit
cumbersome to extract them and render them into PNG images. This script
does exactly that, being careful enough to extract all individual plans,
name them appropriately and save in either .dot or .png files.

Example usage:

$ opt -O3 -debug-only=loop-vectorize file.ll -S -o /dev/null 2> debug.log

$ $LLVM_SRC/utils/extract_vplan.py < debug.log
Exporting VF1UF1 to DOT: VPlanVF1UF1.dot
Exporting VF24UF1 to DOT: VPlanVF24UF1.dot

$ $LLVM_SRC/utils/extract_vplan.py --png < debug.log
Exporting VF1UF1 to PNG via dot: VPlanVF1UF1.png
Exporting VF24UF1 to PNG via dot: VPlanVF24UF1.png

$ xdot VPlanVF1UF1.dot

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

llvm-svn: 344599
2018-10-16 09:37:52 +00:00
Andrea Di Biagio
23f0c22225 [tblgen][llvm-mca] Add the ability to describe move elimination candidates via tablegen.
This patch adds the ability to identify instructions that are "move elimination
candidates". It also allows scheduling models to describe processor register
files that allow move elimination.

A move elimination candidate is an instruction that can be eliminated at
register renaming stage.
Each subtarget can specify which instructions are move elimination candidates
with the help of tablegen class "IsOptimizableRegisterMove" (see
llvm/Target/TargetInstrPredicate.td).

For example, on X86, BtVer2 allows both GPR and MMX/SSE moves to be eliminated.
The definition of 'IsOptimizableRegisterMove' for BtVer2 looks like this:

```
def : IsOptimizableRegisterMove<[
  InstructionEquivalenceClass<[
    // GPR variants.
    MOV32rr, MOV64rr,

    // MMX variants.
    MMX_MOVQ64rr,

    // SSE variants.
    MOVAPSrr, MOVUPSrr,
    MOVAPDrr, MOVUPDrr,
    MOVDQArr, MOVDQUrr,

    // AVX variants.
    VMOVAPSrr, VMOVUPSrr,
    VMOVAPDrr, VMOVUPDrr,
    VMOVDQArr, VMOVDQUrr
  ], CheckNot<CheckSameRegOperand<0, 1>> >
]>;
```

Definitions of IsOptimizableRegisterMove from processor models of a same
Target are processed by the SubtargetEmitter to auto-generate a target-specific
override for each of the following predicate methods:

```
bool TargetSubtargetInfo::isOptimizableRegisterMove(const MachineInstr *MI)
const;
bool MCInstrAnalysis::isOptimizableRegisterMove(const MCInst &MI, unsigned
CPUID) const;
```

By default, those methods return false (i.e. conservatively assume that there
are no move elimination candidates).

Tablegen class RegisterFile has been extended with the following information:
 - The set of register classes that allow move elimination.
 - Maxium number of moves that can be eliminated every cycle.
 - Whether move elimination is restricted to moves from registers that are
   known to be zero.

This patch is structured in three part:

A first part (which is mostly boilerplate) adds the new
'isOptimizableRegisterMove' target hooks, and extends existing register file
descriptors in MC by introducing new fields to describe properties related to
move elimination.

A second part, uses the new tablegen constructs to describe move elimination in
the BtVer2 scheduling model.

A third part, teaches llm-mca how to query the new 'isOptimizableRegisterMove'
hook to mark instructions that are candidates for move elimination. It also
teaches class RegisterFile how to describe constraints on move elimination at
PRF granularity.

llvm-mca tests for btver2 show differences before/after this patch.

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

llvm-svn: 344334
2018-10-12 11:23:04 +00:00
Andrea Di Biagio
70e0948129 [tblgen][CodeGenSchedule] Add a check for invalid RegisterFile definitions with zero physical registers.
llvm-svn: 344235
2018-10-11 10:39:03 +00:00
Chris Bieneman
96ade37206 [Coverage] Apply filtered paths to summary
Summary:
The script to generate code coverage reports supports passing filter paths to llvm-cov when generating the HTML reports, but doesn't pass those paths to the summary generation as well. This results in a summary report that doesn't match the HTML report.

This patch addresses the problem by also passing the filter paths to the summary report generation.

Reviewers: vsk

Subscribers: llvm-commits

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

llvm-svn: 344217
2018-10-11 04:00:51 +00:00
Zachary Turner
aa4a00c53a [git-llvm] Fix some issues surrouding EOL conversion on Windows.
This patch fixes three issues.

The first is that we didn't consider files which are explicitly
set to eolstyle CRLF in the repo, and there are a handful of
these.

Second is that dos2unix doesn't have a -q option in GnuWin32,
so this codepath wasn't working properly.

Finally with newer versions of Python (or newer versions of Git,
or some combination of the two) patches can't be applied when
we treat stdin as text, because Python silently undoes all the
work we did to convert the newlines to LF using dos2unix by
using universal_newlines=True and then converting them *back*
to CRLF.  So we need to add a way to force stdin to be treated
as binary, and use it when LF-newlines are required.

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

llvm-svn: 344095
2018-10-09 23:42:28 +00:00
Nicolai Haehnle
30e01802e5 TableGen/CodeGenDAGPatterns: addPredicateFn only once
Summary:
The predicate function is added in InlinePatternFragments, no need to
do it here. As a result, all uses of addPredicateFn are located in
InlinePatternFragments.

Test confirmed that there are no changes to generated files when
building all (non-experimental) targets.

Change-Id: I720e42e045ca596eb0aa339fb61adf6fe71034d5

Reviewers: arsenm, rampitec, RKSimon, craig.topper, hfinkel, uweigand

Subscribers: wdng, llvm-commits

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

llvm-svn: 343977
2018-10-08 16:53:31 +00:00
Greg Bedwell
20883bf128 [utils] Ensure that update_mca_test_checks.py writes prefixes in alphabetical order
llvm-svn: 343783
2018-10-04 14:42:19 +00:00
Greg Bedwell
698890f4d4 [utils] simple refactor in update_mca_test_checks.py to make intent more readable
llvm-svn: 343782
2018-10-04 14:42:06 +00:00
Fangrui Song
4c12d59f85 Use the container form llvm::sort(C, ...)
There are a few leftovers in rL343163 which span two lines. This commit
changes these llvm::sort(C.begin(), C.end, ...) to llvm::sort(C, ...)

llvm-svn: 343426
2018-09-30 22:31:29 +00:00
Chris Matthews
9f6da0d0c5 make lit builtins a package
cat.py is not being installed when lit is installed from source. So
tests that use the internal shell fail when using cat.

llvm-svn: 343347
2018-09-28 17:55:18 +00:00