platform/upstream/llvm.git
5 years ago[AMDGPU] Fix -Wunused-variable
Fangrui Song [Mon, 19 Nov 2018 17:54:27 +0000 (17:54 +0000)]
[AMDGPU] Fix -Wunused-variable

llvm-svn: 347234

5 years ago[libcxx] Fix incorrect #include for std::hash
Louis Dionne [Mon, 19 Nov 2018 17:40:16 +0000 (17:40 +0000)]
[libcxx] Fix incorrect #include for std::hash

Reviewed as https://reviews.llvm.org/D54705.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 347233

5 years ago[libcxx] Add missing <cstddef> includes in tests
Louis Dionne [Mon, 19 Nov 2018 17:39:50 +0000 (17:39 +0000)]
[libcxx] Add missing <cstddef> includes in tests

Some tests use type std::max_align_t, but don't include <cstddef> header
directly. As a result, these tests won't compile against some conformant
libraries.

Reviewed as https://reviews.llvm.org/D54645.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 347232

5 years ago[AMDGPU] Convert insert_vector_elt into set of selects
Stanislav Mekhanoshin [Mon, 19 Nov 2018 17:39:20 +0000 (17:39 +0000)]
[AMDGPU] Convert insert_vector_elt into set of selects

This allows to avoid scratch use or indirect VGPR addressing for
small vectors.

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

llvm-svn: 347231

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.

llvm-svn: 347230

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

llvm-svn: 347229

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

llvm-svn: 347228

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)

llvm-svn: 347227

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.

llvm-svn: 347226

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.

llvm-svn: 347225

5 years ago[lit] On Windows, don't error if MSVC is not in PATH.
Zachary Turner [Mon, 19 Nov 2018 16:47:06 +0000 (16:47 +0000)]
[lit] On Windows, don't error if MSVC is not in PATH.

We had some logic backwards, and as a result if MSVC was not found
in PATH we would throw a string concatenation exception.

llvm-svn: 347224

5 years agoRemove non-ASCII characters at the beginning of file.
Zachary Turner [Mon, 19 Nov 2018 16:41:31 +0000 (16:41 +0000)]
Remove non-ASCII characters at the beginning of file.

It's not clear how these ended up in the file, but this fixes it.

llvm-svn: 347223

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

llvm-svn: 347221

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

llvm-svn: 347220

5 years ago[libcxx] Add availability markup for bad_optional_access, bad_variant_access and...
Louis Dionne [Mon, 19 Nov 2018 15:37:04 +0000 (15:37 +0000)]
[libcxx] Add availability markup for bad_optional_access, bad_variant_access and bad_any_cast

Reviewers: dexonsmith, EricWF

Subscribers: christof, arphaman, libcxx-commits

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

llvm-svn: 347219

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

llvm-svn: 347218

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

llvm-svn: 347217

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

llvm-svn: 347216

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.

llvm-svn: 347215

5 years ago[OpenMP] Check target architecture supports unified shared memory for requires direct...
Patrick Lyster [Mon, 19 Nov 2018 15:09:33 +0000 (15:09 +0000)]
[OpenMP] Check target architecture supports unified shared memory for requires directive. Differential Review: https://reviews.llvm.org/D54493

llvm-svn: 347214

5 years agoDon't use -O in lit tests.
Zachary Turner [Mon, 19 Nov 2018 15:06:10 +0000 (15:06 +0000)]
Don't use -O in lit tests.

Because of different shell quoting rules, and the fact that LLDB
commands often contain spaces, -O is not portable for writing command
lines. Instead, we should use explicit lldbinit files.

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

llvm-svn: 347213

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

llvm-svn: 347212

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

llvm-svn: 347211

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.

llvm-svn: 347210

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

llvm-svn: 347209

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

llvm-svn: 347208

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

llvm-svn: 347207

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

llvm-svn: 347206

5 years ago[FileManager] getFile(open=true) after getFile(open=false) should open the file.
Sam McCall [Mon, 19 Nov 2018 13:37:46 +0000 (13:37 +0000)]
[FileManager] getFile(open=true) after getFile(open=false) should open the file.

Summary:
Old behavior is to just return the cached entry regardless of opened-ness.
That feels buggy (though I guess nobody ever actually needed this).

This came up in the context of clangd+clang-tidy integration: we're
going to getFile(open=false) to replay preprocessor actions obscured by
the preamble, but the compilation may subsequently getFile(open=true)
for non-preamble includes.

Reviewers: ilya-biryukov

Subscribers: ioeric, kadircet, cfe-commits

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

llvm-svn: 347205

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

llvm-svn: 347204

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

llvm-svn: 347203

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

llvm-svn: 347202

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

llvm-svn: 347201

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

llvm-svn: 347200

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

llvm-svn: 347199

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

llvm-svn: 347198

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

llvm-svn: 347197

5 years agoFixed uninitialized variable issue.
Anastasia Stulova [Mon, 19 Nov 2018 12:43:39 +0000 (12:43 +0000)]
Fixed uninitialized variable issue.

This commit should fix failing bots.

llvm-svn: 347196

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

llvm-svn: 347195

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

llvm-svn: 347194

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.

llvm-svn: 347193

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

llvm-svn: 347192

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

llvm-svn: 347191

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

llvm-svn: 347190

5 years ago[OpenCL] Fix address space deduction in template args.
Anastasia Stulova [Mon, 19 Nov 2018 11:00:14 +0000 (11:00 +0000)]
[OpenCL] Fix address space deduction in template args.

Don't deduce address spaces for non-pointer-like types
in template args.

Fixes PR38603!

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

llvm-svn: 347189

5 years agoRemove unused variable. NFC.
Benjamin Kramer [Mon, 19 Nov 2018 10:59:12 +0000 (10:59 +0000)]
Remove unused variable. NFC.

llvm-svn: 347188

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

llvm-svn: 347187

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

llvm-svn: 347186

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.

llvm-svn: 347185

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

llvm-svn: 347184

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

llvm-svn: 347183

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

llvm-svn: 347182

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.

llvm-svn: 347181

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.

llvm-svn: 347180

5 years ago[PowerPC] Set the default PLT mode on OpenBSD/powerpc to Secure PLT.
Brad Smith [Mon, 19 Nov 2018 00:21:06 +0000 (00:21 +0000)]
[PowerPC] Set the default PLT mode on OpenBSD/powerpc to Secure PLT.

OpenBSD/powerpc only supports Secure PLT.

llvm-svn: 347179

5 years agoReplace the UTF-8 characters in the error message.
Brad Smith [Sun, 18 Nov 2018 22:30:58 +0000 (22:30 +0000)]
Replace the UTF-8 characters in the error message.

llvm-svn: 347178

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.

llvm-svn: 347177

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.

llvm-svn: 347176

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.

llvm-svn: 347175

5 years agoRevert "Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD"
Zachary Turner [Sun, 18 Nov 2018 20:48:25 +0000 (20:48 +0000)]
Revert "Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD"

This breaks many tests on Windows, which now all fail with an error such
as "Unable to read memory at address <xxxxxxxx>".

llvm-svn: 347174

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.

llvm-svn: 347173

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.

llvm-svn: 347172

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

llvm-svn: 347171

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

llvm-svn: 347170

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

llvm-svn: 347169

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.

llvm-svn: 347168

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

llvm-svn: 347167

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

llvm-svn: 347166

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

llvm-svn: 347165

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

llvm-svn: 347164

5 years agoAdd the abseil-duration-factory-scale check.
Aaron Ballman [Sun, 18 Nov 2018 16:41:06 +0000 (16:41 +0000)]
Add the abseil-duration-factory-scale check.

This check removes unneeded scaling of arguments when calling Abseil Time factory functions.

Patch by Hyrum Wright.

llvm-svn: 347163

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.

llvm-svn: 347162

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

llvm-svn: 347161

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

llvm-svn: 347160

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

llvm-svn: 347159

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.

llvm-svn: 347158

5 years ago[analyzer][NFC] Move CheckerOptInfo to CheckerRegistry.cpp, and make it local
Kristof Umann [Sun, 18 Nov 2018 12:47:03 +0000 (12:47 +0000)]
[analyzer][NFC] Move CheckerOptInfo to CheckerRegistry.cpp, and make it local

CheckerOptInfo feels very much out of place in CheckerRegistration.cpp, so I
moved it to CheckerRegistry.h.

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

llvm-svn: 347157

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

llvm-svn: 347156

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

llvm-svn: 347155

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

llvm-svn: 347154

5 years ago[analyzer][UninitializedObjectChecker] Uninit regions are only reported once
Kristof Umann [Sun, 18 Nov 2018 11:34:10 +0000 (11:34 +0000)]
[analyzer][UninitializedObjectChecker] Uninit regions are only reported once

Especially with pointees, a lot of meaningless reports came from uninitialized
regions that were already reported. This is fixed by storing all reported fields
to the GDM.

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

llvm-svn: 347153

5 years agocmake: z3: Remove EXACT from 4.7.1 after being compatible with 4.8.1
Jan Kratochvil [Sun, 18 Nov 2018 09:36:36 +0000 (09:36 +0000)]
cmake: z3: Remove EXACT from 4.7.1 after being compatible with 4.8.1

After check-in of D54391 a comment there by @mikhail.ramalho says:
Since we're supporting version 4.8.1 now, the cmake file should be changed to
"minimum" instead of "exact".

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

llvm-svn: 347152

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.

llvm-svn: 347151

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

llvm-svn: 347150

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.

llvm-svn: 347149

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.

llvm-svn: 347148

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.

llvm-svn: 347147

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().

llvm-svn: 347146

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

llvm-svn: 347145

5 years ago[Clang] Add options -fprofile-filter-files and -fprofile-exclude-files to filter...
Calixte Denizet [Sat, 17 Nov 2018 19:41:39 +0000 (19:41 +0000)]
[Clang] Add options -fprofile-filter-files and -fprofile-exclude-files to filter the files to instrument with gcov (after revert https://reviews.llvm.org/rL346659)

Summary:
the previous patch (https://reviews.llvm.org/rC346642) has been reverted because of test failure under windows.
So this patch fix the test cfe/trunk/test/CodeGen/code-coverage-filter.c.

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: cfe-commits, sylvestre.ledru

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

llvm-svn: 347144

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.

llvm-svn: 347143

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.

llvm-svn: 347142

5 years agoSink BuryPointer from Clang into LLVM for reuse there
David Blaikie [Sat, 17 Nov 2018 18:04:13 +0000 (18:04 +0000)]
Sink BuryPointer from Clang into LLVM for reuse there

llvm-svn: 347141

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.

llvm-svn: 347140

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

llvm-svn: 347139

5 years ago[AST][NFC] Pack CXXDefaultInitExpr
Bruno Ricci [Sat, 17 Nov 2018 13:02:47 +0000 (13:02 +0000)]
[AST][NFC] Pack CXXDefaultInitExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXDefaultInitExpr.

llvm-svn: 347138

5 years ago[AST][NFC] Pack CXXDefaultArgExpr
Bruno Ricci [Sat, 17 Nov 2018 12:56:30 +0000 (12:56 +0000)]
[AST][NFC] Pack CXXDefaultArgExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXDefaultArgExpr.

llvm-svn: 347137

5 years ago[AST][NFC] Pack CXXThrowExpr
Bruno Ricci [Sat, 17 Nov 2018 12:53:56 +0000 (12:53 +0000)]
[AST][NFC] Pack CXXThrowExpr

Use the newly available space in the bit-fields of Stmt.
This saves 8 bytes per CXXThrowExpr.

llvm-svn: 347136

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

llvm-svn: 347135

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.

llvm-svn: 347134