platform/upstream/llvm.git
8 years ago[MC] Cleanup Error Handling in AsmParser
Nirav Dave [Mon, 18 Jul 2016 15:24:03 +0000 (15:24 +0000)]
[MC] Cleanup Error Handling in AsmParser

Add parseToken and compatriot functions to stitch error checks in
straight linear code. As part of this fix some erronous handling of
directives where the EndOfStatement token either was not checked or
Lexed on termination.

Reviewers: rnk, majnemer

Subscribers: llvm-commits

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

llvm-svn: 275795

8 years ago[Hexagon] Use timing class info as tie-breaker in machine scheduler
Krzysztof Parzyszek [Mon, 18 Jul 2016 15:17:10 +0000 (15:17 +0000)]
[Hexagon] Use timing class info as tie-breaker in machine scheduler

Patch by Sirish Pande.

llvm-svn: 275794

8 years ago[Hexagon] HexagonMachineScheduler should account for resources
Krzysztof Parzyszek [Mon, 18 Jul 2016 14:52:13 +0000 (14:52 +0000)]
[Hexagon] HexagonMachineScheduler should account for resources

The machine scheduler needs to account for available resources
more accurately in order to avoid scheduling an instruction that
forces a new packet to be created.

This occurs in two ways: First, an instruction without an available
resource may have a large priority due to other metrics and be
scheduled when there are other instructions with available resources.
Second, an instruction with a non-zero latency may become available
prematurely. In both these cases, we attempt change the priority
in order to allow a better instruction to be scheduled.

Patch by Brendon Cahoon.

llvm-svn: 275793

8 years ago[asan] Enable 48-bit VMA support on aarch64
Adhemerval Zanella [Mon, 18 Jul 2016 14:47:18 +0000 (14:47 +0000)]
[asan] Enable 48-bit VMA support on aarch64

This patch adds 48-bits VMA support for asan on aarch64. The current
47-bit mask is not suffice since on aarch64 kernel with 48-bit vma
(default on ubuntu 16.04) the process may use full VMA range as:

[...]
ffffa39a7000-ffffa39a8000 r--p 00000000 00:00 0 [vvar]
ffffa39a8000-ffffa39a9000 r-xp 00000000 00:00 0 [vdso]
ffffa39a9000-ffffa39aa000 r--p 0001c000 08:02 13631554 /lib/aarch64-linux-gnu/ld-2.23.so
ffffa39aa000-ffffa39ac000 rw-p 0001d000 08:02 13631554 /lib/aarch64-linux-gnu/ld-2.23.so
ffffc2227000-ffffc2248000 rw-p 00000000 00:00 0 [stack]

llvm-svn: 275792

8 years agoRevert "[test] Report error when inferior test processes exit with a non-zero code"
Pavel Labath [Mon, 18 Jul 2016 14:42:01 +0000 (14:42 +0000)]
Revert "[test] Report error when inferior test processes exit with a non-zero code"

This reverts r275782.

The problem with the commit is that it reports an additional "exit (1)" error for every file
containing a failing test, which is far more than I had intended to do. I'll need to come up with
a more fine-grained way of achieving the result.

llvm-svn: 275791

8 years ago[Hexagon] Fix zero latency instructions with multiple predecessors
Krzysztof Parzyszek [Mon, 18 Jul 2016 14:23:10 +0000 (14:23 +0000)]
[Hexagon] Fix zero latency instructions with multiple predecessors

An instruction may have multiple predecessors that are candidates
for using .cur. However, only one of them can use .cur in the
packet. When this case occurs, we need to make sure that only
one of the dependences gets a 0 latency value.

Patch by Brendon Cahoon.

llvm-svn: 275790

8 years agoFixed errors in docs.
Alexander Kornienko [Mon, 18 Jul 2016 14:13:18 +0000 (14:13 +0000)]
Fixed errors in docs.

llvm-svn: 275789

8 years ago[SLPVectorizer][X86] Added sqrt vectorization tests
Simon Pilgrim [Mon, 18 Jul 2016 13:20:54 +0000 (13:20 +0000)]
[SLPVectorizer][X86] Added sqrt vectorization tests

llvm-svn: 275788

8 years agoChange a couple ifdefs from '#if __cplusplus >= 2011xxx' to '#ifndef _LIBCPP_CXX03_LA...
Marshall Clow [Mon, 18 Jul 2016 13:19:00 +0000 (13:19 +0000)]
Change a couple ifdefs from '#if __cplusplus >= 2011xxx' to '#ifndef _LIBCPP_CXX03_LANG'. No functionality change.

llvm-svn: 275787

8 years ago[inlineasm] Propagate operand constraints to the backend
Simon Dardis [Mon, 18 Jul 2016 13:17:31 +0000 (13:17 +0000)]
[inlineasm] Propagate operand constraints to the backend

When SelectionDAGISel transforms a node representing an inline asm
block, memory constraint information is not preserved. This can cause
constraints to be broken when a memory offset is of the form:

offset + frame index

when the frame is resolved.

By propagating the constraints all the way to the backend, targets can
enforce memory operands of inline assembly to conform to their constraints.

For MIPSR6, some instructions had their offsets reduced to 9 bits from
16 bits such as ll/sc. This becomes problematic when using inline assembly
to perform atomic operations, as an offset can generated that is too big to
encode in the instruction.

Reviewers: dsanders, vkalintris

Differential Review: https://reviews.llvm.org/D21615

llvm-svn: 275786

8 years ago[LLVM][MIPS] Revert support for FRE.
Nitesh Jain [Mon, 18 Jul 2016 12:37:44 +0000 (12:37 +0000)]
[LLVM][MIPS] Revert support for FRE.

Reviewers: jaydeep

Subscribers: bhushan, mohit.bhakkad, slthakur, llvm-commits
llvm-svn: 275785

8 years agotest: Add missing 'REQUIRES' line
Tobias Grosser [Mon, 18 Jul 2016 12:02:44 +0000 (12:02 +0000)]
test: Add missing 'REQUIRES' line

llvm-svn: 275784

8 years agoGPGPU: Create host control flow
Tobias Grosser [Mon, 18 Jul 2016 11:56:39 +0000 (11:56 +0000)]
GPGPU: Create host control flow

Create LLVM-IR for all host-side control flow of a given GPU AST. We implement
this by introducing a new GPUNodeBuilder class derived from IslNodeBuilder.  The
IslNodeBuilder will take care of generating all general-purpose ast nodes, but
we provide our own createUser implementation to handle the different GPU
specific user statements. For now, we just skip any user statement and only
generate a host-code sceleton, but in subsequent commits we will add handling of
normal ScopStmt's performing computations, kernel calls, as well as host-device
data transfers. We will also introduce run-time check generation and LICM in
subsequent commits.

llvm-svn: 275783

8 years ago[test] Report error when inferior test processes exit with a non-zero code
Pavel Labath [Mon, 18 Jul 2016 11:27:19 +0000 (11:27 +0000)]
[test] Report error when inferior test processes exit with a non-zero code

Summary:
We've run into this problem when the test errored out so early (because it could not connect to
the remote device), that the code in D20193 did not catch the error. This resulted in the test
suite reporting success with 0 tests being run.

This patch makes sure that any non-zero exit code from the inferior process gets reported as an
error. Basically I expand the concept of "exceptional exits", which was previously being used for
signals to cover these cases as well.

Reviewers: tfiala, zturner

Subscribers: lldb-commits

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

llvm-svn: 275782

8 years ago[include-fixer] Add an options allow moving the cursor to #include line in vim
Haojian Wu [Mon, 18 Jul 2016 10:04:45 +0000 (10:04 +0000)]
[include-fixer] Add an options allow moving the cursor to #include line in vim
after inserting a missing header.

Summary:

A small improvement: Don't print newline character at the end of message, so
that users don't have to type ENTER manually after running the python script.

Reviewers: bkramer

Subscribers: djasper, klimek, cfe-commits

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

llvm-svn: 275781

8 years ago[Compiler-rt][MIPS] Fix simple test failure when using gcc
Mohit K. Bhakkad [Mon, 18 Jul 2016 09:23:23 +0000 (09:23 +0000)]
[Compiler-rt][MIPS] Fix simple test failure when using gcc

Reviewers: dsanders

Subscribers: slthakur, jaydeep, llvm-commits, Sanitizers

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

llvm-svn: 275780

8 years agoAMDGPU: Disable AMDGPUPromoteAlloca pass for shader calling conventions.
Nicolai Haehnle [Mon, 18 Jul 2016 09:02:47 +0000 (09:02 +0000)]
AMDGPU: Disable AMDGPUPromoteAlloca pass for shader calling conventions.

Summary:
The work item intrinsics are not available for the shader
calling conventions. And even if we did hook them up most
shader stages haves some extra restrictions on the amount
of available LDS.

Reviewers: tstellarAMD, arsenm

Subscribers: nhaehnle, arsenm, llvm-commits, kzhuravl

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

llvm-svn: 275779

8 years agoImplement GetMemoryRegions() for Windows Minidumps and live processes.
Howard Hellyer [Mon, 18 Jul 2016 08:25:59 +0000 (08:25 +0000)]
Implement GetMemoryRegions() for Windows Minidumps and live processes.

Summary:
This patch fills in the implementation of GetMemoryRegions() on the Windows live process and minidump implementations of lldb_private::Process (ProcessWindowsLive::GetMemoryRegionInfo and ProcessWinMiniDump::Impl::GetMemoryRegionInfo.) The GetMemoryRegions API was added under: http://reviews.llvm.org/D20565

The existing Windows implementations didn’t fill in the start and end addresses within MemoryRegionInfo. This patch fixes that and adds support for the new mapped flag on MemoryRegionInfo that says whether a memory range is mapped into the process address space or not.

The behaviour of both live and core implementations should match the behaviour documented on Process::GetMemoryRegionInfo (in Process.h) which in turn should match the behaviour of the qMemoryRegionInfo query documented in lldb-gdb-remote.txt.

Reviewers: clayborg, amccarth

Subscribers: amccarth, lldb-commits

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

llvm-svn: 275778

8 years ago[ARM] Update test to use CHECK-LABEL. NFCI.
Diana Picus [Mon, 18 Jul 2016 07:48:42 +0000 (07:48 +0000)]
[ARM] Update test to use CHECK-LABEL. NFCI.

llvm-svn: 275777

8 years ago[ARM] Skip inline asm memory operands in DAGToDAGISel
Diana Picus [Mon, 18 Jul 2016 07:35:14 +0000 (07:35 +0000)]
[ARM] Skip inline asm memory operands in DAGToDAGISel

The current logic for handling inline asm operands in DAGToDAGISel interprets
the operands by looking for constants, which should represent the flags
describing the kind of operand we're dealing with (immediate, memory, register
def etc). The operands representing actual data are skipped only if they are
non-const, with the exception of immediate operands which are skipped explicitly
when a flag describing an immediate is found.

The oversight is that memory operands may be const too (e.g. for device drivers
reading a fixed address), so we should explicitly skip the operand following a
flag describing a memory operand. If we don't, we risk interpreting that
constant as a flag, which is definitely not intended.

Fixes PR26038

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

llvm-svn: 275776

8 years ago[AVX512] Add EVEX versions of scalar ADD/SUB/MUL/DIV to load folding tables.
Craig Topper [Mon, 18 Jul 2016 06:49:32 +0000 (06:49 +0000)]
[AVX512] Add EVEX versions of scalar ADD/SUB/MUL/DIV to load folding tables.

llvm-svn: 275775

8 years ago[X86] Fix test checks to include leading 'v' on avx mnemonic names.
Craig Topper [Mon, 18 Jul 2016 06:49:29 +0000 (06:49 +0000)]
[X86] Fix test checks to include leading 'v' on avx mnemonic names.

llvm-svn: 275774

8 years ago[ARM] Honour ABI for rem under -O0 for EABI, GNUEABI, Android and Musl
Diana Picus [Mon, 18 Jul 2016 06:48:25 +0000 (06:48 +0000)]
[ARM] Honour ABI for rem under -O0 for EABI, GNUEABI, Android and Musl

At higher optimization levels, we generate the libcall for DIVREM_Ix, which is
fine: aeabi_{u|i}divmod. At -O0 we generate the one for REM_Ix, which is the
default {u}mod{q|h|s|d}i3.

This commit makes sure that we don't generate REM_Ix calls for ABIs that
don't support them (i.e. where we need to use DIVREM_Ix instead). This is
achieved by bailing out of FastISel, which can't handle non-double multi-reg
returns, and letting the legalization infrastructure expand the REM_Ix calls.

It also updates the divmod-eabi.ll test to run under -O0 as well, and adds some
Windows checks to it to make sure we don't break things for it.

Fixes PR27068

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

llvm-svn: 275773

8 years agoRemove locale tests that depend on enviroment variables.
Eric Fiselier [Mon, 18 Jul 2016 06:15:55 +0000 (06:15 +0000)]
Remove locale tests that depend on enviroment variables.

Constructing a std::locale object from an empty string selects the language
from the current environment variables. If the environment variables name
a locale that doesn't exist, or isn't installed, then the construction of
facets using that locale may throw.

This patch removes tests that use 'std::locale l("")'.

The optimal solution would be to manually set the environment variables
in the test. Unfortunately there is no portable way to do this.

llvm-svn: 275772

8 years ago[AVX512] Add KADD/KAND/KOR/KXOR to X86InstrInfo::isAssociativeAndCommutative.
Craig Topper [Mon, 18 Jul 2016 06:14:59 +0000 (06:14 +0000)]
[AVX512] Add KADD/KAND/KOR/KXOR to X86InstrInfo::isAssociativeAndCommutative.

llvm-svn: 275771

8 years ago[X86] Add VPMULLW/D/Q instructions to X86InstrInfo::isAssociativeAndCommutative.
Craig Topper [Mon, 18 Jul 2016 06:14:57 +0000 (06:14 +0000)]
[X86] Add VPMULLW/D/Q instructions to X86InstrInfo::isAssociativeAndCommutative.

llvm-svn: 275770

8 years ago[X86] Add VPADD instructions to X86InstrInfo::isAssociativeAndCommutative.
Craig Topper [Mon, 18 Jul 2016 06:14:54 +0000 (06:14 +0000)]
[X86] Add VPADD instructions to X86InstrInfo::isAssociativeAndCommutative.

llvm-svn: 275769

8 years ago[X86] Add floating point packed logical ops to X86InstrInfo::isAssociativeAndCommutative.
Craig Topper [Mon, 18 Jul 2016 06:14:50 +0000 (06:14 +0000)]
[X86] Add floating point packed logical ops to X86InstrInfo::isAssociativeAndCommutative.

llvm-svn: 275768

8 years ago[X86] Add AVX512 instructions to X86InstrInfo::isAssociativeAndCommutative.
Craig Topper [Mon, 18 Jul 2016 06:14:47 +0000 (06:14 +0000)]
[X86] Add AVX512 instructions to X86InstrInfo::isAssociativeAndCommutative.

llvm-svn: 275767

8 years ago[X86] Add more AVX512 instructions to X86InstrInfo::isHighLatencyDef. Also add all...
Craig Topper [Mon, 18 Jul 2016 06:14:45 +0000 (06:14 +0000)]
[X86] Add more AVX512 instructions to X86InstrInfo::isHighLatencyDef. Also add all packed fp division instructions.

llvm-svn: 275766

8 years ago[X86] Add AVX512 load opcodes and a couple AVX load opcodes to X86InstrInfo::areLoads...
Craig Topper [Mon, 18 Jul 2016 06:14:43 +0000 (06:14 +0000)]
[X86] Add AVX512 load opcodes and a couple AVX load opcodes to X86InstrInfo::areLoadsFromSameBasePtr.

llvm-svn: 275765

8 years ago[X86] Add more opcodes to isFrameLoadOpcode/isFrameStoreOpcode. Mainly AVX-512 related.
Craig Topper [Mon, 18 Jul 2016 06:14:39 +0000 (06:14 +0000)]
[X86] Add more opcodes to isFrameLoadOpcode/isFrameStoreOpcode. Mainly AVX-512 related.

llvm-svn: 275764

8 years ago[AVX512] Use VMOVAPSZ128rr/VMOVAPS256rr for VR128X/VR256X physreg moves when VLX...
Craig Topper [Mon, 18 Jul 2016 06:14:34 +0000 (06:14 +0000)]
[AVX512] Use VMOVAPSZ128rr/VMOVAPS256rr for VR128X/VR256X physreg moves when VLX is supported.

Ideally we would use VEX encoded moves instead of EVEX if the high 16 registers aren't referenced, but this a good first step.

llvm-svn: 275763

8 years ago[X86] Fix 80-column violations. NFC
Craig Topper [Mon, 18 Jul 2016 06:14:26 +0000 (06:14 +0000)]
[X86] Fix 80-column violations. NFC

llvm-svn: 275762

8 years ago[GVNHoist] Change the key for VNtoInsns to a pair
David Majnemer [Mon, 18 Jul 2016 06:11:37 +0000 (06:11 +0000)]
[GVNHoist] Change the key for VNtoInsns to a pair

While debugging GVNHoist, I found it confusing that the entries in a
VNtoInsns were not always value numbers.  They _usually_ were except for
StoreInst in which case they were a hash of two different value numbers.

This leads to two observations:
- It is more difficult to debug things when the semantic contents of
  VNtoInsns changes over time.
- Using a single value number is not much cheaper, the value of
  VNtoInsns is a SmallVector.
- It is not immediately clear what the algorithm would do if there were
  hash collisions in the StoreInst case.

Using a DenseMap of std::pair sidesteps all of this.

N.B.  The changes in the test were due their sensitivity to the
iteration order of VNtoInsns which has changed.

llvm-svn: 275761

8 years ago[libcxx][filesystem] Remove setgid from parent before testing permissions
Jonas Hahnfeld [Mon, 18 Jul 2016 06:06:50 +0000 (06:06 +0000)]
[libcxx][filesystem] Remove setgid from parent before testing permissions

man page for mkdir says: "If the parent directory has the set-group-ID bit set,
then so will the newly created directory."

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

llvm-svn: 275760

8 years agoRework libatomic handling in CMake and LIT.
Eric Fiselier [Mon, 18 Jul 2016 06:01:50 +0000 (06:01 +0000)]
Rework libatomic handling in CMake and LIT.

This patch updates the way libc++ handles checking for libatomic, in part
to prepare for https://reviews.llvm.org/D22073.

Changes:
* 'LIBCXX_HAS_ATOMIC_LIB' is now set whenever libatomic is available even libc++
   doesn't need to manually link it.
* 'LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB' is now used to detect when libatomic
   needs to be manually linked.
* 'LIBCXX_HAS_ATOMIC_LIB' now adds 'libatomic' as a available feature in the
   test suite.

llvm-svn: 275759

8 years ago[llvm-cov] Attempt to fix a test failure on Windows
Vedant Kumar [Mon, 18 Jul 2016 04:49:42 +0000 (04:49 +0000)]
[llvm-cov] Attempt to fix a test failure on Windows

Don't make the test/tools/llvm-cov/demangle.test depend on the order in
which symbols are seen, or on the exact formatting llvm-cov emits after
a symbol is printed. This is an attempt to fix a Windows bot failure:

  http://lab.llvm.org:8011/builders/clang-x86-win2008-selfhost/builds/9141

I don't know what the root cause of the failure is, or why the
showTemplateInstantiations test doesn't fail in the same way on the
Windows bots. However, this measure can't hurt, and it'll at least get
me on the blamelists again.

llvm-svn: 275758

8 years agoImprove ABI tests for std::pair.
Eric Fiselier [Mon, 18 Jul 2016 04:48:37 +0000 (04:48 +0000)]
Improve ABI tests for std::pair.

llvm-svn: 275757

8 years agoRevert r275678, "Revert "Revert r275027 - Let FuncAttrs infer the 'returned' argument...
NAKAMURA Takumi [Mon, 18 Jul 2016 03:23:25 +0000 (03:23 +0000)]
Revert r275678, "Revert "Revert r275027 - Let FuncAttrs infer the 'returned' argument attribute""

This reverts also r275029, "Update Clang tests after adding inference for the returned argument attribute"

It broke LTO build. Seems miscompilation.

llvm-svn: 275756

8 years agoAdd checkpoint diagnostics to help diagnose buildbot failures.
Eric Fiselier [Mon, 18 Jul 2016 03:00:09 +0000 (03:00 +0000)]
Add checkpoint diagnostics to help diagnose buildbot failures.

llvm-svn: 275754

8 years agoPrevent failures by marking Clock::is_steady tests as UNSUPPORTED: asan.
Eric Fiselier [Mon, 18 Jul 2016 02:29:33 +0000 (02:29 +0000)]
Prevent failures by marking Clock::is_steady tests as UNSUPPORTED: asan.

llvm-svn: 275753

8 years agoFix arc config to use https
Eric Fiselier [Mon, 18 Jul 2016 02:05:52 +0000 (02:05 +0000)]
Fix arc config to use https

llvm-svn: 275752

8 years agoAdd includes in test. Patch from STL@microsoft.com
Eric Fiselier [Mon, 18 Jul 2016 02:05:31 +0000 (02:05 +0000)]
Add includes in test. Patch from STL@microsoft.com

llvm-svn: 275751

8 years agoUpgrade arcconfig to use https
Eric Fiselier [Mon, 18 Jul 2016 02:02:49 +0000 (02:02 +0000)]
Upgrade arcconfig to use https

llvm-svn: 275750

8 years agoRename and rework `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR`. Move FreeBSD configuration in...
Eric Fiselier [Mon, 18 Jul 2016 01:58:37 +0000 (01:58 +0000)]
Rename and rework `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR`. Move FreeBSD configuration in-tree.

This patch does the following:

* It renames `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR` to `_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR`.
* It automatically enables this option on FreeBSD in ABI V1, since that's the current ABI FreeBSD ships.
* It cleans up the handling of this option in `std::pair`.

I would like the sign off from the FreeBSD maintainers. They will no longer need to keep their `__config` changes downstream.

I'm still hoping to come up with a better way to maintain the ABI without needing these constructors.

Reviewed in https://reviews.llvm.org/D21329

llvm-svn: 275749

8 years agoSuppress warning in make_from_tuple tests.
Eric Fiselier [Mon, 18 Jul 2016 01:52:46 +0000 (01:52 +0000)]
Suppress warning in make_from_tuple tests.

llvm-svn: 275748

8 years agoRemove SymbolBody::PlaceholderKind.
Rui Ueyama [Mon, 18 Jul 2016 01:35:00 +0000 (01:35 +0000)]
Remove SymbolBody::PlaceholderKind.

In the last patch for --trace-symbol, I introduced a new symbol type
PlaceholderKind and store it to SymVector storage. It made all code
that iterates over SymVector to recognize and skip PlaceholderKind
symbols. I found that that's annoying.

In this patch, I removed PlaceholderKind and stop storing them to SymVector.
Now the information whether a symbol is being watched by --trace-symbol
is stored to the Symtab hash table.

llvm-svn: 275747

8 years agoIterate over SymVector instead of Symtab hash table.
Rui Ueyama [Mon, 18 Jul 2016 01:34:57 +0000 (01:34 +0000)]
Iterate over SymVector instead of Symtab hash table.

SymVector contains all symbols, so we can iterate either Symtab or SymVector
to visit all symbols. Iterating over SymVector makes the next change for
--trace-symbol possible.

llvm-svn: 275746

8 years agoImplement C++17 tuple bits. Including apply and make_from_tuple.
Eric Fiselier [Mon, 18 Jul 2016 00:35:56 +0000 (00:35 +0000)]
Implement C++17 tuple bits. Including apply and make_from_tuple.

This patch upgrades <tuple> to be C++17 compliant by implementing:

* tuple_size_v: This was forgotten when implementing the other _v traits.
* std::apply: This was added via LFTS v1 in p0220r1.
* std::make_from_tuple: This was added in p0209r2.

llvm-svn: 275745

8 years ago[GVNHoist] Sink HoistedCtr into GVNHoist
David Majnemer [Mon, 18 Jul 2016 00:35:01 +0000 (00:35 +0000)]
[GVNHoist] Sink HoistedCtr into GVNHoist

HoistedCtr cannot be a mutated global variable, that will open us up to
races between threads compiling code in parallel.

llvm-svn: 275744

8 years ago[GVNHoist] Some small cleanups
David Majnemer [Mon, 18 Jul 2016 00:34:58 +0000 (00:34 +0000)]
[GVNHoist] Some small cleanups

No functional change is intended, just trying to clean things up a
little.

llvm-svn: 275743

8 years ago[GVN] Move other PRE tests to a subdirectory.
Davide Italiano [Sun, 17 Jul 2016 23:55:20 +0000 (23:55 +0000)]
[GVN] Move other PRE tests to a subdirectory.

llvm-svn: 275742

8 years ago[GVN] Move the PRE/LOADPRE test in a subdirectory.
Davide Italiano [Sun, 17 Jul 2016 23:48:18 +0000 (23:48 +0000)]
[GVN] Move the PRE/LOADPRE test in a subdirectory.

llvm-svn: 275741

8 years ago[compiler-rt] Change all asm directives to __asm__ in cpu_model.
Alina Sbirlea [Sun, 17 Jul 2016 23:45:55 +0000 (23:45 +0000)]
[compiler-rt] Change all asm directives to __asm__ in cpu_model.

Summary:
Aiming to resolve failure in sanitizer bot by changning all asm directives to __asm__.
Also, consistency.

Reviewers: llvm-commits, echristo, vitalybuka

Subscribers: mehdi_amini

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

llvm-svn: 275740

8 years ago[GVN] Use FileCheck instead of grep for tests.
Davide Italiano [Sun, 17 Jul 2016 23:21:26 +0000 (23:21 +0000)]
[GVN] Use FileCheck instead of grep for tests.

llvm-svn: 275739

8 years agotest: add missing triple to test
Saleem Abdulrasool [Sun, 17 Jul 2016 22:54:42 +0000 (22:54 +0000)]
test: add missing triple to test

The test was relying on the default triple which may not be correct.  Explicitly
provide it a triple.  Should repair the windows on Linux builder.

llvm-svn: 275738

8 years agoCodeGen: honour dllstorage on ObjC types
Saleem Abdulrasool [Sun, 17 Jul 2016 22:27:44 +0000 (22:27 +0000)]
CodeGen: honour dllstorage on ObjC types

Add support for ObjC types to respect the DLLImport/DLLExport storage
annotations.  This only effects COFF output.  This would allow usage with
clang/C2, but not with clang/LLVM due to hard coded section names.

llvm-svn: 275737

8 years agoCodeGen: whitespace, formatting cleanups, NFC
Saleem Abdulrasool [Sun, 17 Jul 2016 22:27:41 +0000 (22:27 +0000)]
CodeGen: whitespace, formatting cleanups, NFC

Format some code which was oddly formatted.  Use a bit of auto to make the code
more legible.  NFC.

llvm-svn: 275736

8 years agoCodeGen: whitespace cleanup, StringRef usage in ObjC EH type construction
Saleem Abdulrasool [Sun, 17 Jul 2016 22:27:38 +0000 (22:27 +0000)]
CodeGen: whitespace cleanup, StringRef usage in ObjC EH type construction

Clean up some formatting issues and use a bit more StringRef based operations
instead of SmallStrings.  NFC.

llvm-svn: 275735

8 years agoCheck for unconstrained hash equality before constrained hash equality.
Eric Fiselier [Sun, 17 Jul 2016 22:04:57 +0000 (22:04 +0000)]
Check for unconstrained hash equality before constrained hash equality.

This patch implements a simple optimization in __hash_table::find. When iterating
the found bucket we only constrain the bucket elements hash if it doesn't
already match the unconstrained hash of the specified key. This prevent
the performance of an expensive modulo operation.

Since the bucket element almost always matches the key, especially when the
load factor is low, this optimization has large performance impacts. For
a unordered_set<int> of random integers this patch improves the performance of
'find(...)' by 40%.

llvm-svn: 275734

8 years agoRefactor (with some rewriting) the DynamicLoaderMacOSX plugin into
Jason Molenda [Sun, 17 Jul 2016 21:27:32 +0000 (21:27 +0000)]
Refactor (with some rewriting) the DynamicLoaderMacOSX plugin into
a base class and a derived class, with the derived class containing
the methods specific to reading dyld's all_image_infos, dyld's
method of specifying images that have been loaded or unloaded, the
place where we put a breakpoint in dyld to get notified about newly
loaded or unloaded images.

This is in preparation for a second derived class which will use
some alternate methods for getting this information; that will be
a separate commit in the next few days.

There's a couple of ivars that should probably be in the derived
DyanmicLoaderMacOSX class instead of the base DynamicLoaderDarwin
class (m_dyld_image_infos, m_dyld_image_infos_stop_id).  I don't
think I'll need to use these in the new derived class - I'll
move them down to DynamicLoaderMacOSX if it works out that way;
it'll simplify locking if I can do that.

<rdar://problem/25251243>

llvm-svn: 275733

8 years agoFix std::experimental::optional tests. Patch from Casey Carter.
Eric Fiselier [Sun, 17 Jul 2016 20:32:30 +0000 (20:32 +0000)]
Fix std::experimental::optional tests. Patch from Casey Carter.

llvm-svn: 275732

8 years agoInitialize the "is_loaded" local in LoadModuleAtAddress in
Jason Molenda [Sun, 17 Jul 2016 20:01:54 +0000 (20:01 +0000)]
Initialize the "is_loaded" local in LoadModuleAtAddress in
case Process::GetFileLoadAddress fails to set it to a real
value.  (fixing "conditional use of garbage value" clang warning)

llvm-svn: 275731

8 years agoAttempt to work around MSVC rejects-valid, round 2.
Richard Smith [Sun, 17 Jul 2016 20:00:59 +0000 (20:00 +0000)]
Attempt to work around MSVC rejects-valid, round 2.

llvm-svn: 275730

8 years agoAdd missing break stmt to DW_CFA_GNU_args_size case.
Jason Molenda [Sun, 17 Jul 2016 19:57:49 +0000 (19:57 +0000)]
Add missing break stmt to DW_CFA_GNU_args_size case.

llvm-svn: 275729

8 years agoUnbreak msan buildbot.
Rui Ueyama [Sun, 17 Jul 2016 19:55:22 +0000 (19:55 +0000)]
Unbreak msan buildbot.

llvm-svn: 275728

8 years agoPR28589: attempt to work around MSVC rejects-valid.
Richard Smith [Sun, 17 Jul 2016 19:24:51 +0000 (19:24 +0000)]
PR28589: attempt to work around MSVC rejects-valid.

llvm-svn: 275727

8 years agoStrip trailing whitespace
Simon Pilgrim [Sun, 17 Jul 2016 19:02:27 +0000 (19:02 +0000)]
Strip trailing whitespace

llvm-svn: 275726

8 years ago[X86] Add CTPOP/CTLZ/CTTZ scalar cost tests
Simon Pilgrim [Sun, 17 Jul 2016 18:29:19 +0000 (18:29 +0000)]
[X86] Add CTPOP/CTLZ/CTTZ scalar cost tests

llvm-svn: 275725

8 years agoRemove dead code.
Rui Ueyama [Sun, 17 Jul 2016 18:27:17 +0000 (18:27 +0000)]
Remove dead code.

llvm-svn: 275724

8 years agoAdd tests for max/minIntN(64).
Justin Lebar [Sun, 17 Jul 2016 18:19:28 +0000 (18:19 +0000)]
Add tests for max/minIntN(64).

Summary:
Given that we had a bug on max/minUIntN(64), these should have tests
too.

Reviewers: rnk

Subscribers: dylanmckay, llvm-commits

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

llvm-svn: 275723

8 years agoAvoid UB in maxIntN(64).
Justin Lebar [Sun, 17 Jul 2016 18:19:26 +0000 (18:19 +0000)]
Avoid UB in maxIntN(64).

Summary:
Previously we were relying on 2's complement underflow in an int64_t.
Now we cast to a uint64_t so we explicitly get the behavior we want.

Reviewers: rnk

Subscribers: dylanmckay, llvm-commits

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

llvm-svn: 275722

8 years agoClean up some comments in MathExtras.h.
Justin Lebar [Sun, 17 Jul 2016 18:19:25 +0000 (18:19 +0000)]
Clean up some comments in MathExtras.h.

Reviewers: rnk

Subscribers: llvm-commits, dylanmckay

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

llvm-svn: 275721

8 years agoAdd assertions checking SignExtend{32,64}'s bit width.
Justin Lebar [Sun, 17 Jul 2016 18:19:23 +0000 (18:19 +0000)]
Add assertions checking SignExtend{32,64}'s bit width.

Summary:
The bit width must be greater than zero, otherwise we shift by the
integer's width, which is UB.  Also (more obviously) the width must be
less than or equal to the integer's width, otherwise we shift by a
negative number, which is also UB.

Reviewers: rnk

Subscribers: llvm-commits, dylanmckay

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

llvm-svn: 275720

8 years agoFix isShiftedInt and isShiftedUint for widths > 32.
Justin Lebar [Sun, 17 Jul 2016 18:19:21 +0000 (18:19 +0000)]
Fix isShiftedInt and isShiftedUint for widths > 32.

Summary:
Previously we were doing 1 << S.  "1" is an int, so this doesn't work
when S >= 32.

This patch also adds some static_asserts to these functions to ensure
that we don't hit UB by shifting left too much.

Reviewers: rnk

Subscribers: llvm-commits, dylanmckay

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

llvm-svn: 275719

8 years agoUse a faster implementation of maxUIntN.
Justin Lebar [Sun, 17 Jul 2016 18:19:19 +0000 (18:19 +0000)]
Use a faster implementation of maxUIntN.

Summary:
On x86-64 with clang 3.8, before:

   mov     edx, 1
   mov     cl, dil
   shl     rdx, cl
   cmp     rdi, 64
   mov     rax, -1
   cmovne  rax, rdx
   ret

after:

  mov     ecx, 64
  sub     ecx, edi
  mov     rax, -1
  shr     rax, cl
  ret

Reviewers: rnk

Subscribers: dylanmckay, mkuper, llvm-commits

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

llvm-svn: 275718

8 years agoFix warnings in ImmutableSetTest and SequenceTest.
Justin Lebar [Sun, 17 Jul 2016 18:10:30 +0000 (18:10 +0000)]
Fix warnings in ImmutableSetTest and SequenceTest.

Doing "I++" inside of an EXPECT_* triggers

  warning: expression with side effects has no effect in an unevaluated context

because EXPECT_* partially expands to

  EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(i++)) == 1)>

which is an unevaluated context.

llvm-svn: 275717

8 years agoImplement almost-zero-cost --trace-symbol.
Rui Ueyama [Sun, 17 Jul 2016 17:50:09 +0000 (17:50 +0000)]
Implement almost-zero-cost --trace-symbol.

--trace-symbol is a command line option to watch a symbol.
Previosly, we looked up a hash table for a new symbol if the
option is given. Any code that looks up a hash table for each
symbol is expensive because the linker handles a lot of symbols.
In our design, we look up a hash table strictly only once
for a symbol, so --trace-symbol was an exception.

This patch improves efficiency of the option by merging the
hash table into the symbol table.

Instead of looking up a separate hash table with a string,
this patch sets `Traced` flag to symbols specified by --trace-symbol.
So, if you insert a symbol and get a symbol with `Traced` flag on,
you know that you need to print out a log message for the symbol.
This is nearly zero cost.

llvm-svn: 275716

8 years agoMake Lazy's ctro protected because it shouldn't be instantiated directly.
Rui Ueyama [Sun, 17 Jul 2016 17:44:41 +0000 (17:44 +0000)]
Make Lazy's ctro protected because it shouldn't be instantiated directly.

llvm-svn: 275715

8 years agoRemove duplicate public specifier.
Rui Ueyama [Sun, 17 Jul 2016 17:44:40 +0000 (17:44 +0000)]
Remove duplicate public specifier.

llvm-svn: 275714

8 years ago[X86][AVX] Added VBROADCASTF128/VBROADCASTI128 tests
Simon Pilgrim [Sun, 17 Jul 2016 17:44:18 +0000 (17:44 +0000)]
[X86][AVX] Added VBROADCASTF128/VBROADCASTI128 tests

llvm-svn: 275713

8 years agoPrint out file names for common symbols for --trace-symbol.
Rui Ueyama [Sun, 17 Jul 2016 17:36:22 +0000 (17:36 +0000)]
Print out file names for common symbols for --trace-symbol.

Previously, there was no way to get a file name for a DefinedCommon
symbol. This patch adds it.

llvm-svn: 275712

8 years agoHandle versioned symbols efficiently.
Rui Ueyama [Sun, 17 Jul 2016 17:23:17 +0000 (17:23 +0000)]
Handle versioned symbols efficiently.

Versions can be assigned to symbols in two different ways.
One is the usual version scripts, and the other is special
symbol suffix '@'. If a symbol contains '@', the string after
that is considered to specify a version name.

Previously, we look for '@' for all symbols.

Anything that works on every symbol can be expensive because
the linker has to handle a lot of symbols. The search for '@'
was not an exception.

In this patch, I made two optimizations.

The first optimization is to handle '@' only when at least one
version is defined. If no versions are defined, no versions can
be assigned to any symbols, so it's waste of time to search for '@'.

The second optimization is to scan only suffixes of symbol names
instead of entire symbol names. Symbol names can be very long, but
symbol versions are usually short, so scanning entire symbol names
is waste of time, too.

There are some error cases which we no longer be able to detect
with this patch. I don't think it's a major drawback because they
are minor errors. Speed is more important.

This change improves LLD with debug info self-link time from
6.6993 seconds to 6.3426 seconds (or -5.3%).

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

llvm-svn: 275711

8 years ago[X86] Regenerated ctlz/cttz scalar tests for 32/64-bit targets with/without LZCNT...
Simon Pilgrim [Sun, 17 Jul 2016 16:15:51 +0000 (16:15 +0000)]
[X86] Regenerated ctlz/cttz scalar tests for 32/64-bit targets with/without LZCNT/TZCNT support

llvm-svn: 275710

8 years ago[X86] Regenerated popcnt scalar tests for 32/64-bit targets with/without POPCNT support
Simon Pilgrim [Sun, 17 Jul 2016 16:04:19 +0000 (16:04 +0000)]
[X86] Regenerated popcnt scalar tests for 32/64-bit targets with/without POPCNT support

llvm-svn: 275709

8 years ago[X86][SSE] lowerVectorShuffleAsPermuteAndUnpack tidyup. NFCI.
Simon Pilgrim [Sun, 17 Jul 2016 15:48:25 +0000 (15:48 +0000)]
[X86][SSE] lowerVectorShuffleAsPermuteAndUnpack tidyup. NFCI.

Moved unpack type determination into TryUnpack lambda.

Added missing comment describing lowerVectorShuffleAsPermuteAndUnpack call.

llvm-svn: 275708

8 years ago[ThinLTO] Perform profile-guided indirect call promotion
Teresa Johnson [Sun, 17 Jul 2016 14:47:01 +0000 (14:47 +0000)]
[ThinLTO] Perform profile-guided indirect call promotion

Summary:
To enable profile-guided indirect call promotion in ThinLTO mode, we
simply add call graph edges for each profitable target from the profile
to the summaries, then the summary-guided importing will consider the
callee for importing as usual.

Also we need to enable the indirect call promotion pass creation in the
PassManagerBuilder when PerformThinLTO=true (we are in the ThinLTO
backend), so that the newly imported functions are considered for
promotion in the backends.

The IC promotion profiles refer to callees by GUID, which required
adding GUIDs to the per-module VST in bitcode (and assigning them
valueIds similar to how they are assigned valueIds in the combined
index).

Reviewers: mehdi_amini, xur

Subscribers: mehdi_amini, davidxl, llvm-commits

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

llvm-svn: 275707

8 years agoAddress review comments.
Teresa Johnson [Sun, 17 Jul 2016 14:46:58 +0000 (14:46 +0000)]
Address review comments.

llvm-svn: 275706

8 years agoRefactor indirect call promotion profitability analysis (NFC)
Teresa Johnson [Sun, 17 Jul 2016 14:46:54 +0000 (14:46 +0000)]
Refactor indirect call promotion profitability analysis (NFC)

Summary:
Refactored the profitability analysis out of the IC promotion pass and
into lib/Analysis so that it can be accessed by the summary index
builder in a follow-on patch to enable IC promotion in ThinLTO (D21932).

Reviewers: davidxl, xur

Subscribers: llvm-commits

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

llvm-svn: 275705

8 years agotest commit
Guy Blank [Sun, 17 Jul 2016 12:10:35 +0000 (12:10 +0000)]
test commit

llvm-svn: 275703

8 years agoX86: Updated a test file. NFC.
Elena Demikhovsky [Sun, 17 Jul 2016 07:03:13 +0000 (07:03 +0000)]
X86: Updated a test file. NFC.

This test shows subotimal code generated for AVX-512 vs PENTIUM4.
The issue will be fixed in an upcomming commit.

llvm-svn: 275702

8 years agoAdd a pointer to a source file to SymbolBody.
Rui Ueyama [Sun, 17 Jul 2016 03:11:46 +0000 (03:11 +0000)]
Add a pointer to a source file to SymbolBody.

Previously, each subclass of SymbolBody had a pointer to a source
file from which it was created. So, there was no single way to get
a source file for a symbol. We had getSourceFile<ELFT>(), but the
function was a bit inconvenient as it's a template.

This patch makes SymbolBody have a pointer to a source file.
If a symbol is not created from a file, the pointer has a nullptr.

llvm-svn: 275701

8 years agoDo not invoke FileCheck with `not` command.
Rui Ueyama [Sun, 17 Jul 2016 01:34:39 +0000 (01:34 +0000)]
Do not invoke FileCheck with `not` command.

We should use CHECK-NOT instead.

llvm-svn: 275700

8 years ago[CodeGen] Some assorted cleanups
David Majnemer [Sun, 17 Jul 2016 00:39:12 +0000 (00:39 +0000)]
[CodeGen] Some assorted cleanups

No functional change, just some cleanups:
- Use auto when it is appropriate.
- There were some strange static_casts which were superfluous.
- Use range-based for loops when appropriate.
- The dyn_cast_or_null construct was used when null was impossible.

llvm-svn: 275699

8 years ago[PM] Convert IVUsers analysis to new pass manager.
Dehao Chen [Sat, 16 Jul 2016 22:51:33 +0000 (22:51 +0000)]
[PM] Convert IVUsers analysis to new pass manager.

Summary: Convert IVUsers analysis to new pass manager.

Reviewers: davidxl, silvas

Subscribers: junbuml, sanjoy, llvm-commits, mzolotukhin

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

llvm-svn: 275698

8 years agoCodeGen: use StringRefs more in ObjC class generation, NFC
Saleem Abdulrasool [Sat, 16 Jul 2016 22:42:06 +0000 (22:42 +0000)]
CodeGen: use StringRefs more in ObjC class generation, NFC

Rather than building up a number of SmallString-s in order to construct a
std::string, use more StringRefs and construct the string once before use.  This
avoids unnecessary string constructions.  NFC.

llvm-svn: 275697

8 years agoCodeGen: simplify using a local variable, NFC
Saleem Abdulrasool [Sat, 16 Jul 2016 22:42:04 +0000 (22:42 +0000)]
CodeGen: simplify using a local variable, NFC

Add a couple of local variables for the class interface and the super class
interface.  This allows for the repeated access of the information to be cached
and makes the code simpler to understand.  NFC.

llvm-svn: 275696

8 years agoAttempt to unbreak Windows bot.
Rui Ueyama [Sat, 16 Jul 2016 19:16:15 +0000 (19:16 +0000)]
Attempt to unbreak Windows bot.

llvm-svn: 275695

8 years agoRemove redundant namespace specifiers.
Rui Ueyama [Sat, 16 Jul 2016 18:55:47 +0000 (18:55 +0000)]
Remove redundant namespace specifiers.

llvm-svn: 275694