platform/upstream/llvm.git
5 years ago[lldb-mi] Remove a test that uses pexpect().
Davide Italiano [Wed, 20 Feb 2019 18:27:29 +0000 (18:27 +0000)]
[lldb-mi] Remove a test that uses pexpect().

Summary:
Its functionality is entirely covered by exec-run.test (which
doesn't use pexpect)

Reviewers: serge-sans-paille

Subscribers: ki.stfu, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 354494

5 years ago[MCA][Scheduler] Correctly initialize field NumDispatchedToThePendingSet.
Andrea Di Biagio [Wed, 20 Feb 2019 18:23:19 +0000 (18:23 +0000)]
[MCA][Scheduler] Correctly initialize field NumDispatchedToThePendingSet.

This should have been part of r354490.

llvm-svn: 354493

5 years agoAdd partial implementation of std::to_address() as llvm::to_address()
Daniel Sanders [Wed, 20 Feb 2019 18:08:48 +0000 (18:08 +0000)]
Add partial implementation of std::to_address() as llvm::to_address()

Summary:
Following on from the review for D58088, this patch provides the
prerequisite to_address() implementation that's needed to have
pointer_iterator support unique_ptr.

The late bound return should be removed once we move to C++14 to better
align with the C++20 declaration. Also, this implementation can be removed
once we move to C++20 where it's defined as std::to_addres()

The std::pointer_traits<>::to_address(p) variations of these overloads has
not been implemented.

Reviewers: dblaikie, paquette

Reviewed By: dblaikie

Subscribers: dexonsmith, kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 354491

5 years ago[MCA][Scheduler] Collect resource pressure and memory dependency bottlenecks.
Andrea Di Biagio [Wed, 20 Feb 2019 18:01:49 +0000 (18:01 +0000)]
[MCA][Scheduler] Collect resource pressure and memory dependency bottlenecks.

Every cycle, the Scheduler checks if instructions in the ReadySet can be issued
to the underlying pipelines. If an instruction cannot be issued because one or
more pipeline resources are unavailable, then field
Instruction::CriticalResourceMask is updated with the resource identifier of the
unavailable resources.

If an instruction cannot be promoted from the PendingSet to the ReadySet because
of a memory dependency, then field Instruction::CriticalMemDep is updated with
the identifier of the dependending memory instruction.

Bottleneck information is collected after every cycle for instructions that are
waiting to execute. The idea is to help identify causes of bottlenecks; this
information can be used in future to implement a bottleneck analysis.

llvm-svn: 354490

5 years ago[X86][SSE] combineX86ShufflesRecursively - begin generalizing the number of shuffle...
Simon Pilgrim [Wed, 20 Feb 2019 17:58:29 +0000 (17:58 +0000)]
[X86][SSE] combineX86ShufflesRecursively - begin generalizing the number of shuffle inputs. NFCI.

We currently bail if the target shuffle decodes to more than 2 input vectors, this is some initial cleanup that still has the limit but generalizes the opindices to an array that will be necessary when we drop the limit.

llvm-svn: 354489

5 years ago[TestModuleCXX] Make this test Darwin-only.
Jonas Devlieghere [Wed, 20 Feb 2019 17:43:34 +0000 (17:43 +0000)]
[TestModuleCXX] Make this test Darwin-only.

Apparently this functionality is not expected to work on non-Darwin
systems. I should've checked the decorator on the original test.

llvm-svn: 354487

5 years ago[OPENMP] Delay emission of the asm target-specific error messages.
Alexey Bataev [Wed, 20 Feb 2019 17:42:57 +0000 (17:42 +0000)]
[OPENMP] Delay emission of the asm target-specific error messages.

Summary:
Added the ability to emit target-specific builtin assembler error
messages only in case if the function is really is going to be emitted
for the device.

Reviewers: rjmccall

Subscribers: guansong, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354486

5 years agoUpdate property prefix regex to allow numbers.
Yan Zhang [Wed, 20 Feb 2019 17:32:41 +0000 (17:32 +0000)]
Update property prefix regex to allow numbers.

Subscribers: jfb, cfe-commits

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

llvm-svn: 354485

5 years ago[llvm-readelf]Test a couple of corner-cases for --section-mapping
James Henderson [Wed, 20 Feb 2019 17:21:38 +0000 (17:21 +0000)]
[llvm-readelf]Test a couple of corner-cases for --section-mapping

This patch adds two new tests for edge-case behaviour for --section-
mapping, namely when there are no program headers, and when there are no
section headers.

Reviewed by: mattd

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

llvm-svn: 354484

5 years ago[lldb] [test] Fix expected netbsd output for TestImageListMultiArchitecture
Michal Gorny [Wed, 20 Feb 2019 17:10:34 +0000 (17:10 +0000)]
[lldb] [test] Fix expected netbsd output for TestImageListMultiArchitecture

llvm-svn: 354483

5 years agoFix compile error with Intel's compiler (-Werror=pedantic)
Gabor Marton [Wed, 20 Feb 2019 16:57:41 +0000 (16:57 +0000)]
Fix compile error with Intel's compiler (-Werror=pedantic)

An extra semicolon at the end of macro invocations caused a build bot
failure for Intel's compiler when pedantic is turned on.

llvm-svn: 354482

5 years ago[CodeGen] Enable the complex-math test for arm
Petr Hosek [Wed, 20 Feb 2019 16:53:08 +0000 (16:53 +0000)]
[CodeGen] Enable the complex-math test for arm

This test wasn't running due to a missing : after the RUN statement.
Enabling this test revealed that it's actually broken.

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

llvm-svn: 354481

5 years agoGlobalISel: Fix fewerElementsVector for ctlz with different result type
Matt Arsenault [Wed, 20 Feb 2019 16:42:52 +0000 (16:42 +0000)]
GlobalISel: Fix fewerElementsVector for ctlz with different result type

Also complete the set of related operations.

llvm-svn: 354480

5 years ago[OPENMP][NVPTX]Use faster teams reduction algorithm.
Alexey Bataev [Wed, 20 Feb 2019 16:36:22 +0000 (16:36 +0000)]
[OPENMP][NVPTX]Use faster teams reduction algorithm.

A faster way to reduce the values in teams reductions was found, the
codegen is updated to use this faster algorithm and new runtime functions.

llvm-svn: 354479

5 years agoGlobalISel: Implement moreElementsVector for g_insert results
Matt Arsenault [Wed, 20 Feb 2019 16:11:22 +0000 (16:11 +0000)]
GlobalISel: Implement moreElementsVector for g_insert results

llvm-svn: 354477

5 years agoRe-land the refactoring part of r354244 "[DAGCombiner] Eliminate dead stores to stack."
Clement Courbet [Wed, 20 Feb 2019 15:45:58 +0000 (15:45 +0000)]
Re-land the refactoring part of r354244 "[DAGCombiner] Eliminate dead stores to stack."

This is an NFC.

llvm-svn: 354476

5 years ago[CGP][x86] add tests for usubo special-case; NFC
Sanjay Patel [Wed, 20 Feb 2019 15:40:58 +0000 (15:40 +0000)]
[CGP][x86] add tests for usubo special-case; NFC

This is another example from PR31754:
https://bugs.llvm.org/show_bug.cgi?id=31754

llvm-svn: 354475

5 years ago[obj2yaml][yaml2obj]Locate all .yaml and .test tests
James Henderson [Wed, 20 Feb 2019 15:13:44 +0000 (15:13 +0000)]
[obj2yaml][yaml2obj]Locate all .yaml and .test tests

A number of the obj2yaml tests end in .yaml, but .yaml is not a default
file type picked up by lit, so these tests weren't being run when
running the testsuite as a whole (they could be run explicitly still).
This change adds a lit local config file to specify the known file types
for obj2yaml tests (.yaml and .test). Additionally, it fixes the
yaml2obj config file to allow both .test and .yaml suffixed tests
(previously, the two tests ending in '.test' were not being run).

Reviewed by: grimar

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

llvm-svn: 354474

5 years ago[Hexagon] Split vector pairs for ISD::SIGN_EXTEND and ISD::ZERO_EXTEND
Krzysztof Parzyszek [Wed, 20 Feb 2019 15:05:19 +0000 (15:05 +0000)]
[Hexagon] Split vector pairs for ISD::SIGN_EXTEND and ISD::ZERO_EXTEND

llvm-svn: 354473

5 years agoSpeculative buildfix for Mac
Hans Wennborg [Wed, 20 Feb 2019 14:56:31 +0000 (14:56 +0000)]
Speculative buildfix for Mac

Our builds were failing with

FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o
[..]
In file included from /b/c/b/ToTMac/src/third_party/llvm/lib/Support/ARMBuildAttrs.cpp:9:
In file included from /b/c/b/ToTMac/src/third_party/llvm/include/llvm/ADT/StringRef.h:12:
In file included from /b/c/b/ToTMac/src/third_party/llvm/include/llvm/ADT/STLExtras.h:19:
/b/c/b/ToTMac/src/third_party/llvm/include/llvm/ADT/Optional.h:88:25: error: no member named 'addressof' in namespace 'std'
    ::new ((void *)std::addressof(value)) T(std::forward<Args>(args)...);
                   ~~~~~^

Try to fix by including <memory>

llvm-svn: 354472

5 years ago[OpenMP][libomptarget] New reduction scheme for team reductions
Gheorghe-Teodor Bercea [Wed, 20 Feb 2019 14:55:55 +0000 (14:55 +0000)]
[OpenMP][libomptarget] New reduction scheme for team reductions

Summary:
This patch adds a more sophisticated team reduction scheme to the OpenMP libomptarget-nvptx runtime.

The scheme uses a fixed size global memory buffer whose length can be adjusted via compiler flag:
```
-fopenmp-cuda-teams-reduction-recs-num=1024
```
The global buffer is a structure of arrays (with default size of 1024 each and controlled by the above flag), one array for each reduction variable.

Values in the buffer are processed by the last team to finish executing the body of the target region.

In addition to adding support for the new flag, the compiler also emits special functions used for the reduction of the intermediate reduction values. These changes will be added in a separate compiler patch following this one.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: guansong, jfb, jdoerfert, openmp-commits

Tags: #openmp

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

llvm-svn: 354471

5 years ago[MCA][ResourceManager] Add a table that maps processor resource indices to processor...
Andrea Di Biagio [Wed, 20 Feb 2019 14:53:18 +0000 (14:53 +0000)]
[MCA][ResourceManager] Add a table that maps processor resource indices to processor resource identifiers.

This patch adds a lookup table to speed up resource queries in the ResourceManager.
This patch also moves helper function 'getResourceStateIndex()' from
ResourceManager.cpp to Support.h, so that we can reuse that logic in the
SummaryView (and potentially other views in llvm-mca).
No functional change intended.

llvm-svn: 354470

5 years agoFix the build with gcc/libstdc++ 4.8.2 after r354441
Hans Wennborg [Wed, 20 Feb 2019 14:50:08 +0000 (14:50 +0000)]
Fix the build with gcc/libstdc++ 4.8.2 after r354441

llvm-svn: 354469

5 years ago[mips] Put some MIPS-specific sections to separate segments
Simon Atanasyan [Wed, 20 Feb 2019 14:47:02 +0000 (14:47 +0000)]
[mips] Put some MIPS-specific sections to separate segments

Three MIPS-specific sections `.reginfo`, `.MIPS.options`, and `.MIPS.abiflags`
are used by loader to read their contents and setup environment for running
a program. Loader looks up these data in the corresponding segments:
`PT_MIPS_REGINFO`, `PT_MIPS_OPTIONS`, and `PT_MIPS_ABIFLAGS` respectively.

This patch put these sections to separate segments like we do already
for ARM `SHT_ARM_EXIDX` section.

Differential Revision: http://reviews.llvm.org/D58381

llvm-svn: 354468

5 years ago[InstSimplify] use any-zero matcher for fcmp folds
Sanjay Patel [Wed, 20 Feb 2019 14:34:00 +0000 (14:34 +0000)]
[InstSimplify] use any-zero matcher for fcmp folds

The m_APFloat matcher does not work with anything but strict
splat vector constants, so we could miss these folds and then
trigger an assertion in instcombine:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13201

The previous attempt at this in rL354406 had a logic bug that
actually triggered a regression test failure, but I failed to
notice it the first time.

llvm-svn: 354467

5 years ago[lldb] [ObjectFile/ELF] Fix recognizing NetBSD images
Michal Gorny [Wed, 20 Feb 2019 14:31:06 +0000 (14:31 +0000)]
[lldb] [ObjectFile/ELF] Fix recognizing NetBSD images

Split the recognition into NetBSD executables & shared libraries
and core(5) files.

Introduce new owner type: "NetBSD-CORE", as core(5) files are not tagged
in the same way as regular NetBSD executables.

Stop using incorrectly ABI_TAG and ABI_SIZE.  Introduce IDENT_TAG,
IDENT_DECSZ, IDENT_NAMESZ and PROCINFO.

The new values detect correctly the NetBSD images.

The patch has been originally written by Kamil Rytarowski.  I've added
tests and applied minor code changes per review.  The work has been
sponsored by the NetBSD Foundation.

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

llvm-svn: 354466

5 years ago[yaml2elf] - Rename a variable. NFC.
George Rimar [Wed, 20 Feb 2019 14:01:02 +0000 (14:01 +0000)]
[yaml2elf] - Rename a variable. NFC.

Was suggested during review of D58441.

llvm-svn: 354463

5 years ago[yaml2obj] - Simplify implementation. NFCI.
George Rimar [Wed, 20 Feb 2019 13:58:43 +0000 (13:58 +0000)]
[yaml2obj] - Simplify implementation. NFCI.

Knowing about how types are declared for 32/64 bit platforms:
https://github.com/llvm-mirror/llvm/blob/master/include/llvm/BinaryFormat/ELF.h#L28

it is possible to simplify code that writes a binary a bit.
The patch does that.

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

llvm-svn: 354462

5 years ago[MIPS MSA] Avoid some DAG combines for vector shifts
Petar Avramovic [Wed, 20 Feb 2019 13:42:44 +0000 (13:42 +0000)]
[MIPS MSA] Avoid some DAG combines for vector shifts

DAG combiner combines two shifts into shift + and with bitmask.
Avoid such combines for vectors since leaving two vector shifts
as they are produces better end results.

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

llvm-svn: 354461

5 years ago[clangd] Fix a typo. NFC
Ilya Biryukov [Wed, 20 Feb 2019 12:31:44 +0000 (12:31 +0000)]
[clangd] Fix a typo. NFC

The documentation for -index-file mentioned clang-index instead of
clangd-indexer.

llvm-svn: 354456

5 years ago[MIPS MSA] Add test for vector shift combines
Petar Avramovic [Wed, 20 Feb 2019 12:13:11 +0000 (12:13 +0000)]
[MIPS MSA] Add test for vector shift combines

Add test for vector shift combines.

llvm-svn: 354455

5 years ago[SLPVectorizer][X86] Add add/sub/mul overflow tests
Simon Pilgrim [Wed, 20 Feb 2019 12:04:54 +0000 (12:04 +0000)]
[SLPVectorizer][X86] Add add/sub/mul overflow tests

Baseline tests - overflow intrinsics aren't flagged as vectorizable yet

llvm-svn: 354454

5 years ago[clangd] Revert r354442 and r354444
Kadir Cetinkaya [Wed, 20 Feb 2019 11:45:20 +0000 (11:45 +0000)]
[clangd] Revert r354442 and r354444

Looks like sysroot is only working on linux.

llvm-svn: 354453

5 years ago[clang-format] Do not emit replacements if Java imports are OK
Krasimir Georgiev [Wed, 20 Feb 2019 11:44:21 +0000 (11:44 +0000)]
[clang-format] Do not emit replacements if Java imports are OK

Summary:
Currently clang-format would always emit a replacement for a block of Java imports even if it is correctly formatted:
```
% cat /tmp/Aggregator.java
import X;
% clang-format /tmp/Aggregator.java
import X;
% clang-format -output-replacements-xml /tmp/Aggregator.java
<?xml version='1.0'?>
<replacements xml:space='preserve' incomplete_format='false'>
<replacement offset='0' length='9'>import X;</replacement>
</replacements>
%
```
This change makes clang-format not emit replacements in this case. Note that
there is logic to not emit replacements in this case for C++.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354452

5 years ago[sanitizers] Restore internal_readlink for x32
H.J. Lu [Wed, 20 Feb 2019 11:43:43 +0000 (11:43 +0000)]
[sanitizers] Restore internal_readlink for x32

r316591 has

@@ -389,13 +383,11 @@ uptr internal_dup2(int oldfd, int newfd) {
 }

 uptr internal_readlink(const char *path, char *buf, uptr bufsize) {
-#if SANITIZER_NETBSD
-  return internal_syscall_ptr(SYSCALL(readlink), path, buf, bufsize);
-#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
   return internal_syscall(SYSCALL(readlinkat), AT_FDCWD,
                           (uptr)path, (uptr)buf, bufsize);
 #else
-  return internal_syscall(SYSCALL(readlink), (uptr)path, (uptr)buf, bufsize);
+  return internal_syscall_ptr(SYSCALL(readlink), path, buf, bufsize);
 #endif
 }

which dropped the (uptr) cast and broke x32.  This patch puts back the
(uptr) cast to restore x32 and fixes:

https://bugs.llvm.org/show_bug.cgi?id=40783

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

llvm-svn: 354451

5 years agoELF: Remove field for .gdb_index in InStruct. NFC.
Fangrui Song [Wed, 20 Feb 2019 11:34:18 +0000 (11:34 +0000)]
ELF: Remove field for .gdb_index in InStruct. NFC.

Summary: This field is unreferenced outside of createSyntheticSections.

Reviewers: ruiu, pcc, espindola, grimar

Reviewed By: grimar

Subscribers: grimar, emaste, arichardson, arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 354449

5 years ago[clangd] Try to fix windows build bots
Kadir Cetinkaya [Wed, 20 Feb 2019 10:32:04 +0000 (10:32 +0000)]
[clangd] Try to fix windows build bots

llvm-svn: 354444

5 years ago[Codegen] Remove dead flags on Physical Defs in machine cse
David Green [Wed, 20 Feb 2019 10:22:18 +0000 (10:22 +0000)]
[Codegen] Remove dead flags on Physical Defs in machine cse

We may leave behind incorrect dead flags on instructions that are CSE'd. Make
sure we remove the dead flags on physical registers to prevent other incorrect
code motion.

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

llvm-svn: 354443

5 years ago[clangd] Testcase for bug 39811
Kadir Cetinkaya [Wed, 20 Feb 2019 09:41:26 +0000 (09:41 +0000)]
[clangd] Testcase for bug 39811

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354442

5 years ago[llvm-exegesis] Opcode stabilization / reclusterization (PR40715)
Roman Lebedev [Wed, 20 Feb 2019 09:14:04 +0000 (09:14 +0000)]
[llvm-exegesis] Opcode stabilization / reclusterization (PR40715)

Summary:
Given an instruction `Opcode`, we can make benchmarks (measurements) of the
instruction characteristics/performance. Then, to facilitate further analysis
we group the benchmarks with *similar* characteristics into clusters.
Now, this is all not entirely deterministic. Some instructions have variable
characteristics, depending on their arguments. And thus, if we do several
benchmarks of the same instruction `Opcode`, we may end up with *different*
performance characteristics measurements. And when we then do clustering,
these several benchmarks of the same instruction `Opcode` may end up being
clustered into *different* clusters. This is not great for further analysis.

We shall find every `Opcode` with benchmarks not in just one cluster, and move
*all* the benchmarks of said `Opcode` into one new unstable cluster per `Opcode`.

I have solved this by making `ClusterId` a bit field, adding a `IsUnstable` bit,
and introducing `-analysis-display-unstable-clusters` switch to toggle between
displaying stable-only clusters and unstable-only clusters.

The reclusterization is deterministically stable, produces identical reports
between runs. (Or at least that is what i'm seeing, maybe it isn't)

Timings/comparisons:
old (current trunk/head) {F8303582}
```
$ perf stat -r 25 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=0.5 -benchmarks-file=/home/lebedevri/PileDriver-Sched/benchmarks-inverse_throughput.yaml -analysis-inconsistencies-output-file=/tmp/clusters-old.html
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 43970 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-old.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 43970 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-old.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=0.5 -benchmarks-file=/home/lebedevri/PileDriver-Sched/benchmarks-inverse_throughput.yaml -analysis-inconsistencies-output-file=/tmp/clusters-old.html' (25 runs):

           6624.73 msec task-clock                #    0.999 CPUs utilized            ( +-  0.53% )
               172      context-switches          #   25.965 M/sec                    ( +- 29.89% )
                 0      cpu-migrations            #    0.042 M/sec                    ( +- 56.54% )
             31073      page-faults               # 4690.754 M/sec                    ( +-  0.08% )
       26538711696      cycles                    # 4006230.292 GHz                   ( +-  0.53% )  (83.31%)
        2017496807      stalled-cycles-frontend   #    7.60% frontend cycles idle     ( +-  0.93% )  (83.32%)
       13403650062      stalled-cycles-backend    #   50.51% backend cycles idle      ( +-  0.33% )  (33.37%)
       19770706799      instructions              #    0.74  insn per cycle
                                                  #    0.68  stalled cycles per insn  ( +-  0.04% )  (50.04%)
        4419821812      branches                  # 667207369.714 M/sec               ( +-  0.03% )  (66.69%)
         121741669      branch-misses             #    2.75% of all branches          ( +-  0.28% )  (83.34%)

            6.6283 +- 0.0358 seconds time elapsed  ( +-  0.54% )
```

patch, with reclustering but without filtering (i.e. outputting all the stable *and* unstable clusters) {F8303586}
```
$ perf stat -r 25 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=0.5 -benchmarks-file=/home/lebedevri/PileDriver-Sched/benchmarks-inverse_throughput.yaml -analysis-inconsistencies-output-file=/tmp/clusters-new-all.html
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 43970 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-new-all.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 43970 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-new-all.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=0.5 -benchmarks-file=/home/lebedevri/PileDriver-Sched/benchmarks-inverse_throughput.yaml -analysis-inconsistencies-output-file=/tmp/clusters-new-all.html' (25 runs):

           6475.29 msec task-clock                #    0.999 CPUs utilized            ( +-  0.31% )
               213      context-switches          #   32.952 M/sec                    ( +- 23.81% )
                 1      cpu-migrations            #    0.130 M/sec                    ( +- 43.84% )
             31287      page-faults               # 4832.057 M/sec                    ( +-  0.08% )
       25939086577      cycles                    # 4006160.279 GHz                   ( +-  0.31% )  (83.31%)
        1958812858      stalled-cycles-frontend   #    7.55% frontend cycles idle     ( +-  0.68% )  (83.32%)
       13218961512      stalled-cycles-backend    #   50.96% backend cycles idle      ( +-  0.29% )  (33.37%)
       19752995402      instructions              #    0.76  insn per cycle
                                                  #    0.67  stalled cycles per insn  ( +-  0.04% )  (50.04%)
        4417079244      branches                  # 682195472.305 M/sec               ( +-  0.03% )  (66.70%)
         121510065      branch-misses             #    2.75% of all branches          ( +-  0.19% )  (83.34%)

            6.4832 +- 0.0229 seconds time elapsed  ( +-  0.35% )
```
Funnily, *this* measurement shows that said reclustering actually improved performance.

patch, with reclustering, only the stable clusters {F8303594}
```
$ perf stat -r 25 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=0.5 -benchmarks-file=/home/lebedevri/PileDriver-Sched/benchmarks-inverse_throughput.yaml -analysis-inconsistencies-output-file=/tmp/clusters-new-stable.html
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 43970 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-new-stable.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 43970 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-new-stable.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=0.5 -benchmarks-file=/home/lebedevri/PileDriver-Sched/benchmarks-inverse_throughput.yaml -analysis-inconsistencies-output-file=/tmp/clusters-new-stable.html' (25 runs):

           6387.71 msec task-clock                #    0.999 CPUs utilized            ( +-  0.13% )
               133      context-switches          #   20.792 M/sec                    ( +- 23.39% )
                 0      cpu-migrations            #    0.063 M/sec                    ( +- 61.24% )
             31318      page-faults               # 4903.256 M/sec                    ( +-  0.08% )
       25591984967      cycles                    # 4006786.266 GHz                   ( +-  0.13% )  (83.31%)
        1881234904      stalled-cycles-frontend   #    7.35% frontend cycles idle     ( +-  0.25% )  (83.33%)
       13209749965      stalled-cycles-backend    #   51.62% backend cycles idle      ( +-  0.16% )  (33.36%)
       19767554347      instructions              #    0.77  insn per cycle
                                                  #    0.67  stalled cycles per insn  ( +-  0.04% )  (50.03%)
        4417480305      branches                  # 691618858.046 M/sec               ( +-  0.03% )  (66.68%)
         118676358      branch-misses             #    2.69% of all branches          ( +-  0.07% )  (83.33%)

            6.3954 +- 0.0118 seconds time elapsed  ( +-  0.18% )
```
Performance improved even further?! Makes sense i guess, less clusters to print.

patch, with reclustering, only the unstable clusters {F8303601}
```
$ perf stat -r 25 ./bin/llvm-exegesis -mode=analysis -analysis-epsilon=0.5 -benchmarks-file=/home/lebedevri/PileDriver-Sched/benchmarks-inverse_throughput.yaml -analysis-inconsistencies-output-file=/tmp/clusters-new-unstable.html -analysis-display-unstable-clusters
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 43970 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-new-unstable.html'
...
no exegesis target for x86_64-unknown-linux-gnu, using default
Parsed 43970 benchmark points
Printing sched class consistency analysis results to file '/tmp/clusters-new-unstable.html'

 Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=0.5 -benchmarks-file=/home/lebedevri/PileDriver-Sched/benchmarks-inverse_throughput.yaml -analysis-inconsistencies-output-file=/tmp/clusters-new-unstable.html -analysis-display-unstable-clusters' (25 runs):

           6124.96 msec task-clock                #    1.000 CPUs utilized            ( +-  0.20% )
               194      context-switches          #   31.709 M/sec                    ( +- 20.46% )
                 0      cpu-migrations            #    0.039 M/sec                    ( +- 49.77% )
             31413      page-faults               # 5129.261 M/sec                    ( +-  0.06% )
       24536794267      cycles                    # 4006425.858 GHz                   ( +-  0.19% )  (83.31%)
        1676085087      stalled-cycles-frontend   #    6.83% frontend cycles idle     ( +-  0.46% )  (83.32%)
       13035595603      stalled-cycles-backend    #   53.13% backend cycles idle      ( +-  0.16% )  (33.36%)
       18260877653      instructions              #    0.74  insn per cycle
                                                  #    0.71  stalled cycles per insn  ( +-  0.05% )  (50.03%)
        4112411983      branches                  # 671484364.603 M/sec               ( +-  0.03% )  (66.68%)
         114066929      branch-misses             #    2.77% of all branches          ( +-  0.11% )  (83.32%)

            6.1278 +- 0.0121 seconds time elapsed  ( +-  0.20% )
```
This tells us that the actual `-analysis-inconsistencies-output-file=` outputting only takes ~0.4 sec for 43970 benchmark points (3 whole sweeps)
(Also, wow this is fast, it used to take several minutes originally)

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=40715 | PR40715 ]].

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, jdoerfert, llvm-commits, RKSimon

Tags: #llvm

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

llvm-svn: 354441

5 years ago[RegAllocGreedy] Take last chance recoloring into account in split and assign
Mikael Holmen [Wed, 20 Feb 2019 07:14:39 +0000 (07:14 +0000)]
[RegAllocGreedy] Take last chance recoloring into account in split and assign

Summary:
This is a follow-up to r353988 where tryEvict was extended to take last
chance recoloring into account. Now we do the same thing for trySplit and
tryAssign.

Now we always pass a "FixedRegisters" argument to canEvictInterference and
tryEvict so it doesn't need to have a default value anymore.

The need for this was found long ago in an out-of-tree target.
Unfortunately I don't have a reproducer for an in-tree target.

Reviewers: qcolombet, rudkx

Reviewed By: qcolombet, rudkx

Subscribers: rudkx, MatzeB, llvm-commits

Tags: #llvm

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

llvm-svn: 354439

5 years ago[NFC] add/modify wrapper function for findRegisterDefOperand().
Chen Zheng [Wed, 20 Feb 2019 07:01:04 +0000 (07:01 +0000)]
[NFC] add/modify wrapper function for findRegisterDefOperand().

llvm-svn: 354438

5 years ago[DTU] Refine the document of mutation APIs [NFC] (PR40528)
Chijun Sima [Wed, 20 Feb 2019 05:49:01 +0000 (05:49 +0000)]
[DTU] Refine the document of mutation APIs [NFC] (PR40528)

Summary:
It was pointed out in [[ https://bugs.llvm.org/show_bug.cgi?id=40528 | Bug 40528 ]] that it is not clear whether insert/deleteEdge can be used to perform multiple updates and [[ https://reviews.llvm.org/D57316#1388344 | a comment in D57316 ]] reveals that the difference between several ways to update the DominatorTree is confusing.

This patch tries to address issues above.

Reviewers: mkazantsev, kuhar, asbirlea, chandlerc, brzycki

Reviewed By: mkazantsev, kuhar, brzycki

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 354437

5 years ago[X86] Remove FeatureSlowIncDec from Sandy Bridge and later Intel Core CPUs
Craig Topper [Wed, 20 Feb 2019 05:39:11 +0000 (05:39 +0000)]
[X86] Remove FeatureSlowIncDec from Sandy Bridge and later Intel Core CPUs

Summary:
Inc and Dec were at one point slow on Intel CPUs due to their tendency to cause partial flag stalls on P6 derived CPU cores. This is because these instructions are defined to preserve the carry flag. This partial flag stall issue persisted until Sandy Bridge when flag merging was changed to be handled as a data dependency instead of as a stall until retirement. Sandy Bridge and later CPUs rename the C flag separately from OSPAZ so there is no flag merge needed on INC/DEC to preserve the C flag.

Given these improvements I don't know why INC/DEC was ever considered slow on Sandy Bridge. If anything they should have been disabled on the earlier CPUs instead.

Note after this patch, INC/DEC are still considered slow on Silvermont, Goldmont, Knights Landing and our generic "x86-64" CPU.

Reviewers: spatel, RKSimon, chandlerc

Reviewed By: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 354436

5 years agoLimit new PM tests to X86 registered targets.
Leonard Chan [Wed, 20 Feb 2019 05:07:14 +0000 (05:07 +0000)]
Limit new PM tests to X86 registered targets.

llvm-svn: 354435

5 years agoTemporarily Revert "[X86][SLP] Enable SLP vectorization for 128-bit horizontal X86...
Eric Christopher [Wed, 20 Feb 2019 04:42:07 +0000 (04:42 +0000)]
Temporarily Revert "[X86][SLP] Enable SLP vectorization for 128-bit horizontal X86 instructions (add, sub)"

As this has broken the lto bootstrap build for 3 days and is
showing a significant regression on the Dither_benchmark results (from
the LLVM benchmark suite) -- specifically, on the
BENCHMARK_FLOYD_DITHER_128, BENCHMARK_FLOYD_DITHER_256, and
BENCHMARK_FLOYD_DITHER_512; the others are unchanged.  These have
regressed by about 28% on Skylake, 34% on Haswell, and over 40% on
Sandybridge.

This reverts commit r353923.

llvm-svn: 354434

5 years ago[Dominators] Simplify and optimize path compression used in link-eval forest.
Fangrui Song [Wed, 20 Feb 2019 04:39:42 +0000 (04:39 +0000)]
[Dominators] Simplify and optimize path compression used in link-eval forest.

Summary:
* NodeToInfo[*] have been allocated so the addresses are stable. We can store them instead of NodePtr to save NumToNode lookups.
* Nodes are traversed twice. Using `Visited` to check the traversal number is expensive and obscure. Just split the two traversals into two loops explicitly.
* The check `VInInfo.DFSNum < LastLinked` is redundant as it is implied by `VInInfo->Parent < LastLinked`
* VLabelInfo PLabelInfo are used to save a NodeToInfo lookup in the second traversal.

Also add some comments explaining eval().

This shows a ~4.5% improvement (9.8444s -> 9.3996s) on

    perf stat -r 10 taskset -c 0 opt -passes=$(printf '%.0srequire<domtree>,invalidate<domtree>,' {1..1000})'require<domtree>' -disable-output sqlite-autoconf-3270100/sqlite3.bc

Reviewers: kuhar, sanjoy, asbirlea

Reviewed By: kuhar

Subscribers: brzycki, NutshellySima, kristina, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 354433

5 years agoRemove test on incompatible mpis target.
Leonard Chan [Wed, 20 Feb 2019 04:35:28 +0000 (04:35 +0000)]
Remove test on incompatible mpis target.

llvm-svn: 354432

5 years ago[NewPM] Add other sanitizers at O0
Leonard Chan [Wed, 20 Feb 2019 03:50:11 +0000 (03:50 +0000)]
[NewPM] Add other sanitizers at O0

This allows for MSan and TSan to be used without optimizations required.

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

llvm-svn: 354431

5 years ago[RISCV] Implement pseudo instructions for load/store from a symbol address.
Kito Cheng [Wed, 20 Feb 2019 03:31:32 +0000 (03:31 +0000)]
[RISCV] Implement pseudo instructions for load/store from a symbol address.

Summary:
Those pseudo-instructions are making load/store instructions able to
load/store from/to a symbol, and its always using PC-relative addressing
to generating a symbol address.

Reviewers: asb, apazos, rogfer01, jrtc27

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

llvm-svn: 354430

5 years ago[Dominators] Delete UpdateLevelsAfterInsertion in edge insertion of depth-based searc...
Fangrui Song [Wed, 20 Feb 2019 02:35:24 +0000 (02:35 +0000)]
[Dominators] Delete UpdateLevelsAfterInsertion in edge insertion of depth-based search for release builds

Summary:
After insertion of (From, To), v is affected iff
depth(NCD)+1 < depth(v) && path P from To to v exists where every w on P s.t. depth(v) <= depth(w)

All affected vertices change their idom to NCD.

If a vertex u has changed its depth, it must be a descendant of an
affected vertex v. Its depth must have been updated by UpdateLevel()
called by setIDom() of the first affected ancestor.

So UpdateLevelsAfterInsertion and its bookkeeping variable VisitedNotAffectedQueue are redundant.
Run them only in debug builds as a sanity check.

Reviewers: kuhar

Reviewed By: kuhar

Subscribers: kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 354429

5 years agoELF: Remove field for .interp in InStruct. NFC.
Peter Collingbourne [Wed, 20 Feb 2019 02:32:53 +0000 (02:32 +0000)]
ELF: Remove field for .interp in InStruct. NFC.

This field is unreferenced outside of createSyntheticSections.

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

llvm-svn: 354428

5 years ago[PowerPC] exploit P9 instruction maddld.
Chen Zheng [Wed, 20 Feb 2019 02:30:06 +0000 (02:30 +0000)]
[PowerPC] exploit P9 instruction maddld.
Differential Revision: https://reviews.llvm.org/D58364

llvm-svn: 354427

5 years ago[WebAssembly] Generalize section ordering constraints
Thomas Lively [Wed, 20 Feb 2019 02:22:36 +0000 (02:22 +0000)]
[WebAssembly] Generalize section ordering constraints

Summary:
Changes from using a total ordering of known sections to using a
dependency graph approach. This allows our tools to accept and process
binaries that are compliant with the spec and tool conventions that
would have been previously rejected. It also means our own tools can
do less work to enforce an artificially imposed ordering. Using a
general mechanism means fewer special cases and exceptions in the
ordering logic.

Reviewers: aheejin, dschuff

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

Tags: #llvm

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

llvm-svn: 354426

5 years ago[TestModuleCXX] Use UNSUPPORTED instead of REQUIRES
Jonas Devlieghere [Wed, 20 Feb 2019 01:49:16 +0000 (01:49 +0000)]
[TestModuleCXX] Use UNSUPPORTED instead of REQUIRES

The requires value turns out to be bogus and the test gets skipped on
macOS.

llvm-svn: 354425

5 years ago[Instrumentation] Make API logging unconditional
Jonas Devlieghere [Wed, 20 Feb 2019 01:49:13 +0000 (01:49 +0000)]
[Instrumentation] Make API logging unconditional

We should always log API calls in addition to logging whether the call
was recorded as part of the reproducer. Since we already have the macro
we might as well put that logic there.

llvm-svn: 354424

5 years ago[lldb-instr] Group RECORD macros
Jonas Devlieghere [Wed, 20 Feb 2019 01:49:10 +0000 (01:49 +0000)]
[lldb-instr] Group RECORD macros

Group LLDB_RECORD macros per input file.

llvm-svn: 354423

5 years agoELF: Fix typo in --build-id option description
Tom Stellard [Wed, 20 Feb 2019 01:40:35 +0000 (01:40 +0000)]
ELF: Fix typo in --build-id option description

Reviewers: ruiu, espindola

Reviewed By: ruiu

Subscribers: emaste, arichardson, llvm-commits

Tags: #llvm

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

llvm-svn: 354422

5 years ago[WebAssembly] Refactor atomic operation definitions (NFC)
Heejin Ahn [Wed, 20 Feb 2019 01:29:34 +0000 (01:29 +0000)]
[WebAssembly] Refactor atomic operation definitions (NFC)

Summary:
- Make `ATOMIC_I`, `ATOMIC_NRI`, `AtomicLoad`, `AtomicStore` classes and
  make other operations inherit from them
- Factor the common opcode prefix '0xfe' out from the opcodes into the
  common class
- Reorder instructions in the order of increasing opcodes

Reviewers: tlively

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

Tags: #llvm

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

llvm-svn: 354421

5 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Wed, 20 Feb 2019 01:24:59 +0000 (01:24 +0000)]
[InstCombine] regenerate test checks; NFC

llvm-svn: 354420

5 years ago[WebAssembly] Fix load/store name detection for atomic instructions
Heejin Ahn [Wed, 20 Feb 2019 01:14:36 +0000 (01:14 +0000)]
[WebAssembly] Fix load/store name detection for atomic instructions

Summary:
Fixed a bug in the routine in AsmParser that determines whether the
current instruction is a load or a store. Atomic instructions' prefixes
are not `atomic_` but `atomic.`, and all atomic instructions are also
memory instructions. Also fixed the printing format of atomic
instructions to match other memory instructions and added encoding tests
for atomic instructions.

Reviewers: aardappel, tlively

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

Tags: #llvm

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

llvm-svn: 354419

5 years agoMove -fcxx-modules to MANDATORY_MODULE_BUILD_CFLAGS (NFC)
Adrian Prantl [Wed, 20 Feb 2019 01:14:05 +0000 (01:14 +0000)]
Move -fcxx-modules to MANDATORY_MODULE_BUILD_CFLAGS (NFC)

llvm-svn: 354418

5 years agoCMake: Fix stand-alone clang builds since r353268
Tom Stellard [Wed, 20 Feb 2019 01:11:05 +0000 (01:11 +0000)]
CMake: Fix stand-alone clang builds since r353268

Summary:
Handle the case where LLVM_MAIN_SRC_DIR is not set and also use
LLVM_CMAKE_DIR for locating installed cmake files rather than
LLVM_CMAKE_PATH.

Reviewers: phosek, andrewrk, smeenai

Reviewed By: phosek, andrewrk, smeenai

Subscribers: mgorny, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 354417

5 years ago[WebAssembly] Fixed disassembler not knowing about OPERAND_EVENT
Wouter van Oortmerssen [Wed, 20 Feb 2019 00:55:59 +0000 (00:55 +0000)]
[WebAssembly] Fixed disassembler not knowing about OPERAND_EVENT

Reviewers: aheejin

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

Tags: #llvm

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

llvm-svn: 354416

5 years ago[lldbtest] Remove some accidentally commented out code.
Davide Italiano [Wed, 20 Feb 2019 00:54:10 +0000 (00:54 +0000)]
[lldbtest] Remove some accidentally commented out code.

llvm-svn: 354415

5 years ago[testsuite] Fix TestUnicodeString to work with Py2 and Py3.
Davide Italiano [Wed, 20 Feb 2019 00:54:07 +0000 (00:54 +0000)]
[testsuite] Fix TestUnicodeString to work with Py2 and Py3.

llvm-svn: 354414

5 years agogn build: Merge r354365 more
Nico Weber [Wed, 20 Feb 2019 00:34:19 +0000 (00:34 +0000)]
gn build: Merge r354365 more

llvm-svn: 354413

5 years ago[GVN] Small tweaks to comments, style, and missed vector handling
Philip Reames [Wed, 20 Feb 2019 00:31:28 +0000 (00:31 +0000)]
[GVN] Small tweaks to comments, style, and missed vector handling

Noticed these while doing a final sweep of the code to make sure I hadn't missed anything in my last couple of patches.  The (minor) missed optimization was noticed because of the stylistic fix to avoid an overly specific cast.

llvm-svn: 354412

5 years agogn build: Merge r354365
Nico Weber [Wed, 20 Feb 2019 00:30:08 +0000 (00:30 +0000)]
gn build: Merge r354365

llvm-svn: 354411

5 years ago[lld-link] preserve @llvm.used symbols in LTO
Bob Haarman [Wed, 20 Feb 2019 00:26:01 +0000 (00:26 +0000)]
[lld-link] preserve @llvm.used symbols in LTO

Summary:
We translate @llvm.used to COFF by generating /include directives
in the .drectve section. However, in LTO links, this happens after
directives have already been processed, so the new directives do
not take effect. This change marks @llvm.used symbols as GCRoots
so that they are preserved as intended.

Fixes PR40733.

Reviewers: rnk, pcc, ruiu

Reviewed By: ruiu

Subscribers: mehdi_amini, steven_wu, dexonsmith, dang, llvm-commits

Tags: #llvm

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

llvm-svn: 354410

5 years ago[BPF] make test case reloc-btf.ll tolerable for old compilers
Yonghong Song [Wed, 20 Feb 2019 00:22:19 +0000 (00:22 +0000)]
[BPF] make test case reloc-btf.ll tolerable for old compilers

The test case reloc-btf.ll is generated with an IR containing
spFlags introduced by https://reviews.llvm.org/rL347806.
In the case of BTF backporting, the old compiler may not
have this patch, so this test will fail during
validation.

This patch removed spFlags from IR in the test case
and used the old way for various flags.

Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 354409

5 years agoRevert "[InstSimplify] use any-zero matcher for fcmp folds"
Sanjay Patel [Wed, 20 Feb 2019 00:20:38 +0000 (00:20 +0000)]
Revert "[InstSimplify] use any-zero matcher for fcmp folds"

This reverts commit 058bb8351351d56d2a4e8a772570231f9e5305e5.
Forgot to update another test affected by this change.

llvm-svn: 354408

5 years ago[GVN] Fix last crasher w/non-integral pointers
Philip Reames [Wed, 20 Feb 2019 00:15:54 +0000 (00:15 +0000)]
[GVN] Fix last crasher w/non-integral pointers

Same case as for memset and memcpy, but this time for clobbering stores and loads.  We still can't allow coercion to or from non-integrals, regardless of the transform.

Now that I'm done the whole little sequence, it seems apparent that we'd entirely missed reasoning about clobbers in the original GVN support for non-integral pointers.

My appologies, I thought we'd upstreamed all of this, but it turns out we were still carrying a downstream hack which hid all of these issues.  My chanks to Cherry Zhang for helping debug.

llvm-svn: 354407

5 years ago[InstSimplify] use any-zero matcher for fcmp folds
Sanjay Patel [Wed, 20 Feb 2019 00:09:50 +0000 (00:09 +0000)]
[InstSimplify] use any-zero matcher for fcmp folds

The m_APFloat matcher does not work with anything but strict
splat vector constants, so we could miss these folds and then
trigger an assertion in instcombine:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13201

llvm-svn: 354406

5 years agoSort enum members so that arch-dependent members are at the right place. NFC.
Rui Ueyama [Wed, 20 Feb 2019 00:01:21 +0000 (00:01 +0000)]
Sort enum members so that arch-dependent members are at the right place. NFC.

llvm-svn: 354405

5 years ago[InstSimplify] add vector tests for fcmp+fabs; NFC
Sanjay Patel [Tue, 19 Feb 2019 23:58:02 +0000 (23:58 +0000)]
[InstSimplify] add vector tests for fcmp+fabs; NFC

llvm-svn: 354404

5 years ago[GVN] Fix a crash bug w/non-integral pointers and memtransfers
Philip Reames [Tue, 19 Feb 2019 23:49:38 +0000 (23:49 +0000)]
[GVN] Fix a crash bug w/non-integral pointers and memtransfers

Problem is very similiar to the one fixed for memsets in r354399, we try to coerce a value to non-integral type, and then crash while try to do so.  Since we shouldn't be doing such coercions to start with, easy fix.  From inspection, I see two other cases which look to be similiar and will follow up with most test cases and fixes if confirmed.

llvm-svn: 354403

5 years ago[msan] Fix name_to_handle_at test on overlayfs.
Evgeniy Stepanov [Tue, 19 Feb 2019 23:41:42 +0000 (23:41 +0000)]
[msan] Fix name_to_handle_at test on overlayfs.

Udev supports name_to_handle_at. Use /dev/null instead of /bin/cat.

llvm-svn: 354402

5 years ago[GVN] Fix a non-integral pointer bug w/vector types
Philip Reames [Tue, 19 Feb 2019 23:19:51 +0000 (23:19 +0000)]
[GVN] Fix a non-integral pointer bug w/vector types

GVN generally doesn't forward structs or array types, but it *will* forward vector types to non-vectors and vice versa.  As demonstrated in tests, we need to inhibit the same set of transforms for vector of non-integral pointers as for non-integral pointers themselves.

llvm-svn: 354401

5 years ago[lldb-instr] Don't print REGISTER macro when RECORD is already present
Jonas Devlieghere [Tue, 19 Feb 2019 23:13:29 +0000 (23:13 +0000)]
[lldb-instr] Don't print REGISTER macro when RECORD is already present

Currently we'd always print the LLDB_REGISTER macro, even if the
LLDB_RECORD macro was already present. This patches changes that to make
it easier to incrementally update the macros.

Note that it's still possible for the RECORD and REGISTER macros to get
out of sync.

llvm-svn: 354400

5 years ago[GVN] Fix a crash bug around non-integral pointers
Philip Reames [Tue, 19 Feb 2019 23:07:15 +0000 (23:07 +0000)]
[GVN] Fix a crash bug around non-integral pointers

If we encountered a location where we tried to forward the value of a memset to a load of a non-integral pointer, we crashed.  Such a forward is not legal in general, but we can forward null pointers.  Test for both cases are included.

llvm-svn: 354399

5 years ago[Test] Autogenerate existing tests before adding more
Philip Reames [Tue, 19 Feb 2019 22:57:30 +0000 (22:57 +0000)]
[Test] Autogenerate existing tests before adding more

llvm-svn: 354398

5 years ago[WebAssembly] Update MC for bulk memory
Thomas Lively [Tue, 19 Feb 2019 22:56:19 +0000 (22:56 +0000)]
[WebAssembly] Update MC for bulk memory

Summary:
Rename MemoryIndex to InitFlags and implement logic for determining
data segment layout in ObjectYAML and MC. Also adds a "passive" flag
for the .section assembler directive although this cannot be assembled
yet because the assembler does not support data sections.

Reviewers: sbc100, aardappel, aheejin, dschuff

Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 354397

5 years ago[X86] Mark FP32_TO_INT16_IN_MEM/FP32_TO_INT32_IN_MEM/FP32_TO_INT64_IN_MEM as clobberi...
Craig Topper [Tue, 19 Feb 2019 22:37:00 +0000 (22:37 +0000)]
[X86] Mark FP32_TO_INT16_IN_MEM/FP32_TO_INT32_IN_MEM/FP32_TO_INT64_IN_MEM as clobbering EFLAGS to prevent mis-scheduling during conversion from SelectionDAG to MIR.

After r354178, these instruction expand to a sequence that uses an OR instruction. That OR clobbers EFLAGS so we need to state that to avoid accidentally using the clobbered flags.

Our tests show the bug, but I didn't notice because the SETcc instructions didn't move after r354178 since it used to be safe to do the fp->int conversion first.

We should probably convert this whole sequence to SelectionDAG instead of a custom inserter to avoid mistakes like this.

Fixes PR40779

llvm-svn: 354395

5 years ago[LangRef] add to description of alloca instruction
Sanjay Patel [Tue, 19 Feb 2019 22:35:12 +0000 (22:35 +0000)]
[LangRef] add to description of alloca instruction

As mentioned in D58359, we can explicitly state that the
memory allocated is uninitialized and reading that memory
produces undef.

llvm-svn: 354394

5 years ago[InstCombine] reduce even more unsigned saturated add with 'not' op
Sanjay Patel [Tue, 19 Feb 2019 22:14:21 +0000 (22:14 +0000)]
[InstCombine] reduce even more unsigned saturated add with 'not' op

We want to use the sum in the icmp to allow matching with
m_UAddWithOverflow and eliminate the 'not'. This is discussed
in D51929 and is another step towards solving PR14613:
https://bugs.llvm.org/show_bug.cgi?id=14613

  Name: uaddsat, -1 fval
  %notx = xor i32 %x, -1
  %a = add i32 %x, %y
  %c = icmp ugt i32 %notx, %y
  %r = select i1 %c, i32 %a, i32 -1
  =>
  %a = add i32 %x, %y
  %c2 = icmp ugt i32 %y, %a
  %r = select i1 %c2, i32 -1, i32 %a

  Name: uaddsat, -1 fval + ult
  %notx = xor i32 %x, -1
  %a = add i32 %x, %y
  %c = icmp ult i32 %y, %notx
  %r = select i1 %c, i32 %a, i32 -1
  =>
  %a = add i32 %x, %y
  %c2 = icmp ugt i32 %y, %a
  %r = select i1 %c2, i32 -1, i32 %a

https://rise4fun.com/Alive/nTp

llvm-svn: 354393

5 years ago[libFuzzer] docs: add a FAQ entry about dlclose
Kostya Serebryany [Tue, 19 Feb 2019 22:11:50 +0000 (22:11 +0000)]
[libFuzzer] docs: add a FAQ entry about dlclose

llvm-svn: 354392

5 years agoMove MinGW-specific code out of LinkerDriver::link. NFC.
Rui Ueyama [Tue, 19 Feb 2019 22:06:44 +0000 (22:06 +0000)]
Move MinGW-specific code out of LinkerDriver::link. NFC.

LinkerDriver::link is getting too long, it's time to simplify it.

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

llvm-svn: 354391

5 years agosecond test on git-llvm-push
Renato Golin [Tue, 19 Feb 2019 22:06:27 +0000 (22:06 +0000)]
second test on git-llvm-push

llvm-svn: 354390

5 years agoFix builds with llvm/runtimes/compiler-rt after r354365
Daniel Sanders [Tue, 19 Feb 2019 22:02:38 +0000 (22:02 +0000)]
Fix builds with llvm/runtimes/compiler-rt after r354365

Compiler-rt doesn't include config-ix which was providing CheckSymbolExists to
the LLVM build. Add it to HandleLLVMOptions to fix this

llvm-svn: 354389

5 years ago[ArgumentPromotion] Add a lit.local.cfg to disable X86 specific tests if the X86...
Craig Topper [Tue, 19 Feb 2019 21:58:23 +0000 (21:58 +0000)]
[ArgumentPromotion] Add a lit.local.cfg to disable X86 specific tests if the X86 target doesn't exist.

Hopefully this fixes some buildbot failure after r354376

llvm-svn: 354388

5 years ago[MinGW] Hook up the --exclude-all-symbols option
Martin Storsjo [Tue, 19 Feb 2019 21:57:49 +0000 (21:57 +0000)]
[MinGW] Hook up the --exclude-all-symbols option

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

llvm-svn: 354387

5 years ago[COFF] Add -exclude-all-symbols for MinGW
Martin Storsjo [Tue, 19 Feb 2019 21:57:44 +0000 (21:57 +0000)]
[COFF] Add -exclude-all-symbols for MinGW

This is a private undocumented option, intended to be used by
the MinGW driver frontend.

Also restructure the condition to put if (Config->MinGW) first.
This changes the behaviour for the tautological combination of
-export-all-symbols without -lldmingw.

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

llvm-svn: 354386

5 years agoAdd Facebook Minidump directory streams and options to dump them.
Greg Clayton [Tue, 19 Feb 2019 21:48:34 +0000 (21:48 +0000)]
Add Facebook Minidump directory streams and options to dump them.

Facebook creates minidump files that contain specific information about why things crash. Adding ways to dump these allows tools to be made that can auto download symbols based on the information that is contained in the minidump files.

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

llvm-svn: 354385

5 years ago[InstCombine] rearrange saturated add folds; NFC
Sanjay Patel [Tue, 19 Feb 2019 21:46:13 +0000 (21:46 +0000)]
[InstCombine] rearrange saturated add folds; NFC

This is no-functional-change-intended, but that was also
true when it was part of rL354276, and I managed to lose
2 predicates for the fold with constant...causing much bot
distress. So this time I'm adding a couple of negative tests
to avoid that.

llvm-svn: 354384

5 years agoTesting git-llvm-push script
Renato Golin [Tue, 19 Feb 2019 21:32:05 +0000 (21:32 +0000)]
Testing git-llvm-push script

llvm-svn: 354383

5 years agoPowerPC: Fix typos in comments
Jinsong Ji [Tue, 19 Feb 2019 21:25:13 +0000 (21:25 +0000)]
PowerPC: Fix typos in comments

llvm-svn: 354382

5 years ago[ConstantFold] Fix misfolding fcmp of a ConstantExpr NaN with itself.
Andrew Scheidecker [Tue, 19 Feb 2019 21:21:54 +0000 (21:21 +0000)]
[ConstantFold] Fix misfolding fcmp of a ConstantExpr NaN with itself.

The code incorrectly inferred that the relationship of a constant expression
to itself is FCMP_OEQ (ordered and equal), when it's actually FCMP_UEQ
(unordered *or* equal). This change corrects that, and adds some more limited
folds that can be done in this case.

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

llvm-svn: 354381

5 years ago[ConstantFold] Fix misfolding of icmp with a bitcast FP second operand.
Andrew Scheidecker [Tue, 19 Feb 2019 21:03:20 +0000 (21:03 +0000)]
[ConstantFold] Fix misfolding of icmp with a bitcast FP second operand.

In the process of trying to eliminate the bitcast, this was producing a
malformed icmp with FP operands.

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

llvm-svn: 354380

5 years ago[llvm-cov] Add support for gcov --hash-filenames option
Vedant Kumar [Tue, 19 Feb 2019 20:45:00 +0000 (20:45 +0000)]
[llvm-cov] Add support for gcov --hash-filenames option

The patch adds support for --hash-filenames to llvm-cov. This option adds md5
hash of the source path to the name of the generated .gcov file. The option is
crucial for cases where you have multiple files with the same name but can't
use --preserve-paths as resulting filenames exceed the limit.

from gcov(1):

```
-x
--hash-filenames
    By default, gcov uses the full pathname of the source files to to
    create an output filename.  This can lead to long filenames that
    can overflow filesystem limits.  This option creates names of the
    form source-file##md5.gcov, where the source-file component is
    the final filename part and the md5 component is calculated from
    the full mangled name that would have been used otherwise.
```

Patch by Igor Ignatev!

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

llvm-svn: 354379