platform/upstream/llvm.git
7 years agoAttempt to fix ms-intrinsics.c test
Hans Wennborg [Fri, 7 Apr 2017 17:01:56 +0000 (17:01 +0000)]
Attempt to fix ms-intrinsics.c test

llvm-svn: 299785

7 years ago[builtins] Fix MSVC build
Reid Kleckner [Fri, 7 Apr 2017 16:54:32 +0000 (16:54 +0000)]
[builtins] Fix MSVC build

Avoid __attribute__((constructor)) in cpu_model.c.

Use more C99 _Complex emulation in divtc3.c. Joerg Sonnenberger added
this builtin just after the last round of C99 _Complex emulation landed
in r249514 (Oct 2015).

llvm-svn: 299784

7 years agoCorrect environ parsing on NetBSD
Kamil Rytarowski [Fri, 7 Apr 2017 16:45:36 +0000 (16:45 +0000)]
Correct environ parsing on NetBSD

Summary:
This replaces old code in Host::GetEnvironment for NetBSD
with the version from Linux. This makes parsing environment
variables correctly. It also fixes programs that depend on the
variables like curses(3) applications.

Long term this function should be moved to Process Plugin,
as currently env variables are not available with remote
debugging.

Other BSDs might want to catch up after this change.

Tested with NetBSD top(1).

Sponsored by <The NetBSD Foundation>

Reviewers: emaste, labath, joerg, kettenis

Reviewed By: emaste

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 299783

7 years agoImplement _interlockedbittestandset as a builtin
Hans Wennborg [Fri, 7 Apr 2017 16:41:47 +0000 (16:41 +0000)]
Implement _interlockedbittestandset as a builtin

It's used by MS headers in VS 2017 without including intrin.h, so we
can't implement it in the header anymore.

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

llvm-svn: 299782

7 years agoCorrect environ parsing on FreeBSD
Ed Maste [Fri, 7 Apr 2017 16:40:25 +0000 (16:40 +0000)]
Correct environ parsing on FreeBSD

Sync Host:GetEnvironment with Linux and Kamil Rytarowski's forthcoming
NetBSD change in review D31784.

llvm-svn: 299781

7 years ago[builtins] Get the builtins tests passing on Windows
Reid Kleckner [Fri, 7 Apr 2017 16:35:09 +0000 (16:35 +0000)]
[builtins] Get the builtins tests passing on Windows

Many things were broken:

- We stopped building most builtins on Windows in r261432 for reasons
  that are not at all clear to me. This essentially reverts that patch.

- Fix %librt to expand to clang_rt.builtins-$arch.lib on Windows instead
  of libclang_rt.builtins-$arch.a.

- Fix memory protection tests (trampoline, enable executable, clear
  cache) on Windows. One issue was that the MSVC incremental linker
  generates ILT thunks for functions with external linkage, so memcpying
  the functions into the executable stack buffer wasn't working. You
  can't memcpy an RIP-relative jump without fixing up the offset.

- Disable tests that rely on C99 complex library functions when using
  the MSVC CRT, which isn't compatible with clang's C99 _Complex.

In theory, these could all be separate patches, but it would not green
the tests, so let's try for it all at once. Hopefully this fixes the
clang-x64-ninja-win7 bot.

llvm-svn: 299780

7 years ago[AMDGPU] Unroll more to eliminate phis and conditions
Stanislav Mekhanoshin [Fri, 7 Apr 2017 16:26:28 +0000 (16:26 +0000)]
[AMDGPU] Unroll more to eliminate phis and conditions

Increase threshold to unroll a loop which contains an "if" statement
whose condition defined by a PHI belonging to the loop. This may help
to eliminate if region and potentially even PHI itself, saving on
both divergence and registers used for the PHI.

Add a small bonus for each of such "if" statements.

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

llvm-svn: 299779

7 years agoSimplify this further.
Rafael Espindola [Fri, 7 Apr 2017 16:10:46 +0000 (16:10 +0000)]
Simplify this further.

Thanks to Rui for noticing it.

llvm-svn: 299777

7 years agoUse PMADDWD to expand reduction in a loop
Dehao Chen [Fri, 7 Apr 2017 15:41:52 +0000 (15:41 +0000)]
Use PMADDWD to expand reduction in a loop

Summary:
PMADDWD can help improve 8/16 bit integer mutliply-add operation performance for cases like:

for (int i = 0; i < count; i++)
  a += x[i] * y[i];

Reviewers: wmi, davidxl, hfinkel, RKSimon, zvi, mkuper

Reviewed By: mkuper

Subscribers: llvm-commits

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

llvm-svn: 299776

7 years ago[lit] Try using process pools by default again
Reid Kleckner [Fri, 7 Apr 2017 15:28:32 +0000 (15:28 +0000)]
[lit] Try using process pools by default again

Both pickling errors encountered on clang bots and Darwin compiler-rt
should now be fixed.

This has no impact on testing time on Linux, and on Windows goes from
88s to 63s for 'check'. The tests pass on Mac, but I haven't compared
execution time.

llvm-svn: 299775

7 years agoSema: prevent __declspec(naked) use on x64
Saleem Abdulrasool [Fri, 7 Apr 2017 15:13:47 +0000 (15:13 +0000)]
Sema: prevent __declspec(naked) use on x64

MSDN (https://msdn.microsoft.com/en-us/library/h5w10wxs.aspx) indicates
that `__declspec(naked)` is only permitted on x86 and ARM targets.
Testing with cl does confirm this behaviour.  Provide a warning for use
of `__declspec(naked)` on x64.

llvm-svn: 299774

7 years ago[ELF] Do not pass GOT section as an argument to handleARMTlsRelocation and handleMips...
Simon Atanasyan [Fri, 7 Apr 2017 15:05:44 +0000 (15:05 +0000)]
[ELF] Do not pass GOT section as an argument to handleARMTlsRelocation and handleMipsTlsRelocation functions. NFC

Both functions always use the same GOT sections In<ELFT>::Got and
In<ELFT>::MipsGot respectively, so we do not need to pass them as an
argument.

llvm-svn: 299773

7 years ago[GlobalISel] implement narrowing for G_CONSTANT.
Igor Breger [Fri, 7 Apr 2017 14:41:59 +0000 (14:41 +0000)]
[GlobalISel] implement narrowing for G_CONSTANT.

Summary: [GlobalISel] implement narrowing for G_CONSTANT.

Reviewers: bogner, zvi, t.p.northover

Reviewed By: t.p.northover

Subscribers: llvm-commits, dberris, rovka, kristof.beyls

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

llvm-svn: 299772

7 years ago[coroutines] Insert spills of PHI instructions correctly
Gor Nishanov [Fri, 7 Apr 2017 14:16:49 +0000 (14:16 +0000)]
[coroutines] Insert spills of PHI instructions correctly

Summary:
Fix a bug where we were inserting a spill in between the PHIs in the beginning of the block.
Consider this fragment:

```
begin:
  %phi1 = phi i32 [ 0, %entry ], [ 2, %alt ]
  %phi2 = phi i32 [ 1, %entry ], [ 3, %alt ]
  %sp1 = call i8 @llvm.coro.suspend(token none, i1 false)
  switch i8 %sp1, label %suspend [i8 0, label %resume
                                  i8 1, label %cleanup]
resume:
  call i32 @print(i32 %phi1)
```
Unless we are spilling the argument or result of the invoke, we were always inserting the spill immediately following the instruction.
The fix adds a check that if the spilled instruction is a PHI Node, select an appropriate insert point with `getFirstInsertionPt()` that
skips all the PHI Nodes and EH pads.

Reviewers: majnemer, rnk

Reviewed By: rnk

Subscribers: qcolombet, EricWF, llvm-commits

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

llvm-svn: 299771

7 years agoReapply r298620: [LV] Vectorize GEPs
Matthew Simpson [Fri, 7 Apr 2017 14:15:34 +0000 (14:15 +0000)]
Reapply r298620: [LV] Vectorize GEPs

This patch reapplies r298620. The original patch was reverted because of two
issues. First, the patch exposed a bug in InstCombine that caused the Chromium
builds to fail (PR32414). This issue was fixed in r299017. Second, the patch
introduced a bug in the vectorizer's scalars analysis that caused test suite
builds to fail on SystemZ. The scalars analysis was too aggressive and marked a
memory instruction scalar, even though it was going to be vectorized. This
issue has been fixed in the current patch and several new test cases for the
scalars analysis have been added.

llvm-svn: 299770

7 years ago[mips] Remove usage of debug only variable (NFC)
Simon Dardis [Fri, 7 Apr 2017 13:49:12 +0000 (13:49 +0000)]
[mips] Remove usage of debug only variable (NFC)

Fix the lld-x86_64-darwin13 buildbot by removing the declaration of a
debug only variable and instead moving the value into the debug statement.

llvm-svn: 299769

7 years ago[mips][msa] Fix generation of bm(n)zi and bins[lr]i instructions
Petar Jovanovic [Fri, 7 Apr 2017 13:31:36 +0000 (13:31 +0000)]
[mips][msa] Fix generation of bm(n)zi and bins[lr]i instructions

We have two cases here, the first one being the following instruction
selection from the builtin function:
bm(n)zi builtin -> vselect node -> bins[lr]i machine instruction

In case of bm(n)zi having an immediate which has either its high or low bits
set, a bins[lr] instruction can be selected through the selectVSplatMask[LR]
function. The function counts the number of bits set, and that value is
being passed to the bins[lr]i instruction as its immediate, which in turn
copies immediate modulo the size of the element in bits plus 1 as per specs,
where we get the off-by-one-error.

The other case is:
bins[lr]i -> vselect node -> bsel.v

In this case, a bsel.v instruction gets selected with a mask having one bit
less set than required.

Patch by Stefan Maksimovic.

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

llvm-svn: 299768

7 years ago[AMDGPU][MC] Fix for Bug 28211 + LIT tests
Dmitry Preobrazhensky [Fri, 7 Apr 2017 13:07:13 +0000 (13:07 +0000)]
[AMDGPU][MC] Fix for Bug 28211 + LIT tests

- corrected DS_GWS_* opcodes (see VI_Shader_Programming#16.pdf for detailed description)
  - address operand is not used
  - several opcodes have data operand
  - all opcodes have offset modifier
- DS_AND_SRC2_B32: corrected typo in mnemo
- DS_WRAP_RTN_F32 replaced with DS_WRAP_RTN_B32
- added CI/VI opcodes:
  - DS_CONDXCHG32_RTN_B64
  - DS_GWS_SEMA_RELEASE_ALL
- added VI opcodes:
  - DS_CONSUME
  - DS_APPEND
  - DS_ORDERED_COUNT

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

llvm-svn: 299767

7 years ago[SelectionDAG] Enable target specific vector scalarization of calls and returns
Simon Dardis [Fri, 7 Apr 2017 13:03:52 +0000 (13:03 +0000)]
[SelectionDAG] Enable target specific vector scalarization of calls and returns

By target hookifying getRegisterType, getNumRegisters, getVectorBreakdown,
backends can request that LLVM to scalarize vector types for calls
and returns.

The MIPS vector ABI requires that vector arguments and returns are passed in
integer registers. With SelectionDAG's new hooks, the MIPS backend can now
handle LLVM-IR with vector types in calls and returns. E.g.
'call @foo(<4 x i32> %4)'.

Previously these cases would be scalarized for the MIPS O32/N32/N64 ABI for
calls and returns if vector types were not legal. If vector types were legal,
a single 128bit vector argument would be assigned to a single 32 bit / 64 bit
integer register.

By teaching the MIPS backend to inspect the original types, it can now
implement the MIPS vector ABI which requires a particular method of
scalarizing vectors.

Previously, the MIPS backend relied on clang to scalarize types such as "call
@foo(<4 x float> %a) into "call @foo(i32 inreg %1, i32 inreg %2, i32 inreg %3,
i32 inreg %4)".

This patch enables the MIPS backend to take either form for vector types.

Reviewers: zoran.jovanovic, jaydeep, vkalintiris, slthakur

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

llvm-svn: 299766

7 years agoFix missing .git/indexloadPolly in ensure-correct-tile-sizes testcase
Philip Pfaffe [Fri, 7 Apr 2017 12:55:26 +0000 (12:55 +0000)]
Fix missing .git/indexloadPolly in ensure-correct-tile-sizes testcase

llvm-svn: 299765

7 years agoFix compiler warnings: "ISO c99 requires rest arguments to be used" on
Haojian Wu [Fri, 7 Apr 2017 12:37:32 +0000 (12:37 +0000)]
Fix compiler warnings: "ISO c99 requires rest arguments to be used" on
the test file.

llvm-svn: 299764

7 years ago[SystemZ] Check for presence of vector support in SystemZISelLowering
Jonas Paulsson [Fri, 7 Apr 2017 12:35:11 +0000 (12:35 +0000)]
[SystemZ]  Check for presence of vector support in SystemZISelLowering

A test case was found with llvm-stress that caused DAGCombiner to crash
when compiling for an older subtarget without vector support.

SystemZTargetLowering::combineTruncateExtract() should do nothing for older
subtargets.

This check was placed in canTreatAsByteVector(), which also helps in a few
other places.

Review: Ulrich Weigand
llvm-svn: 299763

7 years ago[SystemZ] Remove confusing comment in combineEXTRACT_VECTOR_ELT()
Jonas Paulsson [Fri, 7 Apr 2017 12:11:41 +0000 (12:11 +0000)]
[SystemZ]  Remove confusing comment in combineEXTRACT_VECTOR_ELT()

It isn't just one-element vectors that can appear here.

llvm-svn: 299762

7 years ago[ARM] GlobalISel: Test hard float properly
Diana Picus [Fri, 7 Apr 2017 12:04:24 +0000 (12:04 +0000)]
[ARM] GlobalISel: Test hard float properly

It turns out -float-abi=hard doesn't set the hard float calling
convention for libcalls. We need to use a hard float triple instead
(e.g. gnueabihf).

llvm-svn: 299761

7 years agoCloneDetection.h: Fix warnings. [-Wdocumentation]
NAKAMURA Takumi [Fri, 7 Apr 2017 11:06:31 +0000 (11:06 +0000)]
CloneDetection.h: Fix warnings. [-Wdocumentation]

llvm-svn: 299760

7 years ago[scan-build-py] merge runner module to analyzer
Laszlo Nagy [Fri, 7 Apr 2017 11:04:49 +0000 (11:04 +0000)]
[scan-build-py] merge runner module to analyzer

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

llvm-svn: 299759

7 years ago[clangd] Extract FsPath from file:// uri
Krasimir Georgiev [Fri, 7 Apr 2017 11:03:26 +0000 (11:03 +0000)]
[clangd] Extract FsPath from file:// uri

Patch contributed by stanionascu!

rfc8089#appendix-E.2 specifies that paths can begin with a drive letter e.g. as file:///c:/.
In this case just consuming front file:// is not enough and the 3rd slash must be consumed to produce a valid path on windows.

The patch introduce a generic way of converting an uri to a filesystem path and back.

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

llvm-svn: 299758

7 years ago[AMDGPU] Move SiShrinkInstruction and SDWAPeephole to SSAOptimization passes
Sam Kolton [Fri, 7 Apr 2017 10:53:12 +0000 (10:53 +0000)]
[AMDGPU] Move SiShrinkInstruction and SDWAPeephole to SSAOptimization passes

Summary:
Difference beetween PreRegAlloc() and MachineSSAOptimization() are that the former is run despite of -O0 optimization level. In my undestanding SiShrinkInstructions and SDWAPeephole shouldn't run when optimizations are disabled.
With this change order of passes will not change.

Reviewers: arsenm, vpykhtin, rampitec

Subscribers: qcolombet, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

llvm-svn: 299757

7 years ago[ARM] GlobalISel: Support frem for 64-bit values
Diana Picus [Fri, 7 Apr 2017 10:50:02 +0000 (10:50 +0000)]
[ARM] GlobalISel: Support frem for 64-bit values

Legalize to a libcall.

llvm-svn: 299756

7 years ago[ELF] Recommit r299635 to pad x86 executable sections with 0xcc
James Henderson [Fri, 7 Apr 2017 10:36:42 +0000 (10:36 +0000)]
[ELF] Recommit r299635 to pad x86 executable sections with 0xcc

This follows r299748 which fixed a latent bug the original commit exposed.

llvm-svn: 299755

7 years agoSkip Unicode character expansion in assembly files
Sanne Wouda [Fri, 7 Apr 2017 10:13:00 +0000 (10:13 +0000)]
Skip Unicode character expansion in assembly files

Summary: When using the C preprocessor with assembly files, either with a
capital `S` file extension, or with `-xassembler-with-cpp`, the Unicode escape
sequence `\u` is ignored. The `\u` pattern can be used for expanding a macro
argument that starts with `u`.

Author: Salman Arif <salman.arif@arm.com>

Reviewers: rengolin, olista01

Reviewed By: olista01

Subscribers: cfe-commits

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

llvm-svn: 299754

7 years ago[ARM] GlobalISel: Support frem for 32-bit values
Diana Picus [Fri, 7 Apr 2017 09:41:39 +0000 (09:41 +0000)]
[ARM] GlobalISel: Support frem for 32-bit values

Legalize to a libcall.
On this occasion, also start allowing soft float subtargets. For the
moment G_FREM is the only legal floating point operation for them.

llvm-svn: 299753

7 years ago[clang-tidy] A couple of minor fixes in modernize-use-using tests
Alexander Kornienko [Fri, 7 Apr 2017 09:41:27 +0000 (09:41 +0000)]
[clang-tidy] A couple of minor fixes in modernize-use-using tests

llvm-svn: 299752

7 years ago[ELF] Fix ARM TLS global dynamic TlsOffsetRel for non-preemtible symbols
Peter Smith [Fri, 7 Apr 2017 09:37:30 +0000 (09:37 +0000)]
[ELF] Fix ARM TLS global dynamic TlsOffsetRel for non-preemtible symbols

When the target of the TlsOffsetRel is non-preemptible we can write the
offset directly into the GOT without needing a dynamic relocation. This
is optional for dynamically linked executables but is required for static
linking.

This change adds the relocation to the GOT entry and a test case for
non-0 offsets so that if we miss out the offset the test won't spuriously
pass by virtue of the default value being 0.

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

llvm-svn: 299751

7 years ago[ELF] Split handleNoRelaxTlsRelocation into ARM and Mips specific impls
Peter Smith [Fri, 7 Apr 2017 09:09:48 +0000 (09:09 +0000)]
[ELF] Split handleNoRelaxTlsRelocation into ARM and Mips specific impls

The handleNoRelaxTlsRelocation handled both ARM and Mips as at a
high-level the actions of what to do when encountering a local dynamic or
global dynamic TLS relocation are the same. However due to Mips using a
custom GOT the differences of the implementation are enough that the
function became difficult to understand.

This change replaces handleNotRelaxTlsRelocation into
handleARMTlsRelocation() and handleMipsTlsRelocation() so that the ARM and
Mips specific code is isolated.

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

llvm-svn: 299750

7 years agoFix signed/unsigned comparison warning in a unit test. This was appearing on
James Henderson [Fri, 7 Apr 2017 08:48:17 +0000 (08:48 +0000)]
Fix signed/unsigned comparison warning in a unit test. This was appearing on
lld-x86_64-darwin13.

llvm-svn: 299749

7 years ago[Core] Fix parallel_for for Linux
James Henderson [Fri, 7 Apr 2017 08:11:28 +0000 (08:11 +0000)]
[Core] Fix parallel_for for Linux

r299635 exposed a latent bug in the Linux implementation of parallel_for, which
resulted in it calling the function outside of the range requested, resulting
later in a segmentation fault. This change fixes this issue and adds a unit test.

llvm-svn: 299748

7 years ago[InstCombine] Handle more commuted cases of ((A & B) | ~A) -> (~A | B)
Craig Topper [Fri, 7 Apr 2017 07:32:00 +0000 (07:32 +0000)]
[InstCombine] Handle more commuted cases of ((A & B) | ~A) -> (~A | B)

llvm-svn: 299747

7 years ago[InstCombine] Add additional tests with varied commuting to show missing combines...
Craig Topper [Fri, 7 Apr 2017 07:31:55 +0000 (07:31 +0000)]
[InstCombine] Add additional tests with varied commuting to show missing combines. NFC

llvm-svn: 299746

7 years ago[InstSimplify] Use Instruction::BinaryOps instead of unsigned for a few function...
Craig Topper [Fri, 7 Apr 2017 05:57:51 +0000 (05:57 +0000)]
[InstSimplify] Use Instruction::BinaryOps instead of unsigned for a few function operands to remove some casts. NFC

llvm-svn: 299745

7 years agoRevert "Allow a standard library to implement conditional noexcept for optional and...
Akira Hatanaka [Fri, 7 Apr 2017 05:55:28 +0000 (05:55 +0000)]
Revert "Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions."

This reverts commit r299734.

llvm-svn: 299744

7 years ago[libc++] Drop support for CRTs older than VS 2015
Shoaib Meenai [Fri, 7 Apr 2017 02:20:52 +0000 (02:20 +0000)]
[libc++] Drop support for CRTs older than VS 2015

LLVM dropped support for Visual Studio versions older than 2015 quite
some time ago, so I consider it safe to drop libc++'s support for older
CRTs. The CRT in Visual Studio 2015 provides a lot of previously missing
functions, so targeting it requires less special casing.

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

llvm-svn: 299743

7 years agoMove a cast out of a function. NFC.
Rafael Espindola [Fri, 7 Apr 2017 01:40:21 +0000 (01:40 +0000)]
Move a cast out of a function. NFC.

The argument was always casted, so cast it in the caller.

llvm-svn: 299742

7 years agoAliasAnalysis: Be less conservative about volatile than atomic.
Daniel Berlin [Fri, 7 Apr 2017 01:28:36 +0000 (01:28 +0000)]
AliasAnalysis: Be less conservative about volatile than atomic.

Summary:
getModRefInfo is meant to answer the question "what impact does this
instruction have on a given memory location" (not even another
instruction).

Long debate on this on IRC comes to the conclusion the answer should be "nothing special".

That is, a noalias volatile store does not affect a memory location
just by being volatile.  Note: DSE and GVN and memdep currently
believe this, because memdep just goes behind AA's back after it says
"modref" right now.

see line 635 of memdep. Prior to this patch we would get modref there, then check aliasing,
and if it said noalias, we would continue.

getModRefInfo *already* has this same AA check, it just wasn't being used because volatile was
lumped in with ordering.

(I am separately testing whether this code in memdep is now dead except for the invariant load case)

Reviewers: jyknight, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 299741

7 years agoRemove unnecessary cast.
Rafael Espindola [Fri, 7 Apr 2017 01:25:01 +0000 (01:25 +0000)]
Remove unnecessary cast.

llvm-svn: 299740

7 years agoAdd missing import
Reid Kleckner [Fri, 7 Apr 2017 01:24:48 +0000 (01:24 +0000)]
Add missing import

llvm-svn: 299739

7 years ago[lit] Fix Darwin pickling errors with process pools
Reid Kleckner [Fri, 7 Apr 2017 01:23:15 +0000 (01:23 +0000)]
[lit] Fix Darwin pickling errors with process pools

For a function to be pickle-able, it has to be in the top-level of a
real Python module. So, I made one for this code snippet.

llvm-svn: 299738

7 years ago[InstCombine] Add more commuted patterns to support folding ((~A & B) | A) -> (A...
Craig Topper [Fri, 7 Apr 2017 00:29:47 +0000 (00:29 +0000)]
[InstCombine] Add more commuted patterns to support folding ((~A & B) | A) -> (A | B).

llvm-svn: 299737

7 years ago[WebAssembly] Fix -Wcovered-switch-default warning
Derek Schuff [Thu, 6 Apr 2017 23:52:01 +0000 (23:52 +0000)]
[WebAssembly] Fix -Wcovered-switch-default warning

llvm-svn: 299736

7 years agoAdd noexcept(false) to more strongly indicate that not being noexcept is important...
Billy Robert O'Neal III [Thu, 6 Apr 2017 23:50:33 +0000 (23:50 +0000)]
Add noexcept(false) to more strongly indicate that not being noexcept is important for hash tests.

llvm-svn: 299735

7 years agoAllow a standard library to implement conditional noexcept for optional and unique_pt...
Billy Robert O'Neal III [Thu, 6 Apr 2017 23:50:21 +0000 (23:50 +0000)]
Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions.

These tests were unconditionally asserting that optional and unique_ptr declare throwing hashes, but MSVC++ implements conditional noexcept forwarding that of the underlying hash function. As a result we were failing these tests but there's nothing forbidding strengthening noexcept in that way.

Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have non-noexcept hash functions.

llvm-svn: 299734

7 years agoAllow specification of what kinds of class members to dump.
Zachary Turner [Thu, 6 Apr 2017 23:43:39 +0000 (23:43 +0000)]
Allow specification of what kinds of class members to dump.

Previously when dumping class definitions, there were only
two modes - on or off.  But it's useful to sometimes get a
little more fine-grained.  For example, you might only want
to see the record layout (for example to look for extraneous
padding).  This patch adds a third mode, layout mode, which
does exactly that.  Only this-relative data members are
displayed in this mode.

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

llvm-svn: 299733

7 years ago[llvm-pdbdump] Allow pretty to only dump specific types of types.
Zachary Turner [Thu, 6 Apr 2017 23:43:12 +0000 (23:43 +0000)]
[llvm-pdbdump] Allow pretty to only dump specific types of types.

Previously we just had the -types option, which would dump all
classes, typedefs, and enums.  But this produces a lot of output
if you only want to view classes, for example.  This patch breaks
this down into 3 additional options, -classes, -enums, and
-typedefs, and keeps the -types option around which implies all
3 more specific options.

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

llvm-svn: 299732

7 years agoAdd an end-to-end testcase for address sanitizer.
Adrian Prantl [Thu, 6 Apr 2017 23:36:44 +0000 (23:36 +0000)]
Add an end-to-end testcase for address sanitizer.

llvm-svn: 299731

7 years agoAdd a test for debug info with the safestack sanitizer enabled.
Adrian Prantl [Thu, 6 Apr 2017 23:30:51 +0000 (23:30 +0000)]
Add a test for debug info with the safestack sanitizer enabled.

llvm-svn: 299730

7 years agoAdd more tests for ExtractContextAndIdentifier
Eugene Zemtsov [Thu, 6 Apr 2017 23:12:43 +0000 (23:12 +0000)]
Add more tests for ExtractContextAndIdentifier

llvm-svn: 299729

7 years agoCOFF: support the /appcontainer flag
Saleem Abdulrasool [Thu, 6 Apr 2017 23:07:53 +0000 (23:07 +0000)]
COFF: support the /appcontainer flag

The /appcontainer flag indicates that the module may only be used inside
an application container (for isolation).  This has been supported by
link.exe since Windows 8.0.  It sets an additional bit in the PE DLL
Characteristics flag to indicate the behavioural change.

llvm-svn: 299728

7 years agoAMDGPU/GFX9: Fix shared and private aperture queries
Konstantin Zhuravlyov [Thu, 6 Apr 2017 23:02:33 +0000 (23:02 +0000)]
AMDGPU/GFX9: Fix shared and private aperture queries

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

llvm-svn: 299727

7 years agoRemove the default subtarget from the Power port. It's unnecessary and harmful if...
Eric Christopher [Thu, 6 Apr 2017 23:01:30 +0000 (23:01 +0000)]
Remove the default subtarget from the Power port. It's unnecessary and harmful if used.

llvm-svn: 299726

7 years ago[InstCombine] Add a few cases for OR we fail to optimize due to missing commuted...
Craig Topper [Thu, 6 Apr 2017 23:00:22 +0000 (23:00 +0000)]
[InstCombine] Add a few cases for OR we fail to optimize due to missing commuted patterns checks.

llvm-svn: 299725

7 years agoRevert "Revert "[ARM] Add Kryo to available targets""
Yi Kong [Thu, 6 Apr 2017 22:47:47 +0000 (22:47 +0000)]
Revert "Revert "[ARM] Add Kryo to available targets""

This reverts commit dc9458d5a747a02a9a8f198b84c2b92a6939a8dd.

Added missing case for PreISelOperandLatencyAdjustment.

llvm-svn: 299724

7 years agoTurn on -addr-sink-using-gep by default.
Eli Friedman [Thu, 6 Apr 2017 22:42:18 +0000 (22:42 +0000)]
Turn on -addr-sink-using-gep by default.

The new codepath has been in the tree for years, and there isn't any
reason to use two codepaths here.

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

llvm-svn: 299723

7 years agoRename refersToGotEntry needsGot and add comments.
Rui Ueyama [Thu, 6 Apr 2017 22:39:11 +0000 (22:39 +0000)]
Rename refersToGotEntry needsGot and add comments.

This patch addresses a post-commit review comment for r299615.

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

llvm-svn: 299722

7 years agoNew C++ function name parsing logic (Resubmit)
Eugene Zemtsov [Thu, 6 Apr 2017 22:36:02 +0000 (22:36 +0000)]
New C++ function name parsing logic (Resubmit)

Current implementation of CPlusPlusLanguage::MethodName::Parse() doesn't
get anywhere close to covering full extent of possible function declarations.
It causes incorrect behavior in avoid-stepping and sometimes messes
printing of thread backtrace.

This change implements more methodical parsing logic based on clang
lexer and simple recursive parser.

Examples:
void std::vector<Class, std::allocator<Class>>::_M_emplace_back_aux<Class const&>(Class const&)
void (*&std::_Any_data::_M_access<void (*)()>())()

Previous version of this change (D31451) was rolled back due to an issue
with Objective-C selectors being incorrectly recognized as a C++ identifier.

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

llvm-svn: 299721

7 years ago[X86] Revert r299387 due to AVX legalization infinite loop.
Michael Kuperstein [Thu, 6 Apr 2017 22:33:25 +0000 (22:33 +0000)]
[X86] Revert r299387 due to AVX legalization infinite loop.

llvm-svn: 299720

7 years agoTry to fix FreeBSD build after IWYU changes.
Zachary Turner [Thu, 6 Apr 2017 22:18:59 +0000 (22:18 +0000)]
Try to fix FreeBSD build after IWYU changes.

llvm-svn: 299719

7 years agoFix build failure in unit test.
Zachary Turner [Thu, 6 Apr 2017 21:57:39 +0000 (21:57 +0000)]
Fix build failure in unit test.

llvm-svn: 299718

7 years agoCall updateAlignment before assignAddresses.
Rafael Espindola [Thu, 6 Apr 2017 21:40:22 +0000 (21:40 +0000)]
Call updateAlignment before assignAddresses.

The alignment expression cannot depend on '.', so we can compute it
early.

llvm-svn: 299717

7 years agoMove call to findMemoryRegion before assignAddresses.
Rafael Espindola [Thu, 6 Apr 2017 21:31:24 +0000 (21:31 +0000)]
Move call to findMemoryRegion before assignAddresses.

This removes a bit more work from assignAddresses.

llvm-svn: 299716

7 years ago[InstCombine] Remove testing assert I accidentally left in r299710.
Craig Topper [Thu, 6 Apr 2017 21:29:43 +0000 (21:29 +0000)]
[InstCombine] Remove testing assert I accidentally left in r299710.

llvm-svn: 299715

7 years agoiwyu fixes for lldbCore.
Zachary Turner [Thu, 6 Apr 2017 21:28:29 +0000 (21:28 +0000)]
iwyu fixes for lldbCore.

This adjusts header file includes for headers and source files
in Core.  In doing so, one dependency cycle is eliminated
because all the includes from Core to that project were dead
includes anyway.  In places where some files in other projects
were only compiling due to a transitive include from another
header, fixups have been made so that those files also include
the header they need.  Tested on Windows and Linux, and plan
to address failures on OSX and FreeBSD after watching the
bots.

llvm-svn: 299714

7 years agoRemove redundant argument. NFC.
Rafael Espindola [Thu, 6 Apr 2017 21:26:03 +0000 (21:26 +0000)]
Remove redundant argument. NFC.

llvm-svn: 299713

7 years agoAMDGPU: Diagnose illegal SGPR to VGPR copies
Matt Arsenault [Thu, 6 Apr 2017 21:09:53 +0000 (21:09 +0000)]
AMDGPU: Diagnose illegal SGPR to VGPR copies

This is possible in ways that are not compiler bugs,
so stop asserting on them.

This emits an extra error when emitting objects when it
can't encode the new pseudo, but I'm not sure that matters.

llvm-svn: 299712

7 years ago[CMake][libcxx] Use check_c_compiler_flag to check for nodefaultlibs
Petr Hosek [Thu, 6 Apr 2017 21:06:33 +0000 (21:06 +0000)]
[CMake][libcxx] Use check_c_compiler_flag to check for nodefaultlibs

We're using -nodefaultlibs to avoid the dependency on C++ library
when using check_cxx_compiler_flag, and as such we cannot use
check_cxx_compiler_flag to check the availability of -nodefaultlibs
itself.

llvm-svn: 299711

7 years ago[InstCombine] When checking to see if we can turn subtracts of 2^n - 1 into xor,...
Craig Topper [Thu, 6 Apr 2017 21:06:03 +0000 (21:06 +0000)]
[InstCombine] When checking to see if we can turn subtracts of 2^n - 1 into xor, we only need to call computeKnownBits on the RHS not the whole subtract. While there use isMask instead of isPowerOf2(C+1)

Calling computeKnownBits on the RHS should allows us to recurse one step further. isMask is equivalent to the isPowerOf2(C+1) except in the case where C is all ones. But that was already handled earlier by creating a not which is an Xor with all ones. So this should be fine.

llvm-svn: 299710

7 years agoCache the result of findSection.
Rafael Espindola [Thu, 6 Apr 2017 21:05:39 +0000 (21:05 +0000)]
Cache the result of findSection.

This avoids calling it multiple times. In particular, we don't have to
call in in assignAddresses any more.

llvm-svn: 299709

7 years agoAMDGPU: Replace fp16SrcZerosHighBits with a whitelist
Matt Arsenault [Thu, 6 Apr 2017 20:58:30 +0000 (20:58 +0000)]
AMDGPU: Replace fp16SrcZerosHighBits with a whitelist

FCOPYSIGN is lowered to bit operations which don't clear the high
bits.

llvm-svn: 299708

7 years ago[PGO] Preserve GlobalsAA in pgo-memop-opt pass.
Rong Xu [Thu, 6 Apr 2017 20:56:00 +0000 (20:56 +0000)]
[PGO] Preserve GlobalsAA in pgo-memop-opt pass.

Preserve GlobalsAA analysis in memory intrinsic calls optimization based on
profiled size.

llvm-svn: 299707

7 years ago[llvm-extract] Add option for recursive extraction
Keno Fischer [Thu, 6 Apr 2017 20:51:40 +0000 (20:51 +0000)]
[llvm-extract] Add option for recursive extraction

Summary:
Particularly, with --delete, this can be very useful for testing
new optimizations on some hotspots, without having to run it on the whole
application. E.g. as such:
```
llvm-extract app.bc --recursive --rfunc .*hotspot.* > hotspot.bc
llvm-extract app.bc --recursive --delete --rfunc .*hotspot.* > residual.bc
llc -filetype=obj residual.bc > residual.o
llc -filetype=obj hotspot.bc > hotspot.o
cc -o app residual.o hotspot.o
```

Reviewed By: davide
Differential Revision: https://reviews.llvm.org/D31722

llvm-svn: 299706

7 years agoTry to fix FreeBSD build after iwyu changes.
Zachary Turner [Thu, 6 Apr 2017 20:51:22 +0000 (20:51 +0000)]
Try to fix FreeBSD build after iwyu changes.

llvm-svn: 299705

7 years ago[InstCombine] Remove redundant combine from visitAnd
Craig Topper [Thu, 6 Apr 2017 20:41:48 +0000 (20:41 +0000)]
[InstCombine] Remove redundant combine from visitAnd

This combine is fully handled by SimplifyDemandedInstructionBits as of r299658 where I fixed this code to ensure the Add/Sub had only a single user. Otherwise it would fire and create additional instructions. That fix resulted in an improvement to code generated for tsan which is why I committed it before deleting.

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

llvm-svn: 299704

7 years ago[BFIterator] Remove an assertion that doesn't hold. NFCI.
Davide Italiano [Thu, 6 Apr 2017 20:32:10 +0000 (20:32 +0000)]
[BFIterator] Remove an assertion that doesn't hold. NFCI.

llvm-svn: 299703

7 years agoRevert "Turn some C-style vararg into variadic templates"
Mehdi Amini [Thu, 6 Apr 2017 20:23:57 +0000 (20:23 +0000)]
Revert "Turn some C-style vararg into variadic templates"

This reverts commit r299699, the examples needs to be updated.

llvm-svn: 299702

7 years ago[SelectionDAG] [ARM CodeGen] Fix chain information of LowerMUL
Huihui Zhang [Thu, 6 Apr 2017 20:22:51 +0000 (20:22 +0000)]
[SelectionDAG] [ARM CodeGen] Fix chain information of LowerMUL

In LowerMUL, the chain information is not preserved for the new
created Load SDNode.

For example, if a Store alias with one of the operand of Mul.
The Load for that operand need to be scheduled before the Store.
The dependence is recorded in the chain of Store, in TokenFactor.
However, when lowering MUL, the SDNodes for the new Loads for
VMULL are not updated in the TokenFactor for the Store. Thus the
chain is not preserved for the lowered VMULL.

llvm-svn: 299701

7 years ago[clang-tidy] Reuse FileID in getLocation
Chih-Hung Hsieh [Thu, 6 Apr 2017 20:19:26 +0000 (20:19 +0000)]
[clang-tidy] Reuse FileID in getLocation

One FileID per warning will increase and overflow NextLocalOffset
when input file is large with many warnings.
Reusing FileID avoids this problem.

This requires changes in getColumnNumber, D31406, rL299681.

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

llvm-svn: 299700

7 years agoTurn some C-style vararg into variadic templates
Mehdi Amini [Thu, 6 Apr 2017 20:09:31 +0000 (20:09 +0000)]
Turn some C-style vararg into variadic templates

Module::getOrInsertFunction is using C-style vararg instead of
variadic templates.

From a user prospective, it forces the use of an annoying nullptr
to mark the end of the vararg, and there's not type checking on the
arguments. The variadic template is an obvious solution to both
issues.

Patch by: Serge Guelton <serge.guelton@telecom-bretagne.eu>

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

llvm-svn: 299699

7 years ago[asan] Fix dead stripping of globals on Linux (compiler-rt).
Evgeniy Stepanov [Thu, 6 Apr 2017 19:55:52 +0000 (19:55 +0000)]
[asan] Fix dead stripping of globals on Linux (compiler-rt).

This is a re-land of r298173, r298169, r298159.

llvm-svn: 299698

7 years ago[asan] Fix dead stripping of globals on Linux.
Evgeniy Stepanov [Thu, 6 Apr 2017 19:55:17 +0000 (19:55 +0000)]
[asan] Fix dead stripping of globals on Linux.

Use a combination of !associated, comdat, @llvm.compiler.used and
custom sections to allow dead stripping of globals and their asan
metadata. Sometimes.

Currently this works on LLD, which supports SHF_LINK_ORDER with
sh_link pointing to the associated section.

This also works on BFD, which seems to treat comdats as
all-or-nothing with respect to linker GC. There is a weird quirk
where the "first" global in each link is never GC-ed because of the
section symbols.

At this moment it does not work on Gold (as in the globals are never
stripped).

This is a re-land of r298158 rebased on D31358. This time,
asan.module_ctor is put in a comdat as well to avoid quadratic
behavior in Gold.

llvm-svn: 299697

7 years ago[asan] Put ctor/dtor in comdat.
Evgeniy Stepanov [Thu, 6 Apr 2017 19:55:13 +0000 (19:55 +0000)]
[asan] Put ctor/dtor in comdat.

When possible, put ASan ctor/dtor in comdat.

The only reason not to is global registration, which can be
TU-specific. This is not the case when there are no instrumented
globals. This is also limited to ELF targets, because MachO does
not have comdat, and COFF linkers may GC comdat constructors.

The benefit of this is a lot less __asan_init() calls: one per DSO
instead of one per TU. It's also necessary for the upcoming
gc-sections-for-globals change on Linux, where multiple references to
section start symbols trigger quadratic behaviour in gold linker.

This is a rebase of r298756.

llvm-svn: 299696

7 years ago[asan] Delay creation of asan ctor.
Evgeniy Stepanov [Thu, 6 Apr 2017 19:55:09 +0000 (19:55 +0000)]
[asan] Delay creation of asan ctor.

Create the constructor in the module pass.
This in needed for the GC-friendly globals change, where the constructor can be
put in a comdat  in some cases, but we don't know about that in the function
pass.

This is a rebase of r298731 which was reverted due to a false alarm.

llvm-svn: 299695

7 years agoBitcode: Do not create FNENTRYs for aliases of functions.
Peter Collingbourne [Thu, 6 Apr 2017 19:39:24 +0000 (19:39 +0000)]
Bitcode: Do not create FNENTRYs for aliases of functions.

There doesn't seem to be any point in doing this.

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

llvm-svn: 299694

7 years agoReplace a few uses of basename.
Rafael Espindola [Thu, 6 Apr 2017 19:38:24 +0000 (19:38 +0000)]
Replace a few uses of basename.

This replaces a few uses of basename with the recently introduced lit
replacements.

llvm-svn: 299693

7 years ago[StripDeadDebugInfo] Drop dead CUs entirely
Keno Fischer [Thu, 6 Apr 2017 19:26:22 +0000 (19:26 +0000)]
[StripDeadDebugInfo] Drop dead CUs entirely

Summary:
Prior to this while it would delete the dead DIGlobalVariables, it would
leave dead DICompileUnits and everything referenced therefrom. For a bit
bitcode file with thousands of compile units those dead nodes easily
outnumbered the real ones. Clean that up.

Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D31720

llvm-svn: 299692

7 years ago[AMDGPU] Temporarily change constant address space from 4 to 2 for the new address...
Yaxun Liu [Thu, 6 Apr 2017 19:18:36 +0000 (19:18 +0000)]
[AMDGPU] Temporarily change constant address space from 4 to 2 for the new address space mapping

Change constant address space from 4 to 2 for the new address space mapping in Clang.

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

llvm-svn: 299691

7 years ago[AMDGPU] Temporarily change constant address space from 4 to 2
Yaxun Liu [Thu, 6 Apr 2017 19:17:32 +0000 (19:17 +0000)]
[AMDGPU] Temporarily change constant address space from 4 to 2

Our final address space mapping is to let constant address space to be 4 to match nvptx.
However for now we will make it 2 to avoid unnecessary work in FE/BE/devlib
about intrinsics returning constant pointers.

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

llvm-svn: 299690

7 years agoRevert "[ARM] Add Kryo to available targets"
Yi Kong [Thu, 6 Apr 2017 19:16:14 +0000 (19:16 +0000)]
Revert "[ARM] Add Kryo to available targets"

This reverts commit 942d6e6f58bf7e63810dd7cbcbce1fdfa5ebc6d4.

Build breakage.

llvm-svn: 299689

7 years ago[SDAG] Fix visitAND optimization to deal with vector extract case again.
Nirav Dave [Thu, 6 Apr 2017 19:05:41 +0000 (19:05 +0000)]
[SDAG] Fix visitAND optimization to deal with vector extract case again.

Summary:
Fix case elided by rL298920.

Fixes PR32545.

Reviewers: eli.friedman, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 299688

7 years ago[InstSimplify] Remove unreachable default from SimplifyBinOp.
Craig Topper [Thu, 6 Apr 2017 18:59:08 +0000 (18:59 +0000)]
[InstSimplify] Remove unreachable default from SimplifyBinOp.

We have dedicated handlers for every opcode so nothing can get here anymore. The switch doesn't get detected as fully covered because Opcode is an unsigned. Casting to Instruction::BinaryOps still doesn't detect it because BinaryOpsEnd is in the enum and 1 past the last opcode.

llvm-svn: 299687

7 years agoSome of Eric's buildbots don't like this test. Disable it while I figure out why.
Marshall Clow [Thu, 6 Apr 2017 18:54:37 +0000 (18:54 +0000)]
Some of Eric's buildbots don't like this test. Disable it while I figure out why.

llvm-svn: 299686

7 years agoNewGVN: Rename some functions for consistency
Daniel Berlin [Thu, 6 Apr 2017 18:52:58 +0000 (18:52 +0000)]
NewGVN: Rename some functions for consistency

llvm-svn: 299685