platform/upstream/llvm.git
5 years agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Fri, 29 Mar 2019 13:43:00 +0000 (13:43 +0000)]
Fix MSVC "not all control paths return a value" warning. NFCI.

llvm-svn: 357253

5 years agoSwitch lowering: exploit unreachable fall-through when lowering case range cluster
Hans Wennborg [Fri, 29 Mar 2019 13:40:05 +0000 (13:40 +0000)]
Switch lowering: exploit unreachable fall-through when lowering case range cluster

In the example below, we would previously emit two range checks, one for cases
1--3 and one for 4--6. This patch makes us exploit the fact that the
fall-through is unreachable and only one range check is necessary.

  switch i32 %i, label %default [
    i32 1,  label %bb1
    i32 2,  label %bb1
    i32 3,  label %bb1
    i32 4,  label %bb2
    i32 5,  label %bb2
    i32 6,  label %bb2
  ]
  default: unreachable

llvm-svn: 357252

5 years ago[x86] add tests for decrement+sext; NFC
Sanjay Patel [Fri, 29 Mar 2019 13:34:48 +0000 (13:34 +0000)]
[x86] add tests for decrement+sext; NFC

llvm-svn: 357251

5 years ago[AArch64] Support selecting TPIDR_EL[1-3] as the thread base
Oliver Stannard [Fri, 29 Mar 2019 13:32:41 +0000 (13:32 +0000)]
[AArch64] Support selecting TPIDR_EL[1-3] as the thread base

Add an -mtp=el[0-3] option to select which of the AArch64 thread ID registers
will be used for the TLS base pointer.

This is a followup to rL356657 which added subtarget features to enable
accesses to the privileged thread ID registers.

Patch by Philip Derrin!

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

llvm-svn: 357250

5 years ago[AMDGPU][MC] Corrected handling of tied src for atomic return MUBUF opcodes
Dmitry Preobrazhensky [Fri, 29 Mar 2019 12:16:04 +0000 (12:16 +0000)]
[AMDGPU][MC] Corrected handling of tied src for atomic return MUBUF opcodes

See bug 40917: https://bugs.llvm.org/show_bug.cgi?id=40917

Reviewers: artem.tamazov, arsenm

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

llvm-svn: 357249

5 years ago[MCA] Add an experimental MicroOpQueue stage.
Andrea Di Biagio [Fri, 29 Mar 2019 12:15:37 +0000 (12:15 +0000)]
[MCA] Add an experimental MicroOpQueue stage.

This patch adds an experimental stage named MicroOpQueueStage.
MicroOpQueueStage can be used to simulate a hardware micro-op queue (basically,
a decoupling queue between 'decode' and 'dispatch').  Users can specify a queue
size, as well as a optional MaxIPC (which - in the absence of a "Decoders" stage
- can be used to simulate a different throughput from the decoders).

This stage is added to the default pipeline between the EntryStage and the
DispatchStage only if PipelineOption::MicroOpQueue is different than zero. By
default, llvm-mca sets PipelineOption::MicroOpQueue to the value of hidden flag
-micro-op-queue-size.

Throughput from the decoder can be simulated via another hidden flag named
-decoder-throughput.  That flag allows us to quickly experiment with different
frontend throughputs.  For targets that declare a loop buffer, flag
-decoder-throughput allows users to do multiple runs, each time simulating a
different throughput from the decoders.

This stage can/will be extended in future. For example, we could add a "buffer
full" event to notify bottlenecks caused by backpressure. flag
-decoder-throughput would probably go away if in future we delegate to another
stage (DecoderStage?) the simulation of a (potentially variable) throughput from
the decoders. For now, flag -decoder-throughput is "good enough" to run some
simple experiments.

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

llvm-svn: 357248

5 years agoAMDGPU: Make sram-ecc off by default for Vega20
Konstantin Zhuravlyov [Fri, 29 Mar 2019 12:04:18 +0000 (12:04 +0000)]
AMDGPU: Make sram-ecc off by default for Vega20

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

llvm-svn: 357247

5 years ago[llvm-readelf]Merge dynamic and static relocation printing to avoid code duplication
James Henderson [Fri, 29 Mar 2019 11:47:19 +0000 (11:47 +0000)]
[llvm-readelf]Merge dynamic and static relocation printing to avoid code duplication

The majority of the printRelocation and printDynamicRelocation functions
were identical. This patch factors this all out into a new function.
There are a couple of minor differences to do with printing of symbols
without names, but I think these are harmless, and in some cases a small
improvement.

Reviewed by: grimar, rupprecht, Higuoxing

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

llvm-svn: 357246

5 years ago[NFC][llvm-exegesis] Refactor Analysis::SchedClassCluster::measurementsMatch()
Roman Lebedev [Fri, 29 Mar 2019 11:36:08 +0000 (11:36 +0000)]
[NFC][llvm-exegesis] Refactor Analysis::SchedClassCluster::measurementsMatch()

Summary:
The diff looks scary but it really isn't:
1. I moved the check for the number of measurements into `SchedClassClusterCentroid::validate()`
2. While there, added a check that we can only have a single inverse throughput measurement. I missed that when adding it initially.
3. In `Analysis::SchedClassCluster::measurementsMatch()` is called with the current LLVM values from schedule class and the values from Centroid.
3.1. The values from centroid we can already get from `SchedClassClusterCentroid::getAsPoint()`.
     This isn't 100% a NFC, because previously for inverse throughput we used `min()`. I have asked whether i have done that correctly in
     https://reviews.llvm.org/D57647?id=184939#inline-510384 but did not hear back. I think `avg()` should be used too, thus it is a fix.
3.2. Finally, refactor the computation of the LLVM-specified values into `Analysis::SchedClassCluster::getSchedClassPoint()`
     I will need that function for [[ https://bugs.llvm.org/show_bug.cgi?id=41275 | PR41275 ]]

Reviewers: courbet, gchatelet

Reviewed By: courbet

Subscribers: tschuett, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 357245

5 years ago[X86] Add X86TargetLowering::isCommutativeBinOp override.
Simon Pilgrim [Fri, 29 Mar 2019 11:25:58 +0000 (11:25 +0000)]
[X86] Add X86TargetLowering::isCommutativeBinOp override.

We currently just have test coverage for PMULUDQ - will add more in the future.

llvm-svn: 357244

5 years ago[SLP] Add support for swapping icmp/fcmp predicates to permit vectorization
Simon Pilgrim [Fri, 29 Mar 2019 10:41:00 +0000 (10:41 +0000)]
[SLP] Add support for swapping icmp/fcmp predicates to permit vectorization

We should be able to match elements with the swapped predicate as well - as long as we commute the source operands.

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

llvm-svn: 357243

5 years ago[PowerPC] Add the support for __builtin_setrnd() in clang
Kang Zhang [Fri, 29 Mar 2019 09:11:52 +0000 (09:11 +0000)]
[PowerPC] Add the support for __builtin_setrnd() in clang

Summary:
PowerPC64/PowerPC64le supports the builtin function __builtin_setrnd to set the floating point rounding mode. This function will use the least significant two bits of integer argument to set the floating point rounding mode.
double __builtin_setrnd(int mode);
The effective values for mode are:
0 - round to nearest
1 - round to zero
2 - round to +infinity
3 - round to -infinity
Note that the mode argument will modulo 4, so if the int argument is greater than 3, it will only use the least significant two bits of the mode. Namely, builtin_setrnd(102)) is equal to builtin_setrnd(2).

Reviewed By: jsji

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

llvm-svn: 357242

5 years ago[PowerPC] Add the support for __builtin_setrnd()
Kang Zhang [Fri, 29 Mar 2019 08:45:24 +0000 (08:45 +0000)]
[PowerPC] Add the support for __builtin_setrnd()

Summary:
PowerPC64/PowerPC64le supports the builtin function __builtin_setrnd to set the floating point rounding mode. This function will use the least significant two bits of integer argument to set the floating point rounding mode.
double __builtin_setrnd(int mode);
The effective values for mode are:
0 - round to nearest
1 - round to zero
2 - round to +infinity
3 - round to -infinity
Note that the mode argument will modulo 4, so if the int argument is greater than 3, it will only use the least significant two bits of the mode. Namely, builtin_setrnd(102)) is equal to builtin_setrnd(2).

Reviewed By: jsji

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

llvm-svn: 357241

5 years ago[Sanitizer] Add interceptor for wctomb
Pavel Labath [Fri, 29 Mar 2019 08:39:03 +0000 (08:39 +0000)]
[Sanitizer] Add interceptor for wctomb

Summary:
This is required to avoid msan false positives for code using this
function (although generally one should avoid using this function in
favor of wcrtomb).

Reviewers: eugenis, EricWF, vitalybuka

Subscribers: srhines, kubamracek, fedor.sergeev, delcypher, llvm-commits, #sanitizers

Tags: #llvm, #sanitizers

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

llvm-svn: 357240

5 years ago[ScheduleDAG] Move `Topo` and `addEdge` to base class.
Clement Courbet [Fri, 29 Mar 2019 08:33:05 +0000 (08:33 +0000)]
[ScheduleDAG] Move `Topo` and `addEdge` to base class.

Some DAG mutations can only be applied to `ScheduleDAGMI`, and have to
internally cast a `ScheduleDAGInstrs` to `ScheduleDAGMI`.

There is nothing actually specific to `ScheduleDAGMI` in `Topo`.

llvm-svn: 357239

5 years ago[llvm-objcopy] Delete two redundant reinterpret_cast. NFC
Fangrui Song [Fri, 29 Mar 2019 08:08:20 +0000 (08:08 +0000)]
[llvm-objcopy] Delete two redundant reinterpret_cast. NFC

llvm-svn: 357238

5 years agoTest commit. Fix typo.
Jim Lin [Fri, 29 Mar 2019 05:05:21 +0000 (05:05 +0000)]
Test commit. Fix typo.

llvm-svn: 357237

5 years ago[Sema] Fix a crash when nonnull checking
Michael Liao [Fri, 29 Mar 2019 03:55:52 +0000 (03:55 +0000)]
[Sema] Fix a crash when nonnull checking

Summary:
- If a parameter is used, nonnull checking needs function prototype to
  retrieve the corresponding parameter's attributes. However, at the
  prototype substitution phase when a template is being instantiated,
  expression may be created and checked without a fully specialized
  prototype. Under such a scenario, skip nonnull checking on that
  argument.

Reviewers: rjmccall, tra, yaxunl

Subscribers: javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

llvm-svn: 357236

5 years agoAMDGPU/GlobalISel: Insert waterfall loop for vector indexing
Matt Arsenault [Fri, 29 Mar 2019 03:54:56 +0000 (03:54 +0000)]
AMDGPU/GlobalISel: Insert waterfall loop for vector indexing

The register index can only really be an SGPR. Lie that a VGPR index
is legal, and then rewrite the instruction in a waterfall loop to
handle the index.

llvm-svn: 357235

5 years ago[PowerPC] Strength reduction of multiply by a constant by shift and add/sub in place
Zi Xuan Wu [Fri, 29 Mar 2019 03:08:39 +0000 (03:08 +0000)]
[PowerPC] Strength reduction of multiply by a constant by shift and add/sub in place

A shift and add/sub sequence combination is faster in place of a multiply by constant.
Because the cycle or latency of multiply is not huge, we only consider such following
worthy patterns.

```
(mul x, 2^N + 1) => (add (shl x, N), x)
(mul x, -(2^N + 1)) => -(add (shl x, N), x)
(mul x, 2^N - 1) => (sub (shl x, N), x)
(mul x, -(2^N - 1)) => (sub x, (shl x, N))
```

And the cycles or latency is subtarget-dependent so that we need consider the
subtarget to determine to do or not do such transformation.
Also data type is considered for different cycles or latency to do multiply.

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

llvm-svn: 357233

5 years agogn build: Add check-clang-tools to run clang-tools-extra lit tests
Nico Weber [Fri, 29 Mar 2019 02:49:13 +0000 (02:49 +0000)]
gn build: Add check-clang-tools to run clang-tools-extra lit tests

Only runs the clang-tools-extra lit tests; not yet the unit tests.

Add a build file for clangd-indexer too, since it's needed for
the tests.

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

llvm-svn: 357232

5 years agoAdd .py extension to clang-tools-extra lit cfg files
Nico Weber [Fri, 29 Mar 2019 02:46:31 +0000 (02:46 +0000)]
Add .py extension to clang-tools-extra lit cfg files

Follow-up to r313892, which did this for clang and llvm.

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

llvm-svn: 357231

5 years ago[llvm-readobj] Change variable names to match LLVM-style. NFC.
Xing GUO [Fri, 29 Mar 2019 01:26:36 +0000 (01:26 +0000)]
[llvm-readobj] Change variable names to match LLVM-style. NFC.

Summary: This patch helps change variable names to match LLVM-style

Reviewers: jhenderson, Higuoxing

Reviewed By: Higuoxing

Subscribers: rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 357230

5 years ago[CodeGen][ObjC] Adjust the addresses passed to calls to synthesized
Akira Hatanaka [Fri, 29 Mar 2019 00:23:20 +0000 (00:23 +0000)]
[CodeGen][ObjC] Adjust the addresses passed to calls to synthesized
copy/move constructor/assignment operator functions for non-trivial C
structs.

This commit fixes a bug where the offset of struct fields weren't being
taken into account when computing the addresses passed to calls to the
special functions.

For example, the copy constructor for S1 (__copy_constructor_8_8_s0_s8)
would pass the start addresses of the destination and source structs to
the call to S0's copy constructor (_copy_constructor_8_8_s0) without
adding the offset of field f1 to the addresses.

typedef struct {
  id f0;
  S0 f1;
} S1;

void test(S1 s1) {
  S1 t = s1;
}

rdar://problem/49400610

llvm-svn: 357229

5 years agoFix typos and formatting. NFC.
Akira Hatanaka [Fri, 29 Mar 2019 00:23:17 +0000 (00:23 +0000)]
Fix typos and formatting. NFC.

llvm-svn: 357228

5 years agoRevert Recommit "[DSE] Preserve basic block ordering using OrderedBasicBlock."
Florian Hahn [Fri, 29 Mar 2019 00:22:26 +0000 (00:22 +0000)]
Revert Recommit "[DSE] Preserve basic block ordering using OrderedBasicBlock."

Another buildbot failure

http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/20402

clang-9: /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/llvm/include/llvm/ADT/DenseMap.h:1228: llvm::DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, IsConst>::value_type* llvm::DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, IsConst>::operator->() const [with KeyT = const llvm::Instruction*; ValueT = unsigned int; KeyInfoT = llvm::DenseMapInfo<const llvm::Instruction*>; Bucket = llvm::detail::DenseMapPair<const llvm::Instruction*, unsigned int>; bool IsConst = false; llvm::DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, IsConst>::pointer = llvm::detail::DenseMapPair<const llvm::Instruction*, unsigned int>*; llvm::DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, IsConst>::value_type = llvm::detail::DenseMapPair<const llvm::Instruction*, unsigned int>]: Assertion `isHandleInSync() && "invalid iterator access!"' failed.

0. Program arguments: /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/stage1.install/bin/clang-9 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name ArchiveCommandLine.cpp -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu skylake-avx512 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -coverage-notes-file /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/test/sandbox/build/MultiSource/Benchmarks/7zip/Output/ArchiveCommandLine.llvm.gcno -resource-dir /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/stage1.install/lib/clang/9.0.0 -I /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/test/sandbox/build/MultiSource/Benchmarks/7zip -I /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/test/test-suite/MultiSource/Benchmarks/7zip -I /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/test/test-suite/include -I ../../../include -D _GNU_SOURCE -D __STDC_LIMIT_MACROS -D NDEBUG -D BREAK_HANDLER -D UNICODE -D _UNICODE -I /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/test/test-suite/MultiSource/Benchmarks/7zip/C -I /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/test/test-suite/MultiSource/Benchmarks/7zip/CPP/myWindows -I /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/test/test-suite/MultiSource/Benchmarks/7zip/CPP/include_windows -I /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/test/test-suite/MultiSource/Benchmarks/7zip/CPP -I . -D _FILE_OFFSET_BITS=64 -D _LARGEFILE_SOURCE -D NDEBUG -D _REENTRANT -D ENV_UNIX -D _7ZIP_LARGE_PAGES -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward -internal-isystem /usr/local/include -internal-isystem /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/stage1.install/lib/clang/9.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -std=gnu++98 -fdeprecated-macro -fdebug-compilation-dir /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/test/sandbox/build/MultiSource/Benchmarks/7zip -ferror-limit 19 -fmessage-length 0 -pthread -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o Output/ArchiveCommandLine.llvm.o -x c++ /home/ssglocal/clang-cmake-x86_64-sde-avx512-linux/clang-cmake-x86_64-sde-avx512-linux/test/test-suite/MultiSource/Benchmarks/7zip/CPP/7zip/UI/Common/ArchiveCommandLine.cpp -faddrsig

This reverts r357222 (git commit 64cccfcc72c44ea62f441b782d2177a90912769a)

llvm-svn: 357227

5 years ago[WebAssembly] Merge used feature sets, update atomics linkage policy
Thomas Lively [Fri, 29 Mar 2019 00:14:01 +0000 (00:14 +0000)]
[WebAssembly] Merge used feature sets, update atomics linkage policy

Summary:
It does not currently make sense to use WebAssembly features in some functions
but not others, so this CL adds an IR pass that takes the union of all used
feature sets and applies it to each function in the module. This allows us to
prevent atomics from being lowered away if some function has opted in to using
them. When atomics is not enabled anywhere, we detect whether there exists any
atomic operations or thread local storage that would be stripped and disallow
linking with objects that contain atomics if and only if atomics or tls are
stripped. When atomics is enabled, mark it as used but do not require it of
other objects in the link. These changes allow libraries that do not use atomics
to be built once and linked into both single-threaded and multithreaded
binaries.

Reviewers: aheejin, sbc100, dschuff

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

Tags: #llvm

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

llvm-svn: 357226

5 years agoRevert "[WebAssembly] Improve invalid relocation error message"
Derek Schuff [Fri, 29 Mar 2019 00:05:00 +0000 (00:05 +0000)]
Revert "[WebAssembly] Improve invalid relocation error message"

This reverts commit 0805ec5f7b5c80474352531a99e721c30e73e77f.

llvm-svn: 357225

5 years agoRevert "[WebAssembly] Improve invalid relocation error message"
Derek Schuff [Fri, 29 Mar 2019 00:04:58 +0000 (00:04 +0000)]
Revert "[WebAssembly] Improve invalid relocation error message"

Also Revert "[WebAssembly] Fix typo from rL357143"

This reverts commit 0805ec5f7b5c80474352531a99e721c30e73e77f and
a9958fc30d0c6d4c140be892c5a824b827d2eb5d
(rL357143 and rL357144)

They cause failures with address-taken extern (JS) functions
in emscripten.

llvm-svn: 357224

5 years agoRemove a duplicate assignment. NFC.
Rui Ueyama [Thu, 28 Mar 2019 23:53:38 +0000 (23:53 +0000)]
Remove a duplicate assignment. NFC.

llvm-svn: 357223

5 years agoRecommit "[DSE] Preserve basic block ordering using OrderedBasicBlock."
Florian Hahn [Thu, 28 Mar 2019 23:11:00 +0000 (23:11 +0000)]
Recommit "[DSE] Preserve basic block ordering using OrderedBasicBlock."

Recommitting after addressing a buildbot failure.

This reverts commit c87869ebea000dd6483de7c7451cb36c1d36f866.

llvm-svn: 357222

5 years ago[llvm-readobj] Fix formatting of unknown note types
Jordan Rupprecht [Thu, 28 Mar 2019 23:08:06 +0000 (23:08 +0000)]
[llvm-readobj] Fix formatting of unknown note types

llvm-svn: 357221

5 years ago[MS] Make __iso_volatile_* available on all targets
Reid Kleckner [Thu, 28 Mar 2019 22:59:09 +0000 (22:59 +0000)]
[MS] Make __iso_volatile_* available on all targets

Future versions of MSVC make these intrinsics available on x86 & x64,
according to:
http://lists.llvm.org/pipermail/cfe-dev/2019-March/061711.html

The purpose of these builtins is to emit plain, non-atomic, volatile
stores when /volatile:ms (-cc1 -fms-volatile) is enabled.

llvm-svn: 357220

5 years ago[yaml2obj] Fixing opening empty yaml files.
Puyan Lotfi [Thu, 28 Mar 2019 22:55:08 +0000 (22:55 +0000)]
[yaml2obj] Fixing opening empty yaml files.

Essentially echo "" | yaml2obj crashes. This patch attempts to trim whitespace
and determine if the yaml string in the file is empty or not. If the input is
empty then it will not properly print out an error message and return an error
code.

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

A    test/tools/yaml2obj/empty.yaml
M    tools/yaml2obj/yaml2obj.cpp

llvm-svn: 357219

5 years agoUpdate lit config for ld.lld command to match "ld\.lld" instead of trying to match...
Rumeet Dhindsa [Thu, 28 Mar 2019 22:26:51 +0000 (22:26 +0000)]
Update lit config for ld.lld command to match "ld\.lld" instead of trying to match respective regex. (It was able to work with ld-lld and ld1lld as well)

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

llvm-svn: 357218

5 years ago[LSR] Fix signed overflow in GenerateCrossUseConstantOffsets.
Florian Hahn [Thu, 28 Mar 2019 22:17:29 +0000 (22:17 +0000)]
[LSR] Fix signed overflow in GenerateCrossUseConstantOffsets.

For the attached test case, unchecked addition of immediate starts and
ends overflows, as they can be arbitrary i64 constants.

Proof: https://rise4fun.com/Alive/Plqc

Reviewers: qcolombet, gilr, efriedma

Reviewed By: efriedma

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

llvm-svn: 357217

5 years agoFixed the lld test using ld-lld command to use ld.lld instead.
Rumeet Dhindsa [Thu, 28 Mar 2019 22:14:46 +0000 (22:14 +0000)]
Fixed the lld test using ld-lld command to use ld.lld instead.

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

llvm-svn: 357216

5 years ago[BPF] add proper multi-dimensional array support
Yonghong Song [Thu, 28 Mar 2019 21:59:49 +0000 (21:59 +0000)]
[BPF] add proper multi-dimensional array support

For multi-dimensional array like below
  int a[2][3];
the previous implementation generates BTF_KIND_ARRAY type
like below:
  . element_type: int
  . index_type: unsigned int
  . number of elements: 6

This is not the best way to represent arrays, esp.,
when converting BTF back to headers and users will see
  int a[6];
instead.

This patch generates proper support for multi-dimensional arrays.
For "int a[2][3]", the two BTF_KIND_ARRAY types will be
generated:
  Type #n:
    . element_type: int
    . index_type: unsigned int
    . number of elements: 3
  Type #(n+1):
    . element_type: #n
    . index_type: unsigned int
    . number of elements: 2

The linux kernel already supports such a multi-dimensional
array representation properly.

Signed-off-by: Yonghong Song <yhs@fb.com>
Differential Revision: https://reviews.llvm.org/D59943

llvm-svn: 357215

5 years ago[MC] Fix floating-point literal lexing.
Eli Friedman [Thu, 28 Mar 2019 21:12:28 +0000 (21:12 +0000)]
[MC] Fix floating-point literal lexing.

This patch has three related fixes to improve float literal lexing:

1. Make AsmLexer::LexDigit handle floats without a decimal point more
   consistently.
2. Make AsmLexer::LexFloatLiteral print an error for floats which are
   apparently missing an "e".
3. Make APFloat::convertFromString use binutils-compatible exponent
   parsing.

Together, this fixes some cases where a float would be incorrectly
rejected, fixes some cases where the compiler would crash, and improves
diagnostics in some cases.

Patch by Brandon Jones.

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

llvm-svn: 357214

5 years ago[SelectionDAGBuilder] Fix 80 column violation. NFC
Craig Topper [Thu, 28 Mar 2019 20:52:22 +0000 (20:52 +0000)]
[SelectionDAGBuilder] Fix 80 column violation. NFC

llvm-svn: 357213

5 years ago[InterleavedAccessPass] Don't increase the number of bytes loaded.
Eli Friedman [Thu, 28 Mar 2019 20:44:50 +0000 (20:44 +0000)]
[InterleavedAccessPass] Don't increase the number of bytes loaded.

Even if the interleaving transform would otherwise be legal, we shouldn't
introduce an interleaved load that is wider than the original load: it might
have undefined behavior.

It might be possible to perform some sort of mask-narrowing transform in
some cases (using a narrower interleaved load, then extending the
results using shufflevectors).  But I haven't tried to implement that,
at least for now.

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

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

llvm-svn: 357212

5 years agoRevert [DSE] Preserve basic block ordering using OrderedBasicBlock.
Florian Hahn [Thu, 28 Mar 2019 20:36:24 +0000 (20:36 +0000)]
Revert [DSE] Preserve basic block ordering using OrderedBasicBlock.

This reverts r357208 (git commit c0bfd37d385c93711ef3a349599dba20e6b101ef)

This causes a buildbot failure:  http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/16124

FAILED: lib/IR/CMakeFiles/LLVMCore.dir/IRBuilder.cpp.o
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/install/stage2/bin/clang++   -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/IR -I/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/IR -Iinclude -I/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/include -fPIC -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -flto=thin -O3    -UNDEBUG  -fno-exceptions -fno-rtti -MD -MT lib/IR/CMakeFiles/LLVMCore.dir/IRBuilder.cpp.o -MF lib/IR/CMakeFiles/LLVMCore.dir/IRBuilder.cpp.o.d -o lib/IR/CMakeFiles/LLVMCore.dir/IRBuilder.cpp.o -c /home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/IR/IRBuilder.cpp
clang-9: /home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Analysis/OrderedBasicBlock.cpp:38: bool llvm::OrderedBasicBlock::comesBefore(const llvm::Instruction *, const llvm::Instruction *): Assertion `!(LastInstFound == BB->end() && NextInstPos != 0) && "Instruction supposed to be in NumberedInsts"' failed.

llvm-svn: 357211

5 years agoFix for regression test, since we rely on the formatter for std::vector in the test...
Shafik Yaghmour [Thu, 28 Mar 2019 20:25:57 +0000 (20:25 +0000)]
Fix for regression test, since we rely on the formatter for std::vector in the test we need a libc++ category.

See differential https://reviews.llvm.org/D59847 for initial change that this fixes

llvm-svn: 357210

5 years agoApply include-what-you-use #include removal suggestions. NFC.
Michael Kruse [Thu, 28 Mar 2019 20:19:49 +0000 (20:19 +0000)]
Apply include-what-you-use #include removal suggestions. NFC.

This removes unused includes (and forward declarations) as
suggested by include-what-you-use. If a transitive include of a removed
include is required to compile a file, I added the required header (or
forward declaration if suggested by include-what-you-use).

This should reduce compilation time and reduce the number of iterative
recompilations when a header was changed.

llvm-svn: 357209

5 years ago[DSE] Preserve basic block ordering using OrderedBasicBlock.
Florian Hahn [Thu, 28 Mar 2019 20:02:33 +0000 (20:02 +0000)]
[DSE] Preserve basic block ordering using OrderedBasicBlock.

By extending OrderedBB to allow removing and replacing cached
instructions, we can preserve OrderedBBs in DSE easily. This eliminates
one source of quadratic compile time in DSE.

Fixes PR38829.

Reviewers: rnk, efriedma, hfinkel

Reviewed By: efriedma

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

llvm-svn: 357208

5 years agoFix the swig typemap for "uint32_t *versions, uint32_t num_versions".
Jim Ingham [Thu, 28 Mar 2019 19:25:54 +0000 (19:25 +0000)]
Fix the swig typemap for "uint32_t *versions, uint32_t num_versions".

It was making a list of a certain size but not always filling in that
many elements, which would lead to a crash iterating over the list.

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

llvm-svn: 357207

5 years ago[MemDepAnalysis] Allow caller to pass in an OrderedBasicBlock.
Florian Hahn [Thu, 28 Mar 2019 19:17:31 +0000 (19:17 +0000)]
[MemDepAnalysis] Allow caller to pass in an OrderedBasicBlock.

If the caller can preserve the OBB, we can avoid recomputing the order
for each getDependency call.

Reviewers: efriedma, rnk, hfinkel

Reviewed By: rnk

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

llvm-svn: 357206

5 years ago[OPENMP]Add check for undefined behavior with thread allocators on
Alexey Bataev [Thu, 28 Mar 2019 19:15:36 +0000 (19:15 +0000)]
[OPENMP]Add check for undefined behavior with thread allocators on
target and task-based directives.

According to OpenMP 5.0, 2.11.4 allocate Clause, Restrictions, For task,
taskloop or target directives, allocation requests to memory allocators
with the trait access set to thread result in unspecified behavior.
Patch introduces a check for omp_thread_mem_alloc predefined allocator
on target- and trask-based directives.

llvm-svn: 357205

5 years ago[SLP][X86] Add tests showing failure to commute icmp/fcmp by swapping predicate
Simon Pilgrim [Thu, 28 Mar 2019 19:13:38 +0000 (19:13 +0000)]
[SLP][X86] Add tests showing failure to commute icmp/fcmp by swapping predicate

By swapping icmp/fcmp predicates we can commute their operands to improve vectorization

llvm-svn: 357204

5 years ago[pstl] Uglify internal names of the library
Louis Dionne [Thu, 28 Mar 2019 19:10:32 +0000 (19:10 +0000)]
[pstl] Uglify internal names of the library

llvm-svn: 357203

5 years ago[SLP][X86] Add tests showing failure to commute icmp/fcmp operands
Simon Pilgrim [Thu, 28 Mar 2019 19:03:53 +0000 (19:03 +0000)]
[SLP][X86] Add tests showing failure to commute icmp/fcmp operands

Some predicates are fully commutative - we should be able to easily commute their operands to improve vectorization

llvm-svn: 357202

5 years agoTemporarily revert "SafepointIRVerifier port to new Pass Manager"
Adrian Prantl [Thu, 28 Mar 2019 18:34:34 +0000 (18:34 +0000)]
Temporarily revert "SafepointIRVerifier port to new Pass Manager"
to unbreak the modular bots and its follow-up commit.

This reverts commit https://reviews.llvm.org/D59825
because it introduced a

fatal error: cyclic dependency in module 'LLVM_intrinsic_gen': LLVM_intrinsic_gen -> LLVM_IR -> LLVM_intrinsic_gen

llvm-svn: 357201

5 years ago[COFF] Optimize range extension thunk insertion memory usage
Reid Kleckner [Thu, 28 Mar 2019 18:30:03 +0000 (18:30 +0000)]
[COFF] Optimize range extension thunk insertion memory usage

Summary:
This avoids allocating O(#relocs) of intermediate data for each section
when range extension thunks aren't needed for that section. This also
removes a std::vector from SectionChunk, which further reduces its size.

Instead, this change adds the range extension thunk symbols to the
object files that contain sections that need extension thunks. By adding
them to the symbol table of the parent object, that means they now have
a symbol table index. Then we can then modify the original relocation,
after copying it to read-write memory, to use the new symbol table
index.

This makes linking browser_tests.exe with no PDB 10.46% faster, moving
it from 11.364s to 10.288s averaged over five runs.

Reviewers: mstorsjo, ruiu

Subscribers: aganea, llvm-commits

Tags: #llvm

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

llvm-svn: 357200

5 years ago[llvm-objcopy][NFC] Move ELF-specific logic into /ELF/ directory
Jordan Rupprecht [Thu, 28 Mar 2019 18:27:00 +0000 (18:27 +0000)]
[llvm-objcopy][NFC] Move ELF-specific logic into /ELF/ directory

llvm-svn: 357199

5 years ago[NFC] find_first_of/find_last_of -> find/rfind for single char.
Jonas Devlieghere [Thu, 28 Mar 2019 18:10:14 +0000 (18:10 +0000)]
[NFC] find_first_of/find_last_of -> find/rfind for single char.

For a single char argument, find_first_of is equal to find and
find_last_of is equal to rfind. While playing around with the plugin
stuff this caused an export failure because it always got inlined except
once, which resulted in an undefined symbol.

llvm-svn: 357198

5 years ago[Driver] Default Android toolchains to noexecstack.
Dan Albert [Thu, 28 Mar 2019 18:08:28 +0000 (18:08 +0000)]
[Driver] Default Android toolchains to noexecstack.

Android does not support executable stacks.

Reviewers: srhines, pirama

Reviewed By: pirama

Subscribers: cfe-commits

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

llvm-svn: 357197

5 years ago[X86] Teach the isel optimization for (x << C1) op C2 to (x op (C2>>C1)) << C1 to...
Craig Topper [Thu, 28 Mar 2019 18:05:37 +0000 (18:05 +0000)]
[X86] Teach the isel optimization for (x << C1) op C2 to (x op (C2>>C1)) << C1 to consider cases where C2>>C1 can fit an unsigned 32-bit immediate

For 64-bit operations we should consider if the immediate can be made to fit
in an unsigned 32-bits immedate. For OR/XOR this allows us to load the immediate
with MOV32ri instead of movabsq. For AND this allows us to fold the immediate.

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

llvm-svn: 357196

5 years ago[WebAssembly] Reland of rL356953 (4dcf3acce6)
Sam Clegg [Thu, 28 Mar 2019 17:45:18 +0000 (17:45 +0000)]
[WebAssembly] Reland of rL356953 (4dcf3acce6)

The previous patch was missing GetProgramPath() in the return value
of getLinkerPath().

See https://reviews.llvm.org/D59743

llvm-svn: 357195

5 years agoCreate an instance of Target after reading all input files. NFC.
Rui Ueyama [Thu, 28 Mar 2019 17:38:53 +0000 (17:38 +0000)]
Create an instance of Target after reading all input files. NFC.

This change itself doesn't mean anything, but it helps D59780 because
in patch, we don't know whether we need to create a CET-aware PLT or
not until we read all input files.

llvm-svn: 357194

5 years agoMake a member function a non-member function.
Rui Ueyama [Thu, 28 Mar 2019 17:35:00 +0000 (17:35 +0000)]
Make a member function a non-member function.

Since this member function doesn't use anything in the class,
it doesn't have to be a member of the class.

llvm-svn: 357193

5 years agoDelay initialization of three static global maps, NFC
Reid Kleckner [Thu, 28 Mar 2019 17:33:41 +0000 (17:33 +0000)]
Delay initialization of three static global maps, NFC

This avoids allocating a few KB of heap memory on startup, and instead
allocates these maps lazily. I noticed this while profiling LLD.

llvm-svn: 357192

5 years agoDe-template X86_64TargetInfo. NFC.
Rui Ueyama [Thu, 28 Mar 2019 17:31:12 +0000 (17:31 +0000)]
De-template X86_64TargetInfo. NFC.

llvm-svn: 357191

5 years agoFix PR#35967: '<regex> syntax_option_type is not a proper bitmask' Sadly, this is...
Marshall Clow [Thu, 28 Mar 2019 17:30:23 +0000 (17:30 +0000)]
Fix PR#35967: '<regex> syntax_option_type is not a proper bitmask' Sadly, this is an ABI break, so it's only available if you define either '_LIBCPP_ABI_VERSION > 2' or '_LIBCPP_ABI_UNSTABLE' or '_LIBCPP_ABI_REGEX_CONSTANTS_NONZERO' and rebuild your dylib.

llvm-svn: 357190

5 years ago[pstl] Introduce forward declarations
Louis Dionne [Thu, 28 Mar 2019 17:22:19 +0000 (17:22 +0000)]
[pstl] Introduce forward declarations

Necessary when pstl is included from with <algorithm> and <numeric> to
prevent a partially declared standard library when pstl itself uses
algorithms from <algorithm> and <numeric>.

Also, this patch makes sure that configuration comes via standard headers.
Directly including pstl_config.h in implementation files is incompatible
with inclusion of pstl into a standard library implementation which
provides it's own library wide configuration and may configure the
library differently to the pstl_config.h used by the standalone
implementation.

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

llvm-svn: 357189

5 years agoRegression test to ensure that we handling importing of std::vector of enums correctly
Shafik Yaghmour [Thu, 28 Mar 2019 17:22:13 +0000 (17:22 +0000)]
Regression test to ensure that we handling importing of std::vector of enums correctly

Summary:
https://reviews.llvm.org/D59845 added a fix for the IsStructuralMatch(...) specialization for EnumDecl this test should pass once this fix is committed.

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

llvm-svn: 357188

5 years agoMake helper functions static. NFC.
Benjamin Kramer [Thu, 28 Mar 2019 17:18:42 +0000 (17:18 +0000)]
Make helper functions static. NFC.

llvm-svn: 357187

5 years agoDisable warnings when indexing as a standalone action.
Sam McCall [Thu, 28 Mar 2019 17:07:28 +0000 (17:07 +0000)]
Disable warnings when indexing as a standalone action.

Summary:
- we don't record the warnings at all
- we don't want to stop indexing if we hit error-limit due to warnings
- this allows some analyses to be skipped which can save some CPU

https://github.com/clangd/clangd/issues/24

Reviewers: hokein

Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 357186

5 years agoMake TargetInfo const. NFC.
Rui Ueyama [Thu, 28 Mar 2019 17:05:09 +0000 (17:05 +0000)]
Make TargetInfo const. NFC.

We do not mutate a TargetInfo instance after creating it. This change
makes it explicit.

llvm-svn: 357185

5 years ago[CodeGen] Add additional mangling for struct members of non trivial structs
Shoaib Meenai [Thu, 28 Mar 2019 17:01:20 +0000 (17:01 +0000)]
[CodeGen] Add additional mangling for struct members of non trivial structs

In https://bugs.llvm.org/show_bug.cgi?id=41206 we observe bad codegen
when embedding a non-trivial C struct within a C struct. This is due to
the fact that name mangling for non-trivial structs marks the two
structs as identical. This diff contains a fix for this issue.

Patch by Dan Zimmerman <daniel.zimmerman@me.com>.

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

llvm-svn: 357184

5 years ago[MIPS GlobalISel] Select float constants
Petar Avramovic [Thu, 28 Mar 2019 16:58:12 +0000 (16:58 +0000)]
[MIPS GlobalISel] Select float constants

Select 32 and 64 bit float constants for MIPS32.

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

llvm-svn: 357183

5 years agogn build: Add some build files for clangd
Nico Weber [Thu, 28 Mar 2019 16:53:32 +0000 (16:53 +0000)]
gn build: Add some build files for clangd

Enough to build the clangd binaries, but this is still missing build
files for:
- fuzzer
- indexer
- index/dex/dexp
- benchmarks
- xpc

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

llvm-svn: 357182

5 years ago[libc++] Remove unnecessary <iostream> #includes in tests
Louis Dionne [Thu, 28 Mar 2019 16:38:15 +0000 (16:38 +0000)]
[libc++] Remove unnecessary <iostream> #includes in tests

Some tests #include <iostream> but they don't use anything from the
header. Those are probably artifacts of when the tests were developped.

llvm-svn: 357181

5 years agoAdd "git llvm revert" and "git llvm svn-lookup" subcommands
Jordan Rupprecht [Thu, 28 Mar 2019 16:15:28 +0000 (16:15 +0000)]
Add "git llvm revert" and "git llvm svn-lookup" subcommands

Summary:
The current git-svnrevert script only works with git-svn repos (e.g. using "git svn find-rev" to find the commit to revert). This adds a similar implementation that works with the llvm git command handler.

Usage:
```
// Revert by svn id
$ git llvm revert r123456
// See what commands would be run instead of actually reverting
$ git llvm revert -n r123456
<full git revert + git commit commands>
// Git commit hash also fine
$ git llvm revert abc123456
// For convenience, the git->svn method can be used directly:
$ git llvm svn-lookup abc123456
r123456
// Push revert upstream (drop the -n when ready)
$ git llvm push -n
```

Regardless of how the command is invoked (with a svn revision or git hash), the message is:

```
Revert [LibFoo] Change Foo implementation

This reverts r123456 (git commit abc123)
```

Reviewers: jyknight, mehdi_amini, jlebar

Reviewed By: jlebar

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 357180

5 years ago[DAG] Fix Lifetime Node ID hashing.
Nirav Dave [Thu, 28 Mar 2019 15:53:01 +0000 (15:53 +0000)]
[DAG] Fix Lifetime Node ID hashing.

llvm-svn: 357179

5 years ago[DAGCombiner] fold sext into negation
Sanjay Patel [Thu, 28 Mar 2019 15:46:02 +0000 (15:46 +0000)]
[DAGCombiner] fold sext into negation

As noted in D59818:
  %z = zext i8 %x to i32
  %neg = sub i32 0, %z
  %r = sext i32 %neg to i64
  =>
  %z2 = zext i8 %x to i64
  %r = sub i64 0, %z2

https://rise4fun.com/Alive/KzSR

llvm-svn: 357178

5 years ago[x86] add vector test for sext of negate; NFC
Sanjay Patel [Thu, 28 Mar 2019 15:30:09 +0000 (15:30 +0000)]
[x86] add vector test for sext of negate; NFC

llvm-svn: 357177

5 years ago[AMDGPU] Clarify Code Object V2/V3 differences in AMDGPUUsage
Scott Linder [Thu, 28 Mar 2019 15:08:52 +0000 (15:08 +0000)]
[AMDGPU] Clarify Code Object V2/V3 differences in AMDGPUUsage

Ensure Code Object V2 documentation is complete, but always contains a
warning and a link to the equivalent Code Object V3 documentation.

Explicitly indicate that any note records present in a code object that
are not documented must be considered deprecated and ignored.

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

llvm-svn: 357176

5 years ago[clangd] Update error message to fix tests after r357173
Sam McCall [Thu, 28 Mar 2019 15:07:15 +0000 (15:07 +0000)]
[clangd] Update error message to fix tests after r357173

llvm-svn: 357175

5 years ago[Documentation] Proposal to change variable names
Michael Platings [Thu, 28 Mar 2019 14:42:21 +0000 (14:42 +0000)]
[Documentation] Proposal to change variable names

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

llvm-svn: 357174

5 years ago[clangd] Support UTF-32 (i.e. codepoint) offsets.
Sam McCall [Thu, 28 Mar 2019 14:37:51 +0000 (14:37 +0000)]
[clangd] Support UTF-32 (i.e. codepoint) offsets.

Summary:
(Changes to UTF-8/UTF-16 here are NFC, moving things around to make the
cases more symmetrical)

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 357173

5 years ago[x86] avoid cmov in movmsk reduction
Sanjay Patel [Thu, 28 Mar 2019 14:16:13 +0000 (14:16 +0000)]
[x86] avoid cmov in movmsk reduction

This is probably the least important of our movmsk problems, but I'm starting
at the bottom to reduce distractions.

We were creating a select_cc which bypasses the select and bitmask codegen
optimizations that we have now. If we produce a compare+negate instead, we
allow things like neg/sbb carry bit hacks, and in all cases we avoid a cmov.
There's no partial register update danger in these sequences because we always
produce the zero-register xor ahead of the 'set' if needed.

There seems to be a missing fold for sext of a bool bit here:

negl %ecx
movslq %ecx, %rax

...but that's an independent transform.

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

llvm-svn: 357172

5 years ago[X86MacroFusion] Handle branch fusion (AMD CPUs).
Clement Courbet [Thu, 28 Mar 2019 14:12:46 +0000 (14:12 +0000)]
[X86MacroFusion] Handle branch fusion (AMD CPUs).

Summary:
This adds a BranchFusion feature to replace the usage of the MacroFusion
for AMD CPUs.

See D59688 for context.

Reviewers: andreadb, lebedev.ri

Subscribers: hiraditya, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 357171

5 years agoAMDGPU: Make exec mask optimzations more resistant to block splits
Matt Arsenault [Thu, 28 Mar 2019 14:01:39 +0000 (14:01 +0000)]
AMDGPU: Make exec mask optimzations more resistant to block splits

Also improve the check for SALU instructions to also ignore
implicit_def and other fake instructions.

llvm-svn: 357170

5 years ago[X86] AMD Piledriver (BdVer2): fine-tune some latencies
Roman Lebedev [Thu, 28 Mar 2019 13:40:34 +0000 (13:40 +0000)]
[X86] AMD Piledriver (BdVer2): fine-tune some latencies

Based on llvm-exegesis measurements.

Now that llvm-exegesis is ~2 magnitudes faster, and is a bit smarter,
it is now possible to continue cleanup of the scheduler model.

With this, there are no more latency inconsistencies for the
opcodes that produce stable measurements, and only a few inconsistencies
for unstable measurements (MMX_* opcodes, opcodes that llvm-exegesis
measures by chaining - CMP, TEST, BT, SETcc, CVT, MOV, etc.)

llvm-svn: 357169

5 years ago[NFC] Format InlineFeatureIgnoreList.
Clement Courbet [Thu, 28 Mar 2019 13:38:58 +0000 (13:38 +0000)]
[NFC] Format InlineFeatureIgnoreList.

To avoid more spurious clang-format changes when adding features (D59872).

llvm-svn: 357168

5 years ago[Analyzer] Constraint Manager - Calculate Effective Range for Differences
Adam Balogh [Thu, 28 Mar 2019 13:05:59 +0000 (13:05 +0000)]
[Analyzer] Constraint Manager - Calculate Effective Range for Differences

Since rL335814, if the constraint manager cannot find a range set for `A - B`
(where `A` and `B` are symbols) it looks for a range for `B - A` and returns
it negated if it exists. However, if a range set for both `A - B` and `B - A`
is stored then it only returns the first one. If we both use `A - B` and
`B - A`, these expressions behave as two totally unrelated symbols. This way
we miss some useful deductions which may lead to false negatives or false
positives.

This tiny patch changes this behavior: if the symbolic expression the
constraint manager is looking for is a difference `A - B`, it tries to
retrieve the range for both `A - B` and `B - A` and if both exists it returns
the intersection of range `A - B` and the negated range of `B - A`. This way
every time a checker applies new constraints to the symbolic difference or to
its negated it always affects both the original difference and its negated.

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

llvm-svn: 357167

5 years ago- Addressed comments
Xing GUO [Thu, 28 Mar 2019 12:51:56 +0000 (12:51 +0000)]
- Addressed comments

llvm-svn: 357166

5 years ago- Addressed @jhenderson 's comments
Xing GUO [Thu, 28 Mar 2019 12:51:46 +0000 (12:51 +0000)]
- Addressed @jhenderson 's comments
- Format patch

llvm-svn: 357165

5 years ago[llvm-readobj] Add new helper function `getSymbolVersionByIndex()`
Xing GUO [Thu, 28 Mar 2019 12:51:35 +0000 (12:51 +0000)]
[llvm-readobj] Add new helper function `getSymbolVersionByIndex()`

Summary: When implementing `GNU style` dumper for `.gnu.version` section, we should find symbol version name by `vs_index`.

Reviewers: jhenderson, rupprecht

Reviewed By: rupprecht

Subscribers: arphaman, rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 357164

5 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Thu, 28 Mar 2019 12:03:49 +0000 (12:03 +0000)]
Fix Wdocumentation warning. NFCI.

llvm-svn: 357163

5 years ago[PR41247] Fixed parsing of private keyword in C++.
Anastasia Stulova [Thu, 28 Mar 2019 11:47:14 +0000 (11:47 +0000)]
[PR41247] Fixed parsing of private keyword in C++.

Fixed bug in C++ to prevent parsing 'private' as a
valid address space qualifier.

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

llvm-svn: 357162

5 years ago[DAGCombiner] Fold truncate(build_vector(x,y)) -> build_vector(truncate(x),truncate(y))
Simon Pilgrim [Thu, 28 Mar 2019 11:34:21 +0000 (11:34 +0000)]
[DAGCombiner] Fold truncate(build_vector(x,y)) -> build_vector(truncate(x),truncate(y))

If scalar truncates are free, attempt to pre-truncate build_vectors source operands.

Only attempt to do this before legalization as we often end up with truncations/extensions during build_vector lowering.

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

llvm-svn: 357161

5 years ago[ELF][ARM] Recommit Redesign of .ARM.exidx handling to use a SyntheticSection
Peter Smith [Thu, 28 Mar 2019 11:10:20 +0000 (11:10 +0000)]
[ELF][ARM] Recommit Redesign of .ARM.exidx handling to use a SyntheticSection

Recommit r356666 with fixes for buildbot failure, as well as handling for
--emit-relocs, which we decide not to emit any relocation sections as the
table is already position independent and an offline tool can deduce the
relocations.

Instead of creating extra Synthetic .ARM.exidx sections to account for
gaps in the table, create a single .ARM.exidx SyntheticSection that can
derive the contents of the gaps from a sorted list of the executable
InputSections. This has the benefit of moving the ARM specific code for
SyntheticSections in SHF_LINK_ORDER processing and the table merging code
into the ARM specific SyntheticSection. This also makes it easier to create
EXIDX_CANTUNWIND table entries for executable InputSections that don't
have an associated .ARM.exidx section.

Fixes pr40277

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

llvm-svn: 357160

5 years ago[ARM GlobalISel] Run regbankselect test for Thumb. NFCI
Diana Picus [Thu, 28 Mar 2019 10:57:29 +0000 (10:57 +0000)]
[ARM GlobalISel] Run regbankselect test for Thumb. NFCI

This should just work, since ARM mode and Thumb2 mode are at the same
level of support now and should map the same to GPR and FPR.

llvm-svn: 357159

5 years ago[yaml2obj][obj2yaml] - Teach yaml2obj/obj2yaml tools about STB_GNU_UNIQUE symbols.
George Rimar [Thu, 28 Mar 2019 10:52:14 +0000 (10:52 +0000)]
[yaml2obj][obj2yaml] - Teach yaml2obj/obj2yaml tools about STB_GNU_UNIQUE symbols.

yaml2obj/obj2yaml does not support the symbols with STB_GNU_UNIQUE yet.
Currently, obj2yaml fails with llvm_unreachable when met such a symbol.

I faced it when investigated the https://bugs.llvm.org/show_bug.cgi?id=41196.

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

llvm-svn: 357158

5 years ago[asan] Add options -asan-detect-invalid-pointer-cmp and -asan-detect-invalid-pointer...
Pierre Gousseau [Thu, 28 Mar 2019 10:51:24 +0000 (10:51 +0000)]
[asan] Add options -asan-detect-invalid-pointer-cmp and -asan-detect-invalid-pointer-sub options.

This is in preparation to a driver patch to add gcc 8's -fsanitize=pointer-compare and -fsanitize=pointer-subtract.
Disabled by default as this is still an experimental feature.

Reviewed By: morehouse, vitalybuka

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

llvm-svn: 357157

5 years ago[VPlan] Determine Vector Width programmatically.
Florian Hahn [Thu, 28 Mar 2019 10:37:12 +0000 (10:37 +0000)]
[VPlan] Determine Vector Width programmatically.

With this change, the VPlan native path is triggered with the directive:

   #pragma clang loop vectorize(enable)

There is no need to specify the vectorize_width(N) clause.

Patch by Francesco Petrogalli <francesco.petrogalli@arm.com>

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

llvm-svn: 357156

5 years ago[X85][AVX] Add missing vXi16 broadcast fold patterns
Simon Pilgrim [Thu, 28 Mar 2019 10:25:13 +0000 (10:25 +0000)]
[X85][AVX] Add missing vXi16 broadcast fold patterns

Now that D59484 has landed its easier to add these.

Added missing AVX512BW v32i16 equivalents while I was at it.

llvm-svn: 357155

5 years ago[ARM GlobalISel] Fix G_STORE with s1
Diana Picus [Thu, 28 Mar 2019 09:09:36 +0000 (09:09 +0000)]
[ARM GlobalISel] Fix G_STORE with s1

G_STORE for 1-bit values uses a STRBi12, which stores the whole byte.
Zero out the undefined bits before writing.

llvm-svn: 357154

5 years ago[ARM GlobalISel] Fix selection of G_SELECT
Diana Picus [Thu, 28 Mar 2019 09:09:27 +0000 (09:09 +0000)]
[ARM GlobalISel] Fix selection of G_SELECT

G_SELECT uses a 1-bit scalar for the condition, and is currently
implemented with a plain CMPri against 0. This means that values such as
0x1110 are interpreted as true, when instead the higher bits should be
treated as undefined and therefore ignored. Replace the CMPri with a
TSTri against 0x1, which performs an implicit AND, yielding the expected
result.

llvm-svn: 357153