OSDN Git Service

android-x86/external-llvm.git
5 years ago[llvm-nm] Fix use-after-free for MachOUniversalBinaries
Francis Visoiu Mistrih [Mon, 19 Nov 2018 17:19:50 +0000 (17:19 +0000)]
[llvm-nm] Fix use-after-free for MachOUniversalBinaries

MachOObjectFile::getHostArch() returns a temporary, and getArchName
returns a StringRef pointing to a temporary std::string.

No tests since it doesn't trigger any errors except with the sanitizers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347230 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InterleavedLoadCombine] Fix warning unused variable
Martin Elshuber [Mon, 19 Nov 2018 17:11:48 +0000 (17:11 +0000)]
[InterleavedLoadCombine] Fix warning unused variable

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347229 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] replaced .param/.result by .functype
Wouter van Oortmerssen [Mon, 19 Nov 2018 17:10:36 +0000 (17:10 +0000)]
[WebAssembly] replaced .param/.result by .functype

Summary:
This makes it easier/cleaner to generate a single signature from
this directive. Also:
- Adds the symbol name, such that we don't depend on the location
  of this directive anymore.
- Actually constructs the signature in the assembler, and make the
  assembler own it.
- Refactor the use of MVT vs ValType in the streamer and assembler
  to require less conversions overall.
- Changed 700 or so tests to use it.

Reviewers: sbc100, dschuff

Subscribers: jgravelle-google, eraman, aheejin, sunfish, jfb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347228 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] simplify vector select with undef operand(s)
Sanjay Patel [Mon, 19 Nov 2018 17:06:05 +0000 (17:06 +0000)]
[SelectionDAG] simplify vector select with undef operand(s)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347227 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[InterleavedLoadCombine] Remove unused include. NFC.
Benjamin Kramer [Mon, 19 Nov 2018 17:01:19 +0000 (17:01 +0000)]
[InterleavedLoadCombine] Remove unused include. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347226 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[LICM] Make LICM able to hoist phis"
Benjamin Kramer [Mon, 19 Nov 2018 16:51:57 +0000 (16:51 +0000)]
Revert "[LICM] Make LICM able to hoist phis"

This reverts commit r347190.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347225 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[AMDGPU] Derive GCNSubtarget from MF to get overridden target features
David Stuttard [Mon, 19 Nov 2018 15:44:20 +0000 (15:44 +0000)]
[AMDGPU] Derive GCNSubtarget from MF to get overridden target features

Summary:
AMDGPUAsmPrinter has a getSTI function that derives a GCNSubtarget from the
TM. However, this means that overridden target features are not detected and can
result in incorrect behaviour.

Switch to using STM which is a GCNSubtarget derived from the MF (used elsewhere
in the same function).

Change-Id: Ib6328ad667b7fcdc87e9c06344e59859207db9b0

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347221 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LV] Avoid vectorizing unsafe dependencies in uniform address
Anna Thomas [Mon, 19 Nov 2018 15:39:59 +0000 (15:39 +0000)]
[LV] Avoid vectorizing unsafe dependencies in uniform address

Summary:
Currently, when vectorizing stores to uniform addresses, the only
instance we prevent vectorization is if there are multiple stores to the
same uniform address causing an unsafe dependency.
This patch teaches LAA to avoid vectorizing loops that have an unsafe
cross-iteration dependency between a load and a store to the same uniform address.

Fixes PR39653.

Reviewers: Ayal, efriedma

Subscribers: rkruppe, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347220 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Hexagon] make test immune to improvements in undef simplification
Sanjay Patel [Mon, 19 Nov 2018 15:34:09 +0000 (15:34 +0000)]
[Hexagon] make test immune to improvements in undef simplification

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347218 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] add/make tests immune to improvements in undef simplification
Sanjay Patel [Mon, 19 Nov 2018 15:33:44 +0000 (15:33 +0000)]
[x86] add/make tests immune to improvements in undef simplification

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347217 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix some issues with LLDB's lit configuration files.
Zachary Turner [Mon, 19 Nov 2018 15:12:34 +0000 (15:12 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347216 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoopPass] fixing 'Modification' messages in -debug-pass=Executions for loop passes
Fedor Sergeev [Mon, 19 Nov 2018 15:10:59 +0000 (15:10 +0000)]
[LoopPass] fixing 'Modification' messages in -debug-pass=Executions for loop passes

Legacy loop pass manager is issuing "Made Modification" message after each Loop Pass
run, however condition for issuing it is accumulated among all the runs.
That leads to confusing 'modification' messages as soon as the first modification is done.

Changing condition to be "current pass made modifications", similar to how
it is being done in all other pass managers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347215 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] simplify select FP with undef condition
Sanjay Patel [Mon, 19 Nov 2018 14:42:28 +0000 (14:42 +0000)]
[SelectionDAG] simplify select FP with undef condition

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347212 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] add test for select FP with undef condition; NFC
Sanjay Patel [Mon, 19 Nov 2018 14:39:57 +0000 (14:39 +0000)]
[x86] add test for select FP with undef condition; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347211 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] add simplifySelect() to reduce code duplication; NFC
Sanjay Patel [Mon, 19 Nov 2018 14:35:22 +0000 (14:35 +0000)]
[SelectionDAG] add simplifySelect() to reduce code duplication; NFC

This should be extended to handle FP and vectors in follow-up patches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347210 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-exegesis][NFC] More tests for ExegesisTarget::fillMemoryOperands().
Clement Courbet [Mon, 19 Nov 2018 14:31:43 +0000 (14:31 +0000)]
[llvm-exegesis][NFC] More tests for ExegesisTarget::fillMemoryOperands().

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347209 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSubject: [PATCH] [CodeGen] Add pass to combine interleaved loads.
Martin Elshuber [Mon, 19 Nov 2018 14:26:10 +0000 (14:26 +0000)]
Subject: [PATCH] [CodeGen] Add pass to combine interleaved loads.

This patch defines an interleaved-load-combine pass. The pass searches
for ShuffleVector instructions that represent interleaved loads. Matches are
converted such that they will be captured by the InterleavedAccessPass.

The pass extends LLVMs capabilities to use target specific instruction
selection of interleaved load patterns (e.g.: ld4 on Aarch64
architectures).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347208 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ThinLTO] Fix comment. NFC
Eugene Leviant [Mon, 19 Nov 2018 14:19:37 +0000 (14:19 +0000)]
[ThinLTO] Fix comment. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347207 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] fix formatting; NFC
Sanjay Patel [Mon, 19 Nov 2018 14:03:07 +0000 (14:03 +0000)]
[SelectionDAG] fix formatting; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347206 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-exegesis] (+final perf overview) InstructionBenchmarkClustering::rangeQuery...
Roman Lebedev [Mon, 19 Nov 2018 13:28:41 +0000 (13:28 +0000)]
[llvm-exegesis] (+final perf overview) InstructionBenchmarkClustering::rangeQuery(): reserve for the upper bound of Neighbors

Summary:
As it was pointed out in D54388+D54390, the maximal size of `Neighbors` is known,
it will contain at most Points_.size() minus one (the center of the cluster)

While that is the upper bound, meaning in the most cases, the actual count
will be much smaller, since D54390 made the allocation persistent,
we no longer have to worry about overly-optimistically `reserve()`ing.

Old: (D54393)
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (16 runs):

       6553.167456      task-clock (msec)         #    1.000 CPUs utilized            ( +-  0.21% )
...
            6.5547 +- 0.0134 seconds time elapsed  ( +-  0.20% )
```
New:
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (16 runs):

       6315.057872      task-clock (msec)         #    0.999 CPUs utilized            ( +-  0.24% )
...
            6.3187 +- 0.0160 seconds time elapsed  ( +-  0.25% )
```
And that is another -~4%.

Since this is the last (as of this moment) patch in this patch series,
it is a good time to summarize:
Old: (svn trunk, as stated in D54381)
```
$ time ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html &> /dev/null

real    0m24.884s
user    0m24.099s
sys     0m0.785s
```
So these patches, on a given benchmark,
has decreased llvm-exegesis analysis time by 74.62%.

There surely is more room for further improvements.
D54514 may improve thins by -11.5% more (relative to this patch).
Parallelization may improve things further significantly, too.

Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn

Reviewed By: courbet, MaskRay

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347204 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-exegesis] Move InstructionBenchmarkClustering::isNeighbour() into header
Roman Lebedev [Mon, 19 Nov 2018 13:28:36 +0000 (13:28 +0000)]
[llvm-exegesis] Move InstructionBenchmarkClustering::isNeighbour() into header

Summary:
Old: (D54390)
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs):

       7432.421721      task-clock (msec)         #    1.000 CPUs utilized            ( +-  0.15% )
...
            7.4336 +- 0.0115 seconds time elapsed  ( +-  0.15% )
```
New:
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs):

       6569.936144      task-clock (msec)         #    1.000 CPUs utilized            ( +-  0.22% )
...
            6.5711 +- 0.0143 seconds time elapsed  ( +-  0.22% )
```
And another -12%. You'd think it would be `inline`d anyway, but no! :)

Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn

Reviewed By: courbet, MaskRay

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347203 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-exegesis] InstructionBenchmarkClustering::rangeQuery(): write into llvm::SmallV...
Roman Lebedev [Mon, 19 Nov 2018 13:28:31 +0000 (13:28 +0000)]
[llvm-exegesis] InstructionBenchmarkClustering::rangeQuery(): write into llvm::SmallVectorImpl& output parameter

Summary:
I do believe this is the correct fix.
We call `rangeQuery()` *very* often. And many times it's output vector is large (tens of thousands entries), so small-size-opt won't help.

Old: (D54389)
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs):

       7934.528363      task-clock (msec)         #    1.000 CPUs utilized            ( +-  0.19% )
...
            7.9354 +- 0.0148 seconds time elapsed  ( +-  0.19% )
```
New:
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs):

       7383.793440      task-clock (msec)         #    1.000 CPUs utilized            ( +-  0.47% )
...
            7.3868 +- 0.0340 seconds time elapsed  ( +-  0.46% )
```
And another -7%. And that isn't even the good bit yet.

Old:
* calls to allocation functions: 2081419
* temporary allocations: 219658 (10.55%)
* bytes allocated in total (ignoring deallocations): 4.31 GB

New:
* calls to allocation functions: 1880295 (-10%)
* temporary allocations: 18758 (1%) (-91% *sic*)
* bytes allocated in total (ignoring deallocations): 545.15 MB (-88% *sic*)

Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn

Reviewed By: courbet, MaskRay

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347202 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-exegesis] InstructionBenchmarkClustering::dbScan(): replace std::vector<> with...
Roman Lebedev [Mon, 19 Nov 2018 13:28:26 +0000 (13:28 +0000)]
[llvm-exegesis] InstructionBenchmarkClustering::dbScan(): replace std::vector<> with std::deque<> in llvm::SetVector<>

Summary:
Old: (D54388)
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs):

       8606.323981      task-clock (msec)         #    1.000 CPUs utilized            ( +-  0.11% )
...
           8.60773 +- 0.00978 seconds time elapsed  ( +-  0.11% )
```
New:
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs):

       7971.403653      task-clock (msec)         #    1.000 CPUs utilized            ( +-  0.14% )
...
            7.9728 +- 0.0113 seconds time elapsed  ( +-  0.14% )
```
Another -~7%.

Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn

Reviewed By: courbet, RKSimon

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347201 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-exegesis] InstructionBenchmarkClustering::rangeQuery(): use llvm::SmallVector...
Roman Lebedev [Mon, 19 Nov 2018 13:28:22 +0000 (13:28 +0000)]
[llvm-exegesis] InstructionBenchmarkClustering::rangeQuery(): use llvm::SmallVector<size_t, 0> for storage.

Summary:
Old: (D54383)
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs):

       9098.781978      task-clock (msec)         #    1.000 CPUs utilized            ( +-  0.16% )
...
            9.1015 +- 0.0148 seconds time elapsed  ( +-  0.16% )
```
New:
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs):

       8553.352480      task-clock (msec)         #    1.000 CPUs utilized            ( +-  0.12% )
...
            8.5539 +- 0.0105 seconds time elapsed  ( +-  0.12% )
```
So another -6%.
That is because the `SmallVector` **doubles** it size when reallocating, which is great here,
since we can't `reserve()` since we can't know how many `Neighbors` we will have.

Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347200 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-exegesis] Analysis: writeMeasurementValue(): don't alloc string for double...
Roman Lebedev [Mon, 19 Nov 2018 13:28:17 +0000 (13:28 +0000)]
[llvm-exegesis] Analysis: writeMeasurementValue(): don't alloc string for double each time.

Summary:
Test data: 500kLOC of benchmark.yaml, 23Mb. (that is a subset of the actual uops benchmark i was trying to analyze!)
Old time: (D54382)
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (16 runs):

       9024.354355      task-clock (msec)         #    1.000 CPUs utilized            ( +-  0.18% )
...
            9.0262 +- 0.0161 seconds time elapsed  ( +-  0.18% )
```
New time:
```
 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (16 runs):

       8996.541057      task-clock (msec)         #    0.999 CPUs utilized            ( +-  0.19% )
...
            9.0045 +- 0.0172 seconds time elapsed  ( +-  0.19% )
```
-~0.3%, not that much. But this isn't the important part.

Old:
* calls to allocation functions: 2109712
* temporary allocations: 33112
* bytes allocated in total (ignoring deallocations): 4.43 GB

New:
* calls to allocation functions: 2095345 (-0.68%)
* temporary allocations: 18745 (-43.39% !!!)
* bytes allocated in total (ignoring deallocations): 4.31 GB (-2.71%)

Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn

Reviewed By: courbet

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347199 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-exegesis] Analysis::writeSnippet(): be smarter about memory allocations.
Roman Lebedev [Mon, 19 Nov 2018 13:28:14 +0000 (13:28 +0000)]
[llvm-exegesis] Analysis::writeSnippet(): be smarter about memory allocations.

Summary:
Test data: 500kLOC of benchmark.yaml, 23Mb. (that is a subset of the actual uops benchmark i was trying to analyze!)
Old time: (D54381)
```
$ time ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html &> /dev/null

real    0m10.487s
user    0m9.745s
sys     0m0.740s
```
New time:
```
$ time ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html &> /dev/null

real    0m9.599s
user    0m8.824s
sys     0m0.772s

```
Not that much, around -9%. But that is not the good part yet, again.

Old:
* calls to allocation functions: 3347676
* temporary allocations: 277818
* bytes allocated in total (ignoring deallocations): 10.52 GB

New:
* calls to allocation functions: 2109712 (-36%)
* temporary allocations: 33112 (-88%)
* bytes allocated in total (ignoring deallocations): 4.43 GB (-58% *sic*)

Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn

Reviewed By: courbet, MaskRay

Subscribers: tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347198 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-exegesis] InstructionBenchmarkClustering::dbScan(): use llvm::SetVector<> inste...
Roman Lebedev [Mon, 19 Nov 2018 13:28:09 +0000 (13:28 +0000)]
[llvm-exegesis] InstructionBenchmarkClustering::dbScan(): use llvm::SetVector<> instead of ILLEGAL std::unordered_set<>

Summary:
Test data: 500kLOC of benchmark.yaml, 23Mb. (that is a subset of the actual uops benchmark i was trying to analyze!)
Old time:
```
$ time ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html &> /dev/null

real    0m24.884s
user    0m24.099s
sys     0m0.785s
```
New time:
```
$ time ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html &> /dev/null

real    0m10.469s
user    0m9.797s
sys     0m0.672s
```
So -60%. And that isn't the good bit yet.

Old:
* calls to allocation functions: 106560180  (yes, 107 *million* allocations.)
* bytes allocated in total (ignoring deallocations): 12.17 GB

New:
* calls to allocation functions: 3347676  (-96.86%)  (just 3 mil)
* bytes allocated in total (ignoring deallocations): 10.52 GB (~2GB less)

---

Two points i want to raise:
* `std::unordered_set<>` should not have been used there in the first place.
  It is banned by the https://llvm.org/docs/ProgrammersManual.html#other-set-like-container-options
* There is no tests, so i'm not fully sure this is correct.
  Since it was unordered set, i guess there are zero restrictions on the order, and anything will be ok?
* I tried other containers suggested in https://llvm.org/docs/ProgrammersManual.html#set-like-containers-std-set-smallset-setvector-etc,
  this `llvm::SetVector<>` seems to be best here.

Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn

Reviewed By: courbet

Subscribers: kristina, bobsayshilol, tschuett, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347197 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add codegen tests for slow-shld scalar funnel shifts
Simon Pilgrim [Mon, 19 Nov 2018 12:29:41 +0000 (12:29 +0000)]
[X86] Add codegen tests for slow-shld scalar funnel shifts

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347195 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTest commit - delete a trailing space.
Michael Platings [Mon, 19 Nov 2018 12:10:07 +0000 (12:10 +0000)]
Test commit - delete a trailing space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347193 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAMDGPU/InsertWaitcnts: Some more const-correctness
Nicolai Haehnle [Mon, 19 Nov 2018 12:03:11 +0000 (12:03 +0000)]
AMDGPU/InsertWaitcnts: Some more const-correctness

Reviewers: msearles, rampitec, scott.linder, kanarayan

Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits, hakzsam

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347192 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Remove trunc sinks in ARM CGP
Sam Parker [Mon, 19 Nov 2018 11:34:40 +0000 (11:34 +0000)]
[ARM] Remove trunc sinks in ARM CGP

Truncs are treated as sources if their produce a value of the same
type as the one we currently trying to promote. Truncs used to be
considered as a sink if their operand was the same value type.

We now allow smaller types in the search, so we should search through
truncs that produce a smaller value. These truncs can then be
converted to an AND mask.

This leaves sinks as being:
  - points where the value in the register is being observed, such as
    an icmp, switch or store.
  - points where value types have to match, such as calls and returns.
  - zext are included to ease the transformation and are generally
    removed later on.

During this change, it also became apart from truncating sinks was
broken: if a sink used a source, its type information had already
been lost by the time the truncation happens. So I've changed the
method of caching the type information.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347191 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LICM] Make LICM able to hoist phis
John Brawn [Mon, 19 Nov 2018 11:31:24 +0000 (11:31 +0000)]
[LICM] Make LICM able to hoist phis

The general approach taken is to make note of loop invariant branches, then when
we see something conditional on that branch, such as a phi, we create a copy of
the branch and (empty versions of) its successors and hoist using that.

This has no impact by itself that I've been able to see, as LICM typically
doesn't see such phis as they will have been converted into selects by the time
LICM is run, but once we start doing phi-to-select conversion later it will be
important.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347190 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MSP430] Optimize srl/sra in case of A >> (8 + N)
Anton Korobeynikov [Mon, 19 Nov 2018 10:43:02 +0000 (10:43 +0000)]
[MSP430] Optimize srl/sra in case of A >> (8 + N)

There is no variable-length shifts on MSP430. Therefore
"eat" 8 bits of shift via bswap & ext.

Path by Kristina Bessonova!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347187 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix disturbing warning - NFCI
Serge Guelton [Mon, 19 Nov 2018 10:05:28 +0000 (10:05 +0000)]
Fix disturbing warning - NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347186 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Use a pcmpgt with 0 instead of psrad 31, to fill elements with the sign bit...
Craig Topper [Mon, 19 Nov 2018 07:22:26 +0000 (07:22 +0000)]
[X86] Use a pcmpgt with 0 instead of psrad 31, to fill elements with the sign bit in v4i32 MULH lowering.

The shift requires a copy to avoid clobbering a register. Comparing with 0 uses an xor to produce 0 that will be overwritten with the compare results. So still requires 2 instructions, but should be one byte shorter since it doesn't need to encode an immediate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347185 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoopSimplifyCFG] Add requires: asserts after rL347183
Fangrui Song [Mon, 19 Nov 2018 06:28:15 +0000 (06:28 +0000)]
[LoopSimplifyCFG] Add requires: asserts after rL347183

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347184 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoopSimplifyCFG] Teach LoopSimplifyCFG to constant-fold branches and switches
Max Kazantsev [Mon, 19 Nov 2018 05:54:38 +0000 (05:54 +0000)]
[LoopSimplifyCFG] Teach LoopSimplifyCFG to constant-fold branches and switches

This patch introduces infrastructure and the simplest case for constant-folding
of branch and switch instructions within loop into unconditional branches.
It is useful as a cleanup for such passes as loop unswitching that sometimes
produce such branches.

Only the simplest case supported in this patch: after the folding, no block
should become dead or stop being part of the loop. Support for more
sophisticated cases will go separately in follow-up patches.

Differential Revision: https://reviews.llvm.org/D54021
Reviewed By: anna

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347183 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ProfileSummary] Standardize methods and fix comment
Vedant Kumar [Mon, 19 Nov 2018 05:23:16 +0000 (05:23 +0000)]
[ProfileSummary] Standardize methods and fix comment

Every Analysis pass has a get method that returns a reference of the Result of
the Analysis, for example, BlockFrequencyInfo
&BlockFrequencyInfoWrapperPass::getBFI().  I believe that
ProfileSummaryInfo::getPSI() is the only exception to that, as it was returning
a pointer.

Another change is renaming isHotBB and isColdBB to isHotBlock and isColdBlock,
respectively.  Most methods use BB as the argument of variable names while
methods usually refer to Basic Blocks as Blocks, instead of BB.  For example,
Function::getEntryBlock, Loop:getExitBlock, etc.

I also fixed one of the comments.

Patch by Rodrigo Caetano Rocha!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347182 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Use compare with 0 to fill an element with sign bits when sign extending to...
Craig Topper [Mon, 19 Nov 2018 04:33:20 +0000 (04:33 +0000)]
[X86] Use compare with 0 to fill an element with sign bits when sign extending to v2i64 pre-sse4.1

Previously we used an arithmetic shift right by 31, but that requires a copy to preserve the input. So we might as well materialize a zero and compare to it since the comparison will overwrite the register that contains the zeros. This should be one byte shorter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347181 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove most of the SEXTLOAD Custom setOperationAction calls under -x86-experime...
Craig Topper [Mon, 19 Nov 2018 00:33:16 +0000 (00:33 +0000)]
[X86] Remove most of the SEXTLOAD Custom setOperationAction calls under -x86-experimental-vector-widening-legalization.

Leave just the v4i8->v4i64 and v8i8->v8i64, but only enable them on pre-sse4.1 targets when 64-bit mode is enabled. In those cases we end up creating sext loads that get scalarized to code that looks better than what we get from loading into a vector register and doing a multiple step sign extend using unpacks and shifts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347180 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Add SimplifyDemandedVectorElts support for SSE packed i2fp conversions.
Simon Pilgrim [Sun, 18 Nov 2018 22:13:31 +0000 (22:13 +0000)]
[X86][SSE] Add SimplifyDemandedVectorElts support for SSE packed i2fp conversions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347177 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add custom type legalization for extending v4i8/v4i16->v4i64.
Craig Topper [Sun, 18 Nov 2018 21:28:50 +0000 (21:28 +0000)]
[X86] Add custom type legalization for extending v4i8/v4i16->v4i64.

Pre-SSE4.1 sext_invec for v2i64 is complicated because we don't have a v2i64 sra instruction. So instead we sign extend to i32 using unpack and sra, then copy the elements and do a v4i32 sra to fill with sign bits, then interleave the i32 sign extend and the sign bits. So really we're doing to two sign extends but only using half of the v4i32 intermediate result.

When the result is more than 128 bits, default type legalization would prefer to split the destination type all the way down to v2i64 with shuffles followed by v16i8/v8i16->v2i64 sext_inreg operations. This results in more instructions than necessary because we are only utilizing the lower 2 elements of the v4i32 intermediate result. Instead we can custom split a v4i8/v4i16->v4i64 sign_extend. Then we can sign extend v4i8/v4i16->v4i32 invec producing a full v4i32 result. Create the sign bit vector as a v4i32 then split and interleave with the sign bits using an punpackldq and punpackhdq.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347176 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add a 32-bit command line with only sse2 to vector-sext.ll and vector-sext...
Craig Topper [Sun, 18 Nov 2018 21:28:47 +0000 (21:28 +0000)]
[X86] Add a 32-bit command line with only sse2 to vector-sext.ll and vector-sext.ll to show some of the scalarized load sequences without 64-bit scalar support.

Some of these sequeces look pretty bad since we have to copy the sign bit from a 32 bit register to a 64 bit register to finish a sign extend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347175 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Add SimplifyDemandedVectorElts support for SSE splat-vector-shifts.
Simon Pilgrim [Sun, 18 Nov 2018 20:21:52 +0000 (20:21 +0000)]
[X86][SSE] Add SimplifyDemandedVectorElts support for SSE splat-vector-shifts.

SSE vector shifts only use the bottom 64-bits of the shift amount vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347173 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Disable combineToExtendVectorInReg under -x86-experimental-vector-widening...
Craig Topper [Sun, 18 Nov 2018 18:11:25 +0000 (18:11 +0000)]
[X86] Disable combineToExtendVectorInReg under -x86-experimental-vector-widening-legalization. Add custom type legalization for extends.

If we widen illegal types instead of promoting, we should be able to rely on the type legalizer to create the vector_inreg operations for us with some caveats.

This patch disables combineToExtendVectorInReg when we are using widening.

I've enabled custom legalization for v8i8->v8i64 extends under avx512f since the type legalizer would want to create a vector_inreg with a v64i8 input type which isn't legal without avx512bw. So we go to v16i8 with custom code using the relaxation of rules we get from D54346.

I've also enable custom legalization of v8i64 and v16i32 operations with with AVX. When the input type is 128 bits, the default splitting legalization would extend first 128->256, then do the a split to two 128 pieces. Extend each half to 256 and then concat the result. The custom legalization I've added instead uses a 128->256 bit vector_inreg extend that only reads the lower 64-bits for the low half of the split. Then shuffles the high 64-bits to the low 64-bits and does another vector_inreg extend.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347172 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Lower v16i16->v8i16 truncate using an 'and' with 255, an extract_subvector...
Craig Topper [Sun, 18 Nov 2018 17:59:28 +0000 (17:59 +0000)]
[X86] Lower v16i16->v8i16 truncate using an 'and' with 255, an extract_subvector, and a packuswb instruction.

Summary: This is an improvement over the two pshufbs and punpcklqdq we'd get otherwise.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347171 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAG] add undef simplifications for select nodes
Sanjay Patel [Sun, 18 Nov 2018 17:36:23 +0000 (17:36 +0000)]
[DAG] add undef simplifications for select nodes

Sadly, this duplicates (twice) the logic from InstSimplify. There
might be some way to at least share the DAG versions of the code,
but copying the folds seems to be the standard method to ensure
that we don't miss these folds.

Unlike in IR, we don't run DAGCombiner to fixpoint, so there's no
way to ensure that we do these kinds of simplifications unless the
code is repeated at node creation time and during combines.

There were other tests that would become worthless with this
improvement that I changed as pre-commits:
rL347161
rL347164
rL347165
rL347166
rL347167

I'm not sure how to salvage the remaining tests (diffs in this patch).
So the x86 tests verify that the new code is working as intended.
The AMDGPU test is actually similar to my motivating case: we have
some undef value that has survived to machine IR in an x86 test, and
then it gets folded in some weird way, or we crash if we don't transfer
the undef flag. But we would have been better off never getting to that
point by doing these simplifications.

This will lead back to PR32023 someday...
https://bugs.llvm.org/show_bug.cgi?id=32023

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347170 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove unused variable. NFCI.
Simon Pilgrim [Sun, 18 Nov 2018 17:24:59 +0000 (17:24 +0000)]
Remove unused variable. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347169 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Split IsSplatValue into GetSplatValue and IsSplatVector
Simon Pilgrim [Sun, 18 Nov 2018 17:15:06 +0000 (17:15 +0000)]
[X86][SSE] Split IsSplatValue into GetSplatValue and IsSplatVector

Refactor towards making this recursive (necessary for PR38243 rotation splat detection).
IsSplatVector returns the original vector source of the splat and the splat index.
GetSplatValue returns the scalar splatted value as an extraction from IsSplatVector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347168 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] regenerate full checks; NFC
Sanjay Patel [Sun, 18 Nov 2018 16:56:17 +0000 (16:56 +0000)]
[x86] regenerate full checks; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347167 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SystemZ] make test immune to improvements in undef simplification
Sanjay Patel [Sun, 18 Nov 2018 16:50:44 +0000 (16:50 +0000)]
[SystemZ] make test immune to improvements in undef simplification

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347166 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Hexagon] make tests immune to improvements in undef simplification
Sanjay Patel [Sun, 18 Nov 2018 16:50:16 +0000 (16:50 +0000)]
[Hexagon] make tests immune to improvements in undef simplification

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347165 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] make test immune to improvements in undef simplification
Sanjay Patel [Sun, 18 Nov 2018 16:49:42 +0000 (16:49 +0000)]
[ARM] make test immune to improvements in undef simplification

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347164 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Relax IsSplatValue - remove the 'variable shift' limit on subtracts.
Simon Pilgrim [Sun, 18 Nov 2018 15:52:08 +0000 (15:52 +0000)]
[X86][SSE] Relax IsSplatValue - remove the 'variable shift' limit on subtracts.

Means we don't use the per-lane-shifts as much when we can cheaply use the older splat-variable-shifts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347162 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[x86] make tests immune to improvements in undef handling
Sanjay Patel [Sun, 18 Nov 2018 15:27:19 +0000 (15:27 +0000)]
[x86] make tests immune to improvements in undef handling

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347161 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SelectionDAG] simplify code; NFC
Sanjay Patel [Sun, 18 Nov 2018 14:39:03 +0000 (14:39 +0000)]
[SelectionDAG] simplify code; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347160 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Add some generic masked gather codegen tests
Simon Pilgrim [Sun, 18 Nov 2018 14:35:57 +0000 (14:35 +0000)]
[X86][SSE] Add some generic masked gather codegen tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347159 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Use raw shuffle mask decode in SimplifyDemandedVectorEltsForTargetNode...
Simon Pilgrim [Sun, 18 Nov 2018 13:34:53 +0000 (13:34 +0000)]
[X86][SSE] Use raw shuffle mask decode in SimplifyDemandedVectorEltsForTargetNode (PR39549)

We were using the 'normalized' shuffle mask from resolveTargetShuffleInputs, which replaces zero/undef inputs with sentinel values. For SimplifyDemandedVectorElts we need the raw mask so we can correctly demand those 'zero' inputs that got normalized away, this requires an extra bit of logic to locally normalize undef inputs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347158 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSwap order of discovering of -ltinfo and -lterminfo
Kamil Rytarowski [Sun, 18 Nov 2018 12:13:51 +0000 (12:13 +0000)]
Swap order of discovering of -ltinfo and -lterminfo

Summary:
NetBSD ships with native curses(3) and -ltinfo is a part of ncurses.
Set -lterminfo before -ltinfo, as it allows to prioritize native curses
libraries. Mixing curses and ncurses does not work well, especially
in software built on top of llvm.

Original patch by Ryo Onodera (NetBSD) in pkgsrc.

Reviewers: labath, dim, mgorny

Reviewed By: dim, mgorny

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347156 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Add null streamer support
Heejin Ahn [Sun, 18 Nov 2018 11:58:47 +0000 (11:58 +0000)]
[WebAssembly] Add null streamer support

Summary: Now `llc -filetype=null` works.

Reviewers: eush

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347155 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Add equality comparison operators for WasmEventType
Heejin Ahn [Sun, 18 Nov 2018 11:53:35 +0000 (11:53 +0000)]
[WebAssembly] Add equality comparison operators for WasmEventType

Summary:
This was missing in D54096. Independent tests for this is not available
here, because these are used in lld.

Reviewers: sbc100

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347154 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add -x86-experimental-vector-widening-legalization check to combineSelect and...
Craig Topper [Sun, 18 Nov 2018 08:30:09 +0000 (08:30 +0000)]
[X86] Add -x86-experimental-vector-widening-legalization check to combineSelect and combineSetCC to cover vXi16/vXi8 promotion without BWI.

I don't yet have any test cases for this, but its the right thing to do based on log file inspection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347151 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Rename WidenMaskArithmetic->PromoteMaskArithmetic since we usually use widen...
Craig Topper [Sun, 18 Nov 2018 07:35:08 +0000 (07:35 +0000)]
[X86] Rename WidenMaskArithmetic->PromoteMaskArithmetic since we usually use widen to refer to adding elements not making elements larger. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347150 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Don't use a pmaddwd for vXi32 multiply if the inputs are zero extends from...
Craig Topper [Sun, 18 Nov 2018 05:53:21 +0000 (05:53 +0000)]
[X86] Don't use a pmaddwd for vXi32 multiply if the inputs are zero extends from i8 or smaller without SSE4.1. Prefer to shrink the mul instead.

The zero extend will require two stages of unpacks to implement. So its better to shrink the multiply using pmullw and then extend that result back to v4i32 using a single unpack.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347149 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agotighten up a couple of assertions. hitting the BitPosition == BitWidth case that...
John Regehr [Sun, 18 Nov 2018 01:51:43 +0000 (01:51 +0000)]
tighten up a couple of assertions. hitting the BitPosition == BitWidth case that was previously not caught resulted in nasty corruption of APInts that (on my system at least) could not be detected using UBSan, ASan, or Valgrind. this patch does not cause any extra failures in a check-all nor does it interfere with bootstrapping. David Blaikie informally approved this change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347148 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CorrelatedValuePropagation] Preserve debug locations (PR38178)
Vedant Kumar [Sun, 18 Nov 2018 00:29:58 +0000 (00:29 +0000)]
[CorrelatedValuePropagation] Preserve debug locations (PR38178)

Fix all of the missing debug location errors in CVP found by debugify.

This includes the missing-location-after-udiv-truncation case described
in llvm.org/PR38178.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347147 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix bot failure from r347145
Teresa Johnson [Sat, 17 Nov 2018 20:41:45 +0000 (20:41 +0000)]
Fix bot failure from r347145

The #if check around the statistics computation gave an error about
the statistic being an unused variable. Instead, guard with
AreStatisticsEnabled().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347146 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ThinLTO] Add some stats for read only variable internalization
Teresa Johnson [Sat, 17 Nov 2018 20:03:22 +0000 (20:03 +0000)]
[ThinLTO] Add some stats for read only variable internalization

Summary:
Follow up to D49362 ([ThinLTO] Internalize read only globals). Add a
statistic on the number of read only variables (only counting live
variables since dead variables will be dropped anyway).

Reviewers: evgeny777

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, arphaman, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347145 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add support for matching PACKUSWB from a v64i8 shuffle.
Craig Topper [Sat, 17 Nov 2018 18:54:43 +0000 (18:54 +0000)]
[X86] Add support for matching PACKUSWB from a v64i8 shuffle.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347143 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add test case to show missed opportunity to use PACKUSWB in v64i8 shuffle lowering.
Craig Topper [Sat, 17 Nov 2018 18:54:41 +0000 (18:54 +0000)]
[X86] Add test case to show missed opportunity to use PACKUSWB in v64i8 shuffle lowering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347142 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMove BuryPointer from Clang to LLVM for use in other LLVM tools
David Blaikie [Sat, 17 Nov 2018 18:03:47 +0000 (18:03 +0000)]
Move BuryPointer from Clang to LLVM for use in other LLVM tools

Specifically planning to use this in llvm-symbolizer to remove the cost
of cleanup there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347140 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86][SSE] Add shuffle demanded elts test case for PR39549
Simon Pilgrim [Sat, 17 Nov 2018 14:06:03 +0000 (14:06 +0000)]
[X86][SSE] Add shuffle demanded elts test case for PR39549

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347139 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objdump] Print a blank row at the end of sections
Xing GUO [Sat, 17 Nov 2018 08:12:48 +0000 (08:12 +0000)]
[llvm-objdump] Print a blank row at the end of sections

Summary:
When using option `-x` (--all-headers), it will print `Sections`, `Symbol Table`, `Program Header` ...
`Sections` and `Symbol Table` will be connected together.

Before:
```
Sections:
Idx Name          Size      Address          Type
  0               00000000 0000000000000000
  ...
  29 .shstrtab     0000011a 0000000000000000
SYMBOL TABLE:
  ...
```

After:
```
Sections:
Idx Name          Size      Address          Type
  0               00000000 0000000000000000
  ...
  29 .shstrtab     0000011a 0000000000000000

SYMBOL TABLE:
  ...
```

Reviewers: Higuoxing

Reviewed By: Higuoxing

Subscribers: llvm-commits, jhenderson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347135 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agollvm-symbolizer: Avoid calling getFromOffset when the index entry is already available
David Blaikie [Sat, 17 Nov 2018 05:57:58 +0000 (05:57 +0000)]
llvm-symbolizer: Avoid calling getFromOffset when the index entry is already available

Especially for symbolizer it can be efficient to have to search through
the entire index when it isn't needed - llvm-symbolizer looks up only a
few CUs & already has an index available in getUnitForEntry, once it's
passed down to DWARFUnitHeader::extract then there's no need for it to
call getFromOffset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347134 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Don't extend v32i8 multiplies to v32i16 with avx512bw and prefer-vector-width...
Craig Topper [Sat, 17 Nov 2018 02:36:07 +0000 (02:36 +0000)]
[X86] Don't extend v32i8 multiplies to v32i16 with avx512bw and prefer-vector-width=256.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347131 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add test cases to show incorrect use of a 512 bit vector in v32i8 multiply...
Craig Topper [Sat, 17 Nov 2018 02:36:02 +0000 (02:36 +0000)]
[X86] Add test cases to show incorrect use of a 512 bit vector in v32i8 multiply lowering with prefer-vector-width=256.

On the min-legal-vector-width test this actually causes some of the v32i16 operations we emitted to be scalarized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347130 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoReverted r347092 due to the following build fails:
Vyacheslav Zakharin [Sat, 17 Nov 2018 02:26:34 +0000 (02:26 +0000)]
Reverted r347092 due to the following build fails:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/8662
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/26263

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347129 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd initial scaffolding for the GN build.
Nico Weber [Sat, 17 Nov 2018 02:21:53 +0000 (02:21 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347128 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Use getUnpackl/getUnpackh instead of hardcoding a shuffle mask.
Craig Topper [Sat, 17 Nov 2018 02:18:12 +0000 (02:18 +0000)]
[X86] Use getUnpackl/getUnpackh instead of hardcoding a shuffle mask.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347127 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUse llvm::copy. NFC
Fangrui Song [Sat, 17 Nov 2018 01:44:25 +0000 (01:44 +0000)]
Use llvm::copy. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347126 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[llvm-objcopy] Use llvm::all_of and rename the variables "Segment" to avoid confusion...
Fangrui Song [Sat, 17 Nov 2018 01:15:55 +0000 (01:15 +0000)]
[llvm-objcopy] Use llvm::all_of and rename the variables "Segment" to avoid confusion with the type of the same name

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347123 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMoved dag-combine-select-undef.ll into amdgpu. NFC.
Stanislav Mekhanoshin [Sat, 17 Nov 2018 00:17:15 +0000 (00:17 +0000)]
Moved dag-combine-select-undef.ll into amdgpu. NFC.

Tests really needs target arch to be specified.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347115 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMake git-llvm python3 compatible again. Hopefully. :)
James Y Knight [Fri, 16 Nov 2018 23:59:23 +0000 (23:59 +0000)]
Make git-llvm python3 compatible again. Hopefully. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347113 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFixed test after r347110
Stanislav Mekhanoshin [Fri, 16 Nov 2018 23:40:04 +0000 (23:40 +0000)]
Fixed test after r347110

Comments in llc outputs are printed differently on different
platforms, some with '#', some with '##'. Removed non-essential
part of the checks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347112 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDAG combiner: fold (select, C, X, undef) -> X
Stanislav Mekhanoshin [Fri, 16 Nov 2018 23:13:38 +0000 (23:13 +0000)]
DAG combiner: fold (select, C, X, undef) -> X

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347110 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Add custom promotion of narrow fp_to_uint/fp_to_sint operations under -x86...
Craig Topper [Fri, 16 Nov 2018 22:53:00 +0000 (22:53 +0000)]
[X86] Add custom promotion of narrow fp_to_uint/fp_to_sint operations under -x86-experimental-vector-widening-legalization.

This tries to force the result type to vXi32 followed by a truncate. This can help avoid scalarization that would otherwise occur.

There's some annoying examples of an avx512 truncate instruction followed by a packus where we should really be able to just use one truncate. But overall this is still a net improvement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347105 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoSpeed up git-llvm script by only svn up'ing affected directories.
James Y Knight [Fri, 16 Nov 2018 22:36:17 +0000 (22:36 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347103 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Qualify part of the masked gather handling in ReplaceNodeResults with a getType...
Craig Topper [Fri, 16 Nov 2018 22:04:29 +0000 (22:04 +0000)]
[X86] Qualify part of the masked gather handling in ReplaceNodeResults with a getTypeAction call to know if we can use default legalization.

If we managed to switch to -x86-experimental-vector-widening-legalization this block can be removed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347100 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Cleanup unused declares in test code. NFC.
Sam Clegg [Fri, 16 Nov 2018 21:20:00 +0000 (21:20 +0000)]
[WebAssembly] Cleanup unused declares in test code. NFC.

In one case probably you have be using it, in the other it
looks like it was redundant.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347098 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SimpleLoopUnswitch] adding cost multiplier to cap exponential unswitch with
Fedor Sergeev [Fri, 16 Nov 2018 21:16:43 +0000 (21:16 +0000)]
[SimpleLoopUnswitch] adding cost multiplier to cap exponential unswitch with

We need to control exponential behavior of loop-unswitch so we do not get
run-away compilation.

Suggested solution is to introduce a multiplier for an unswitch cost that
makes cost prohibitive as soon as there are too many candidates and too
many sibling loops (meaning we have already started duplicating loops
by unswitching).

It does solve the currently known problem with compile-time degradation
(PR 39544).

Tests are built on top of a recently implemented CHECK-COUNT-<num>
FileCheck directives.

Reviewed By: chandlerc, mkazantsev
Differential Revision: https://reviews.llvm.org/D54223

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347097 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Remove a branch on SSE4.1 from LowerLoad
Craig Topper [Fri, 16 Nov 2018 21:05:00 +0000 (21:05 +0000)]
[X86] Remove a branch on SSE4.1 from LowerLoad

We should be able to use getExtendInVec with or without sse4.1 to produce a SIGN_EXTEND_VECTOR_INREG.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347095 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LegalizeVectorOps] After custom legalizing an extending load or a truncating store...
Craig Topper [Fri, 16 Nov 2018 21:04:58 +0000 (21:04 +0000)]
[LegalizeVectorOps] After custom legalizing an extending load or a truncating store, make sure the custom code is also legal.

For example, on X86 we emit a sign_extend_vector_inreg from LowerLoad and without sse4.1 this node will need further legalization. Previously this sign_extend_vector_inreg was being custom lowered during DAG legalization instead of vector op legalization.

Unfortunately, this doesn't seem to matter for the output of any existing lit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347094 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] In LowerLoad, fix assert messages and rename a variable that use Zize instead...
Craig Topper [Fri, 16 Nov 2018 21:04:56 +0000 (21:04 +0000)]
[X86] In LowerLoad, fix assert messages and rename a variable that use Zize instead of Size. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347093 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoPreprocessing support in tablegen.
Vyacheslav Zakharin [Fri, 16 Nov 2018 20:57:29 +0000 (20:57 +0000)]
Preprocessing support in tablegen.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347092 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PowerPC][NFC] Add tests for vector fp <-> int conversions
Nemanja Ivanovic [Fri, 16 Nov 2018 20:24:10 +0000 (20:24 +0000)]
[PowerPC][NFC] Add tests for vector fp <-> int conversions

This NFC patch just adds test cases for conversions that currently
require scalarization of vectors. An updcoming patch will change
the legalization for these and it is more suitable on the review
to show the diferences in code gen rather than just the new code gen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347090 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAArch64: Emit a call frame instruction for the shadow call stack register.
Peter Collingbourne [Fri, 16 Nov 2018 20:08:54 +0000 (20:08 +0000)]
AArch64: Emit a call frame instruction for the shadow call stack register.

When unwinding past a function that uses shadow call stack, we must
subtract 8 from the value of the x18 register. This patch causes us
to emit a call frame instruction that causes that to happen.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347089 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[FNeg] Add FNeg Instruction to LangRef document
Cameron McInally [Fri, 16 Nov 2018 19:52:59 +0000 (19:52 +0000)]
[FNeg] Add FNeg Instruction to LangRef document

The FNeg IR Instruction code was added with D53877.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347086 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MSP430] Add RTLIB::[SRL/SRA/SHL]_I32 lowering to EABI lib calls
Anton Korobeynikov [Fri, 16 Nov 2018 19:36:15 +0000 (19:36 +0000)]
[MSP430] Add RTLIB::[SRL/SRA/SHL]_I32 lowering to EABI lib calls

Patch by Kristina Bessonova!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347080 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Disable Condbr_merge pass
Rong Xu [Fri, 16 Nov 2018 19:35:00 +0000 (19:35 +0000)]
[X86] Disable Condbr_merge pass

Disable Condbr_merge pass for now due to PR39658.
Will reenable the pass once the bug is fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347079 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[PowerPC] Make no-PIC default to match GCC - LLVM"
Stefan Pintilie [Fri, 16 Nov 2018 19:24:23 +0000 (19:24 +0000)]
Revert "[PowerPC] Make no-PIC default to match GCC - LLVM"

This reverts commit r347069

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347076 91177308-0d34-0410-b5e6-96231b3b80d8