platform/upstream/llvm.git
7 years ago[APInt] Move the >64 bit case for flipAllBits out of line.
Craig Topper [Mon, 27 Mar 2017 17:10:21 +0000 (17:10 +0000)]
[APInt] Move the >64 bit case for flipAllBits out of line.

This is more consistent with what we do for other operations. This shrinks the opt binary on my build by ~72k.

llvm-svn: 298858

7 years ago[AMDGPU] Fix SI scheduler LiveOut Refcount issue
Valery Pykhtin [Mon, 27 Mar 2017 17:06:36 +0000 (17:06 +0000)]
[AMDGPU] Fix SI scheduler LiveOut Refcount issue

Patch by Axel Davy (axel.davy@normalesup.org)

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

llvm-svn: 298857

7 years ago[GlobalISel][AArch64] Select CBZ.
Ahmed Bougacha [Mon, 27 Mar 2017 16:35:31 +0000 (16:35 +0000)]
[GlobalISel][AArch64] Select CBZ.

CBZ/CBNZ represent a substantial portion of all conditional branches.
Look through G_ICMP to select them.

We can't use tablegen yet because the existing patterns match an
AArch64ISD node.

llvm-svn: 298856

7 years ago[GlobalISel] Add a 'getConstantVRegVal' helper.
Ahmed Bougacha [Mon, 27 Mar 2017 16:35:27 +0000 (16:35 +0000)]
[GlobalISel] Add a 'getConstantVRegVal' helper.

Use it to compare immediate operands.

llvm-svn: 298855

7 years ago[GlobalISel][AArch64] Use proper constant types in test. NFC.
Ahmed Bougacha [Mon, 27 Mar 2017 16:35:23 +0000 (16:35 +0000)]
[GlobalISel][AArch64] Use proper constant types in test. NFC.

llvm-svn: 298854

7 years agoLook through CXXBindTemporaryExprs when checking CXXFunctionCastExprs
Daniel Jasper [Mon, 27 Mar 2017 16:29:41 +0000 (16:29 +0000)]
Look through CXXBindTemporaryExprs when checking CXXFunctionCastExprs
for unused values.

This fixes a regression caused by r298676, where constructor calls to
classes with non-trivial dtor were marked as unused if the first
argument is an initializer list. This is inconsistent (as the test
shows) and also warns on a reasonbly common code pattern where people
just call constructors to create and immediately destroy an object.

llvm-svn: 298853

7 years ago[AMDGPU][MC] Fix for Bug 28207 + LIT tests
Dmitry Preobrazhensky [Mon, 27 Mar 2017 15:57:17 +0000 (15:57 +0000)]
[AMDGPU][MC] Fix for Bug 28207 + LIT tests

Enabled clamp and omod for v_cvt_* opcodes which have src0 of an integer type

Reviewers: vpykhtin, arsenm

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

llvm-svn: 298852

7 years ago[AArch64] Mark mrs of TPIDR_EL0 (thread pointer) as not having side effects.
Chad Rosier [Mon, 27 Mar 2017 15:52:38 +0000 (15:52 +0000)]
[AArch64] Mark mrs of TPIDR_EL0 (thread pointer) as not having side effects.

Among other things, this allows Machine LICM to hoist a costly 'mrs'
instruction from within a loop.

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

llvm-svn: 298851

7 years ago[ARM] Add a driver option for +no-neg-immediates
Sanne Wouda [Mon, 27 Mar 2017 15:34:52 +0000 (15:34 +0000)]
[ARM] Add a driver option for +no-neg-immediates

Reviewers: olista01, rengolin, javed.absar, samparker

Reviewed By: samparker

Subscribers: samparker, llvm-commits, aemerson

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

llvm-svn: 298850

7 years agoUse pthreads for thread-local lsan allocator cache on darwin
Francis Ricci [Mon, 27 Mar 2017 14:07:50 +0000 (14:07 +0000)]
Use pthreads for thread-local lsan allocator cache on darwin

Summary:
This patch allows us to move away from using __thread on darwin,
which is requiring for building lsan for darwin on ios version 7
and on iossim i386.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

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

llvm-svn: 298848

7 years agoDisable use_tls_dynamic on 32-bit linux
Francis Ricci [Mon, 27 Mar 2017 14:06:49 +0000 (14:06 +0000)]
Disable use_tls_dynamic on 32-bit linux

Summary:
This test fails with a false negative due to an unrelated change.
Since we expect a number of false negatives on 32-bit lsan,
disable this test on linux-i386 and linux-i686.

Reviewers: kubamracek, m.ostapenko, kcc

Subscribers: llvm-commits

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

llvm-svn: 298847

7 years ago[AMDGPU] Get address space mapping by target triple environment
Yaxun Liu [Mon, 27 Mar 2017 14:04:01 +0000 (14:04 +0000)]
[AMDGPU] Get address space mapping by target triple environment

As we introduced target triple environment amdgiz and amdgizcl, the address
space values are no longer enums. We have to decide the value by target triple.

The basic idea is to use struct AMDGPUAS to represent address space values.
For address space values which are not depend on target triple, use static
const members, so that they don't occupy extra memory space and is equivalent
to a compile time constant.

Since the struct is lightweight and cheap, it can be created on the fly at
the point of usage. Or it can be added as member to a pass and created at
the beginning of the run* function.

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

llvm-svn: 298846

7 years ago[InstCombine] Avoid incorrect folding of select into phi nodes when incoming element...
Anna Thomas [Mon, 27 Mar 2017 13:52:51 +0000 (13:52 +0000)]
[InstCombine] Avoid incorrect folding of select into phi nodes when incoming element is a vector type

Summary:
We are incorrectly folding selects into phi nodes when the incoming value of a phi
node is a constant vector. This optimization is done in `FoldOpIntoPhi` when the
select condition is a phi node with constant incoming values.
Without the fix, we are miscompiling (i.e. incorrectly folding the
select into the phi node) when the vector contains non-zero
elements.
This patch fixes the miscompile and we will correctly fold based on the
select vector operand (see added test cases).

Reviewers: majnemer, sanjoy, spatel

Subscribers: llvm-commits

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

llvm-svn: 298845

7 years agoCorrect OptionCategoryCompare() in the command line library.
Daniel Sanders [Mon, 27 Mar 2017 13:43:24 +0000 (13:43 +0000)]
Correct OptionCategoryCompare() in the command line library.

Summary:
It should return <0, 0, or >0 for less-than, equal, and greater-than like
strcmp() (according to the history, it used to be implemented with
strcmp()) but it actually returned 0, or 1 for not-equal and equal.

Reviewers: qcolombet

Reviewed By: qcolombet

Subscribers: qcolombet, llvm-commits

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

llvm-svn: 298844

7 years ago[tablegen] Use categories on options that only matter to one emitter.
Daniel Sanders [Mon, 27 Mar 2017 13:15:13 +0000 (13:15 +0000)]
[tablegen] Use categories on options that only matter to one emitter.

Summary:
The categories are emitted in a strange order in this patch due to a bug in the
CommandLine library.

Reviewers: ab

Reviewed By: ab

Subscribers: ab, llvm-commits

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

llvm-svn: 298843

7 years agoPublish one more parser RAII for external use.
Vassil Vassilev [Mon, 27 Mar 2017 13:11:32 +0000 (13:11 +0000)]
Publish one more parser RAII for external use.

llvm-svn: 298842

7 years agoADT: Add range helpers for pointer_ and pointee_iterator
Justin Bogner [Mon, 27 Mar 2017 12:56:12 +0000 (12:56 +0000)]
ADT: Add range helpers for pointer_ and pointee_iterator

llvm-svn: 298841

7 years ago[X86][AVX2] bugzilla bug 21281 Performance regression in vector interleave in AVX2
Gadi Haber [Mon, 27 Mar 2017 12:13:37 +0000 (12:13 +0000)]
[X86][AVX2] bugzilla bug 21281 Performance regression in vector interleave in AVX2
This is a patch for an on-going bugzilla bug 21281 on the generated X86 code for a matrix transpose8x8 subroutine which requires vector interleaving. The generated code in AVX2 is currently non-optimal and requires 60 instructions as opposed to only 40 instructions generated for AVX1.
 The patch includes a fix for the AVX2 case where vector unpack instructions use less operations than the vector blend operations available in AVX2.
 In this case using vector unpack instructions is more efficient.

Reviewers:
zvi
delena
igorb
craig.topper
guyblank
eladcohen
m_zuckerman
aymanmus
RKSimon

llvm-svn: 298840

7 years agoMark *pass tests as UNUSUPPORTED instead of XFAIL on old compilers
Marshall Clow [Mon, 27 Mar 2017 10:44:33 +0000 (10:44 +0000)]
Mark *pass tests as UNUSUPPORTED instead of XFAIL on old compilers

llvm-svn: 298839

7 years ago[OpenCL] Extended mapping of parcing CodeGen arguments
Egor Churaev [Mon, 27 Mar 2017 10:38:01 +0000 (10:38 +0000)]
[OpenCL] Extended mapping of parcing CodeGen arguments

Summary: Enable cl_mad_enamle and cl_no_signed_zeros options when user turns on cl_unsafe_math_optimizations or cl_fast_relaxed_math options.

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

llvm-svn: 298838

7 years agoFix build error:
Ismail Donmez [Mon, 27 Mar 2017 10:17:03 +0000 (10:17 +0000)]
Fix build error:

In file included from /home/abuild/rpmbuild/BUILD/llvm/projects/compiler-rt/lib/xray/tests/unit/xray_fdr_log_printer_tool.cc:15:
../projects/compiler-rt/lib/xray/tests/../xray_fdr_logging_impl.h:221:21: error: use of undeclared identifier 'CLOCK_MONOTONIC'
  wall_clock_reader(CLOCK_MONOTONIC, &TS);
                    ^
1 error generated.

llvm-svn: 298837

7 years agoAdd --std=c++11 to tests that #include <atomic>
Sam McCall [Mon, 27 Mar 2017 09:45:38 +0000 (09:45 +0000)]
Add --std=c++11 to tests that #include <atomic>

llvm-svn: 298836

7 years ago[XRay][clang] Remove dependency on libatomic for XRay builds
Dean Michael Berris [Mon, 27 Mar 2017 07:14:11 +0000 (07:14 +0000)]
[XRay][clang] Remove dependency on libatomic for XRay builds

Summary:
This change depends on D31381 where we change the implementation to use
sanitizer_common provided atomic operations library.

Fixes http://llvm.org/PR32274.

Reviewers: pelikan, dblaikie

Subscribers: cfe-commits

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

llvm-svn: 298835

7 years ago[TableGen] Make CodeGenMapTable understand the namespace field of an instruction
Karl-Johan Karlsson [Mon, 27 Mar 2017 07:13:44 +0000 (07:13 +0000)]
[TableGen] Make CodeGenMapTable understand the namespace field of an instruction

Do not force the backends to use target name as namespace.

Original patch by Mattias Eriksson

Reviewers: stoklund, craig.topper

Reviewed By: stoklund

Subscribers: materi, llvm-commits

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

llvm-svn: 298834

7 years ago[XRay][compiler-rt] Use sanitizer_common's atomic ops
Dean Michael Berris [Mon, 27 Mar 2017 07:13:35 +0000 (07:13 +0000)]
[XRay][compiler-rt] Use sanitizer_common's atomic ops

Instead of std::atomic APIs for atomic operations, we instead use APIs
include with sanitizer_common. This allows us to, at runtime, not have
to depend on potentially dynamically provided implementations of these
atomic operations.

Fixes http://llvm.org/PR32274.

llvm-svn: 298833

7 years agoMark *fail tests as UNUSUPPORTED instead of XFAIL on old compilers
Marshall Clow [Mon, 27 Mar 2017 06:31:58 +0000 (06:31 +0000)]
Mark *fail tests as UNUSUPPORTED instead of XFAIL on old compilers

llvm-svn: 298832

7 years ago[IR] Implement pairs of non-const and const methods using the const version instead...
Craig Topper [Mon, 27 Mar 2017 05:47:03 +0000 (05:47 +0000)]
[IR] Implement pairs of non-const and const methods using the const version instead of the non-const version. NFCI

This removes a const_cast of the this pointer.

llvm-svn: 298831

7 years ago[IR] Share implementation for pairs of const and non-const methods using const_cast...
Craig Topper [Mon, 27 Mar 2017 05:46:58 +0000 (05:46 +0000)]
[IR] Share implementation for pairs of const and non-const methods using const_cast. NFCI

llvm-svn: 298830

7 years agoSort.
Rui Ueyama [Mon, 27 Mar 2017 03:42:55 +0000 (03:42 +0000)]
Sort.

llvm-svn: 298829

7 years agoSimplify. NFC.
Rui Ueyama [Mon, 27 Mar 2017 03:41:00 +0000 (03:41 +0000)]
Simplify. NFC.

This patch calls getAddend on a relocation only when the relocation is RELA.
That doesn't really improve runtime performance but should improve
readability as the code now matches the function description.

llvm-svn: 298828

7 years ago[IR] Share implementation of pairs of const and non-const methods in BasicBlock using...
Craig Topper [Mon, 27 Mar 2017 02:38:17 +0000 (02:38 +0000)]
[IR] Share implementation of pairs of const and non-const methods in BasicBlock using the const version instead of the non-const version

Summary:
During post-commit review of a previous change I made it was pointed out that const casting 'this' is technically a bad practice. This patch re-implements all of the methods in BasicBlock that do this to use the const BasicBlock version and const_cast the return value instead.

I think there are still many other classes that do similar things. I may look at more in the future.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 298827

7 years ago[IR] Make Instruction::isAssociative method inline. Add LLVM_READONLY to the static...
Craig Topper [Sun, 26 Mar 2017 23:23:29 +0000 (23:23 +0000)]
[IR] Make Instruction::isAssociative method inline. Add LLVM_READONLY to the static version.

llvm-svn: 298826

7 years ago[Target] Remove some code probably copy/pasted from another backend.
Davide Italiano [Sun, 26 Mar 2017 21:45:04 +0000 (21:45 +0000)]
[Target] Remove some code probably copy/pasted from another backend.

llvm-svn: 298825

7 years agoRevert r298742 "[ODRHash] Add error messages for mismatched parameters in methods."
Vassil Vassilev [Sun, 26 Mar 2017 21:39:16 +0000 (21:39 +0000)]
Revert r298742 "[ODRHash] Add error messages for mismatched parameters in methods."

I failed to revert this in r298816.

llvm-svn: 298824

7 years ago[MachineScheduler] Reference the correct header.
Davide Italiano [Sun, 26 Mar 2017 21:27:21 +0000 (21:27 +0000)]
[MachineScheduler] Reference the correct header.

llvm-svn: 298823

7 years ago[asan] Remove column numbers from test expectations in invalid-pointer-pairs.cc
Kuba Mracek [Sun, 26 Mar 2017 21:20:42 +0000 (21:20 +0000)]
[asan] Remove column numbers from test expectations in invalid-pointer-pairs.cc

This is failing on some of our internal bots because we're using different symbolizers. It doesn't seem important and we never test for column numbers in any other tests, so let's just remove it.

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

llvm-svn: 298822

7 years agoFactor out code to add a GOT entry.
Rui Ueyama [Sun, 26 Mar 2017 21:00:09 +0000 (21:00 +0000)]
Factor out code to add a GOT entry.

llvm-svn: 298821

7 years ago[tsan] Only Acquire/Release GCD queues if they're not NULL
Kuba Mracek [Sun, 26 Mar 2017 20:59:23 +0000 (20:59 +0000)]
[tsan] Only Acquire/Release GCD queues if they're not NULL

While it's usually a bug to call GCD APIs, such as dispatch_after, with NULL as a queue, this often "somehow" works and TSan should maintain binary compatibility with existing code. This patch makes sure we don't try to call Acquire and Release on NULL queues, and add one such testcase for dispatch_after.

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

llvm-svn: 298820

7 years agoFix typo in comment; NFC
Sanjoy Das [Sun, 26 Mar 2017 20:56:25 +0000 (20:56 +0000)]
Fix typo in comment; NFC

llvm-svn: 298819

7 years agoFactor out common code.
Rui Ueyama [Sun, 26 Mar 2017 20:51:14 +0000 (20:51 +0000)]
Factor out common code.

llvm-svn: 298818

7 years agoRemove MIPS-specific code from computeAddend.
Rui Ueyama [Sun, 26 Mar 2017 19:35:24 +0000 (19:35 +0000)]
Remove MIPS-specific code from computeAddend.

Previously, computeAddend had many parameters but most of them were
used only for MIPS. The MIPS ABI is too odd that I don't want to mix
it into the regular code path. Splitting the function into non-MIPS
and MIPS parts makes the regular code path easy to follow.

llvm-svn: 298817

7 years agoRevert 298754 and 298742.
Vassil Vassilev [Sun, 26 Mar 2017 18:32:53 +0000 (18:32 +0000)]
Revert 298754 and 298742.

They broke llvm modules builds and our internal modules infrastructure.

llvm-svn: 298816

7 years agoDo not use assert to report broken input files.
Rui Ueyama [Sun, 26 Mar 2017 18:23:22 +0000 (18:23 +0000)]
Do not use assert to report broken input files.

llvm-svn: 298815

7 years agoUpdate comments.
Rui Ueyama [Sun, 26 Mar 2017 18:23:00 +0000 (18:23 +0000)]
Update comments.

llvm-svn: 298814

7 years agoFix signed/unsigned comparison warnings.
Simon Pilgrim [Sun, 26 Mar 2017 17:39:41 +0000 (17:39 +0000)]
Fix signed/unsigned comparison warnings.

llvm-svn: 298813

7 years ago[llvm-readobj] Prefer ILT to IAT for reading COFF imports
Shoaib Meenai [Sun, 26 Mar 2017 17:10:11 +0000 (17:10 +0000)]
[llvm-readobj] Prefer ILT to IAT for reading COFF imports

We're seeing binutils ld produce binaries where the import address
table's NameRVA entry is actually a VA instead (i.e. it's already base
relocated), which llvm-readobj then chokes on. Both dumpbin and the
Windows loader are able to handle these binaries correctly, however, and
we can make llvm-readobj handle them correctly too by iterating the
import lookup table (which doesn't have a relocated NameRVA) rather than
the import address table.

The import lookup table and the import address table are supposed to be
identical on disk, and prior to r277298 the import lookup table would be
used by `llvm-readobj -coff-imports` anyway, so this shouldn't have any
functional change (except in the case of our malformed binaries). The
import lookup table can apparently be missing when using old Borland
linkers, so fall back to the import address table in that case.

Resolves PR31766.

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

llvm-svn: 298812

7 years ago[LoopUnroll] Remap references in peeled iteration
Serge Pavlov [Sun, 26 Mar 2017 16:46:53 +0000 (16:46 +0000)]
[LoopUnroll] Remap references in peeled iteration

References in cloned blocks must be remapped prior to dominator
calculation.

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

llvm-svn: 298811

7 years ago[LLDB] OpenBSD support
Kamil Rytarowski [Sun, 26 Mar 2017 15:34:57 +0000 (15:34 +0000)]
[LLDB] OpenBSD support

Summary:
Add basic OpenBSD support. This is enough to be able to analyze core dumps for OpenBSD/amd64, OpenBSD/arm, OpenBSD/arm64 and OpenBSD/i386.

Note that part of the changes to source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp fix a bug that probably affects other platforms as well.  The GetProgramHeaderByIndex() interface use 1-based indices, but in some case when looping over the headers the, the loop starts at 0 and misses the last header.  This caused problems on OpenBSD since OpenBSD core dumps have the PT_NOTE segment as the last program header.

Reviewers: joerg, labath, krytarowski

Reviewed By: krytarowski

Subscribers: aemerson, emaste, rengolin, srhines, krytarowski, mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 298810

7 years agotsan: add new mutex annotations
Dmitry Vyukov [Sun, 26 Mar 2017 15:27:04 +0000 (15:27 +0000)]
tsan: add new mutex annotations

There are several problems with the current annotations (AnnotateRWLockCreate and friends):
- they don't fully support deadlock detection (we need a hook _before_ mutex lock)
- they don't support insertion of random artificial delays to perturb execution (again we need a hook _before_ mutex lock)
- they don't support setting extended mutex attributes like read/write reentrancy (only "linker init" was bolted on)
- they don't support setting mutex attributes if a mutex don't have a "constructor" (e.g. static, Java, Go mutexes)
- they don't ignore synchronization inside of lock/unlock operations which leads to slowdown and false negatives
The new annotations solve of the above problems. See tsan_interface.h for the interface specification and comments.

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

llvm-svn: 298809

7 years ago[IR] Switch to more normal template parameter names ending in `T`
Chandler Carruth [Sun, 26 Mar 2017 14:24:06 +0000 (14:24 +0000)]
[IR] Switch to more normal template parameter names ending in `T`
instead of `Ty`.

The `Ty` suffix is much more commonly used for LLVM `Type` variable
names, so this seemed like a particularly confusing collision.

llvm-svn: 298808

7 years agoFix signed/unsigned comparison warnings.
Simon Pilgrim [Sun, 26 Mar 2017 13:59:17 +0000 (13:59 +0000)]
Fix signed/unsigned comparison warnings.

llvm-svn: 298807

7 years ago[X86][SSE] Add computeKnownBitsForTargetNode support for (V)PSLL/(V)PSRL instructions
Simon Pilgrim [Sun, 26 Mar 2017 13:17:55 +0000 (13:17 +0000)]
[X86][SSE] Add computeKnownBitsForTargetNode support for (V)PSLL/(V)PSRL instructions

llvm-svn: 298806

7 years ago[X86][AVX512F] Fix reg class for VMOVSSZrr/VMOVSSZrrk and VMOVSDZrr/VMOVSDZrrk
Simon Pilgrim [Sun, 26 Mar 2017 12:52:28 +0000 (12:52 +0000)]
[X86][AVX512F] Fix reg class for VMOVSSZrr/VMOVSSZrrk and VMOVSDZrr/VMOVSDZrrk

Fixed -verify-machineinstrs errors in fast-isel-select-sse.ll (one of many in PR27481)

The VMOVSSZrr/VMOVSSZrrk and VMOVSDZrr/VMOVSDZrrk instructions were assuming both source registers were V128X when the second is actually supposed to be FR32X/FR64X

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

llvm-svn: 298805

7 years agoFix MSVC signed/unsigned comparison warnings.
Simon Pilgrim [Sun, 26 Mar 2017 11:17:05 +0000 (11:17 +0000)]
Fix MSVC signed/unsigned comparison warnings.

llvm-svn: 298804

7 years agoRegenerate test
Simon Pilgrim [Sun, 26 Mar 2017 10:33:03 +0000 (10:33 +0000)]
Regenerate test

llvm-svn: 298803

7 years agoRegenerate test
Simon Pilgrim [Sun, 26 Mar 2017 10:31:37 +0000 (10:31 +0000)]
Regenerate test

The CHECK-DAG aren't necessary and get in the way of automated checks

llvm-svn: 298802

7 years agoRegenerate tests to remove duplicated checks
Simon Pilgrim [Sun, 26 Mar 2017 10:28:39 +0000 (10:28 +0000)]
Regenerate tests to remove duplicated checks

llvm-svn: 298801

7 years ago [GlobalISel][X86] support G_FRAME_INDEX instruction selection.
Igor Breger [Sun, 26 Mar 2017 08:11:12 +0000 (08:11 +0000)]
 [GlobalISel][X86] support G_FRAME_INDEX instruction selection.

    Summary:
    Support G_FRAME_INDEX instruction selection.

    Reviewers: zvi, rovka, ab, qcolombet

    Reviewed By: ab

    Subscribers: llvm-commits, dberris, kristof.beyls, eladcohen, guyblank

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

llvm-svn: 298800

7 years agoSplit the SimplifyCFG pass into two variants.
Joerg Sonnenberger [Sun, 26 Mar 2017 06:44:08 +0000 (06:44 +0000)]
Split the SimplifyCFG pass into two variants.

The first variant contains all current transformations except
transforming switches into lookup tables. The second variant
contains all current transformations.

The switch-to-lookup-table conversion results in code that is more
difficult to analyze and optimize by other passes. Most importantly,
it can inhibit Dead Code Elimination. As such it is often beneficial to
only apply this transformation very late. A common example is inlining,
which can often result in range restrictions for the switch expression.

Changes in execution time according to LNT:
SingleSource/Benchmarks/Misc/fp-convert +3.03%
MultiSource/Benchmarks/ASC_Sequoia/CrystalMk/CrystalMk -11.20%
MultiSource/Benchmarks/Olden/perimeter/perimeter -10.43%
and a couple of smaller changes. For perimeter it also results 2.6%
a smaller binary.

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

llvm-svn: 298799

7 years agoAdd check for BSD when setting LIB_NAMES for GNU ld
Andrew Wilkins [Sun, 26 Mar 2017 05:58:48 +0000 (05:58 +0000)]
Add check for BSD when setting LIB_NAMES for GNU ld

Patch by Koop Mast and Alex Arslan!

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

llvm-svn: 298798

7 years agoSort. NFC.
Rui Ueyama [Sun, 26 Mar 2017 04:10:43 +0000 (04:10 +0000)]
Sort. NFC.

llvm-svn: 298797

7 years agoRemove a redundant local variable.
Rui Ueyama [Sun, 26 Mar 2017 03:42:00 +0000 (03:42 +0000)]
Remove a redundant local variable.

llvm-svn: 298796

7 years agoAdd a comment.
Rui Ueyama [Sun, 26 Mar 2017 03:41:41 +0000 (03:41 +0000)]
Add a comment.

llvm-svn: 298795

7 years agoInline a function that is used only once.
Rui Ueyama [Sun, 26 Mar 2017 03:21:08 +0000 (03:21 +0000)]
Inline a function that is used only once.

llvm-svn: 298794

7 years agoDe-template a few functions in which ELFT is not needed.
Rui Ueyama [Sun, 26 Mar 2017 03:20:49 +0000 (03:20 +0000)]
De-template a few functions in which ELFT is not needed.

llvm-svn: 298793

7 years agoAdd comments and return early.
Rui Ueyama [Sun, 26 Mar 2017 03:20:30 +0000 (03:20 +0000)]
Add comments and return early.

llvm-svn: 298792

7 years ago[IR] Make SwitchInst::CaseIt almost a normal iterator.
Chandler Carruth [Sun, 26 Mar 2017 02:49:23 +0000 (02:49 +0000)]
[IR] Make SwitchInst::CaseIt almost a normal iterator.

This moves it to the iterator facade utilities giving it full random
access semantics, etc. It can also now be used with standard algorithms
like std::all_of and std::any_of and range adaptors like llvm::reverse.

Also make the semantics of iterating match what every other iterator
uses and forbid decrementing past the begin iterator. This was used as
a hacky way to work around iterator invalidation. However, every
instance trying to do this failed to actually avoid touching invalid
iterators despite the clear documentation that the removed and all
subsequent iterators become invalid including the end iterator. So I've
added a return of the next iterator to removeCase and rewritten the
loops that were doing this to correctly follow the iterator pattern of
either incremneting or removing and assigning fresh values to the
iterator and the end.

In one case we were trying to go backwards to make this cleaner but it
doesn't actually work. I've made that code match the code we use
everywhere else to remove cases as we iterate. This changes the order of
cases in one test output and I moved that test to CHECK-DAG so it
wouldn't care -- the order isn't semantically meaningful anyways.

llvm-svn: 298791

7 years agoRemove unused parameter.
Rui Ueyama [Sun, 26 Mar 2017 02:28:09 +0000 (02:28 +0000)]
Remove unused parameter.

llvm-svn: 298790

7 years agoRemove redundant local variables.
Rui Ueyama [Sun, 26 Mar 2017 02:27:50 +0000 (02:27 +0000)]
Remove redundant local variables.

llvm-svn: 298789

7 years agoRemove a parameter from adjustExpr. NFC.
Rui Ueyama [Sun, 26 Mar 2017 02:27:30 +0000 (02:27 +0000)]
Remove a parameter from adjustExpr. NFC.

llvm-svn: 298788

7 years agoInline a small lambda.
Rui Ueyama [Sun, 26 Mar 2017 02:27:11 +0000 (02:27 +0000)]
Inline a small lambda.

llvm-svn: 298787

7 years agoRename C -> Sec and RI -> Rel.
Rui Ueyama [Sun, 26 Mar 2017 02:26:52 +0000 (02:26 +0000)]
Rename C -> Sec and RI -> Rel.

C is short for Chunk, but we are no longer using that term.
RI is probably short for relocation iterator, but this is not an interator.

llvm-svn: 298786

7 years agoSimplify relocation offset adjustment.
Rui Ueyama [Sun, 26 Mar 2017 02:26:33 +0000 (02:26 +0000)]
Simplify relocation offset adjustment.

Previously, relocation offsets are recalculated for .eh_frame sections
inside the main loop, and that messed up the main loop. This patch
separates that logic into a dedicated class.

llvm-svn: 298785

7 years ago[coroutines] Add codegen for await and yield expressions
Gor Nishanov [Sun, 26 Mar 2017 02:18:05 +0000 (02:18 +0000)]
[coroutines] Add codegen for await and yield expressions

Details:

Emit suspend expression which roughly looks like:

auto && x = CommonExpr();
if (!x.await_ready()) {
   llvm_coro_save();
   x.await_suspend(...);     (*)
   llvm_coro_suspend(); (**)
}
x.await_resume();
where the result of the entire expression is the result of x.await_resume()

(*) If x.await_suspend return type is bool, it allows to veto a suspend:
if (x.await_suspend(...))
   llvm_coro_suspend();
(**) llvm_coro_suspend() encodes three possible continuations as a switch instruction:

%where-to = call i8 @llvm.coro.suspend(...)
switch i8 %where-to, label %coro.ret [ ; jump to epilogue to suspend
  i8 0, label %yield.ready   ; go here when resumed
  i8 1, label %yield.cleanup ; go here when destroyed
]

llvm-svn: 298784

7 years ago[X86] Pull out repeated ScalarValueSizeInBits code. NFCI.
Simon Pilgrim [Sat, 25 Mar 2017 21:22:12 +0000 (21:22 +0000)]
[X86] Pull out repeated ScalarValueSizeInBits code. NFCI.

llvm-svn: 298783

7 years ago[X86][SSE] Combine (VSRLI (VSRAI X, Y), (NumSignBits-1)) -> (VSRLI X, (NumSignBits-1))
Simon Pilgrim [Sat, 25 Mar 2017 20:43:01 +0000 (20:43 +0000)]
[X86][SSE] Combine (VSRLI (VSRAI X, Y), (NumSignBits-1)) -> (VSRLI X, (NumSignBits-1))

Part 3 of 3.

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

llvm-svn: 298782

7 years agoChange the default attributes for llvm.prefetch to inaccessiblemem_or_argmemonly
Eric Christopher [Sat, 25 Mar 2017 20:20:23 +0000 (20:20 +0000)]
Change the default attributes for llvm.prefetch to inaccessiblemem_or_argmemonly
so that we can perform some optimizations across it.

Fixes PR32365

llvm-svn: 298781

7 years ago[X86][SSE] Added ComputeNumSignBitsForTargetNode support for (V)PSRAI
Simon Pilgrim [Sat, 25 Mar 2017 19:58:36 +0000 (19:58 +0000)]
[X86][SSE] Added ComputeNumSignBitsForTargetNode support for (V)PSRAI

Part 2 of 3.

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

llvm-svn: 298780

7 years ago[X86][SSE] Generalised CMP+AND1 combine to ZERO/ALLBITS+MASK
Simon Pilgrim [Sat, 25 Mar 2017 19:50:14 +0000 (19:50 +0000)]
[X86][SSE] Generalised CMP+AND1 combine to ZERO/ALLBITS+MASK

Patch to generalize combinePCMPAnd1 (for handling SETCC + ZEXT cases) to work for any input that has zero/all bits set masked with an 'all low bits' mask.

Replaced the implicit assumption of shift availability with a call to SupportedVectorShiftWithImm.

Part 1 of 3.

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

llvm-svn: 298779

7 years ago_CALL_LINUX is only defined on 64-bit ppc linux platforms, not 32-bit.
Eric Christopher [Sat, 25 Mar 2017 19:26:04 +0000 (19:26 +0000)]
_CALL_LINUX is only defined on 64-bit ppc linux platforms, not 32-bit.
Adjust and add a test for the 32-bit side.

llvm-svn: 298778

7 years agoPluginUnwindAssemblyX86: add missing linkage to MCDisasm
Michal Gorny [Sat, 25 Mar 2017 18:51:37 +0000 (18:51 +0000)]
PluginUnwindAssemblyX86: add missing linkage to MCDisasm

Add missing linkage of the lldbPluginUnwindAssemblyX86 to LLVMMCDisasm
library. This fixes the following build failure when linking against
shared libraries:

    lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function lldb_private::x86AssemblyInspectionEngine::instruction_length(unsigned char*, int&): error: undefined reference to 'LLVMDisasmInstruction'
    lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function lldb_private::x86AssemblyInspectionEngine::~x86AssemblyInspectionEngine(): error: undefined reference to 'LLVMDisasmDispose'
    lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function lldb_private::x86AssemblyInspectionEngine::x86AssemblyInspectionEngine(lldb_private::ArchSpec const&): error: undefined reference to 'LLVMCreateDisasm'

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

llvm-svn: 298777

7 years agoExpression: add missing linkage to RuntimeDyld component
Michal Gorny [Sat, 25 Mar 2017 18:51:29 +0000 (18:51 +0000)]
Expression: add missing linkage to RuntimeDyld component

Add missing linkage from lldbExpression library to LLVMRuntimeDyld.
Otherwise the build against shared LLVM libraries fails with:

    lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):IRExecutionUnit.cpp:function llvm::RTDyldMemoryManager::deregisterEHFrames(unsigned char*, unsigned long, unsigned long): error: undefined reference to 'llvm::RTDyldMemoryManager::deregisterEHFramesInProcess(unsigned char*, unsigned long)'

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

llvm-svn: 298776

7 years ago[x86] use PMOVMSK to replace memcmp libcalls for 16-byte equality
Sanjay Patel [Sat, 25 Mar 2017 16:05:33 +0000 (16:05 +0000)]
[x86] use PMOVMSK to replace memcmp libcalls for 16-byte equality

This is the payoff for D31156 - if a target has efficient comparison instructions for vector-sized equality,
we can replace memcmp calls with inline code that is both smaller and faster.

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

llvm-svn: 298775

7 years ago[X86][SSE] Add extra computeNumSignBits test case for D31311.
Simon Pilgrim [Sat, 25 Mar 2017 15:43:36 +0000 (15:43 +0000)]
[X86][SSE] Add extra computeNumSignBits test case for D31311.

llvm-svn: 298774

7 years ago[AMDGPU] Make AMDGPUTargetInfo::AS private
Yaxun Liu [Sat, 25 Mar 2017 11:34:41 +0000 (11:34 +0000)]
[AMDGPU] Make AMDGPUTargetInfo::AS private

llvm-svn: 298773

7 years ago[InstCombine] Change the interface of SimplifyDemandedBits so that it takes the instr...
Craig Topper [Sat, 25 Mar 2017 06:52:52 +0000 (06:52 +0000)]
[InstCombine] Change the interface of SimplifyDemandedBits so that it takes the instruction and operand instead of the Use.

The first thing it did was get the User for the Use to get the instruction back. This requires looking through the Uses for the User using the waymarking walk. That's pretty fast, but its probably still better to just pass the Instruction we already had.

llvm-svn: 298772

7 years agoUpdate the comment on not yet generated preprocessor defines to remove __LONGDOUBLE128.
Eric Christopher [Sat, 25 Mar 2017 06:38:57 +0000 (06:38 +0000)]
Update the comment on not yet generated preprocessor defines to remove __LONGDOUBLE128.

llvm-svn: 298771

7 years agoAdd the __LONGDOUBLE128 define for ppc targets that have 128 bit long doubles.
Eric Christopher [Sat, 25 Mar 2017 06:37:23 +0000 (06:37 +0000)]
Add the __LONGDOUBLE128 define for ppc targets that have 128 bit long doubles.

llvm-svn: 298770

7 years agoDefine __HAVE_BSWAP__ on ppc to match gcc since we support both builtins as well.
Eric Christopher [Sat, 25 Mar 2017 05:40:13 +0000 (05:40 +0000)]
Define __HAVE_BSWAP__ on ppc to match gcc since we support both builtins as well.

llvm-svn: 298769

7 years ago[AArch64] Refine Falkor Machine Model - Part1
Balaram Makam [Sat, 25 Mar 2017 04:02:39 +0000 (04:02 +0000)]
[AArch64] Refine Falkor Machine Model - Part1

llvm-svn: 298768

7 years ago[AMDGPU] Switch address space mapping by triple environment amdgiz
Yaxun Liu [Sat, 25 Mar 2017 03:46:25 +0000 (03:46 +0000)]
[AMDGPU] Switch address space mapping by triple environment amdgiz

For target environment amdgiz and amdgizcl (giz means Generic Is Zero), AMDGPU will use new address space mapping where generic address space is 0 and private address space is 5. The data layout is also changed correspondingly.

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

llvm-svn: 298767

7 years ago[libc++] Fix some comment typos
Shoaib Meenai [Sat, 25 Mar 2017 03:42:20 +0000 (03:42 +0000)]
[libc++] Fix some comment typos

Remove a stray letter, add a missing letter. No functional change.

llvm-svn: 298766

7 years agoAdd the _CALL_LINUX preprocessor define for ppc linux platforms.
Eric Christopher [Sat, 25 Mar 2017 03:33:59 +0000 (03:33 +0000)]
Add the _CALL_LINUX preprocessor define for ppc linux platforms.

This typically is only for a new enough linker (bfd >= 2.16.2 or gold), but
our ppc suppport post-dates this and it should work on all linux platforms. It
is guaranteed to work on all elfv2 platforms.

llvm-svn: 298765

7 years ago[libc++] Fix word transposition in comment
Shoaib Meenai [Sat, 25 Mar 2017 03:29:51 +0000 (03:29 +0000)]
[libc++] Fix word transposition in comment

"to due" -> "due to". No functional change.

llvm-svn: 298764

7 years ago[libc++] Fix capitalization in comment
Shoaib Meenai [Sat, 25 Mar 2017 03:22:35 +0000 (03:22 +0000)]
[libc++] Fix capitalization in comment

Fix a stray capital letter in the middle of a sentence. No functional
change.

llvm-svn: 298763

7 years ago[libc++] Update package version
Shoaib Meenai [Sat, 25 Mar 2017 03:12:37 +0000 (03:12 +0000)]
[libc++] Update package version

Make it consistent with the rest of LLVM.

llvm-svn: 298762

7 years ago__BIGGEST_ALIGNMENT__ has always been 16 on all power platforms rather
Eric Christopher [Sat, 25 Mar 2017 02:55:21 +0000 (02:55 +0000)]
__BIGGEST_ALIGNMENT__ has always been 16 on all power platforms rather
than the default of 8 in clang, fix and update tests accordingly.

llvm-svn: 298761

7 years ago[NewGVN] Adjust NDEBUG markers.
Davide Italiano [Sat, 25 Mar 2017 02:40:02 +0000 (02:40 +0000)]
[NewGVN] Adjust NDEBUG markers.

This avoids 'used but not defined' warnings in Release builds
with GCC.

llvm-svn: 298760

7 years agoAdd preprocessor defines for a bare powerpc64le triple/cpu.
Eric Christopher [Sat, 25 Mar 2017 02:29:18 +0000 (02:29 +0000)]
Add preprocessor defines for a bare powerpc64le triple/cpu.
The le triple didn't exist until power8, so use that as a default (this
also matches what gcc does).

llvm-svn: 298759

7 years ago[AMDGPU] Switch data layout by triple environment amdgiz
Yaxun Liu [Sat, 25 Mar 2017 02:05:44 +0000 (02:05 +0000)]
[AMDGPU] Switch data layout by triple environment amdgiz

Switch data layout by target triple environment amdgiz and amdgizcl indicating using of an address space mapping in which generic address space is 0.

amdgiz is for non-OpenCL environment where generic address space is 0.

amdgizcl is for OpenCL environment where generic address space is 0.

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

llvm-svn: 298758