platform/upstream/llvm.git
7 years ago[InstCombine] remove duplicate test; NFC
Sanjay Patel [Sun, 9 Apr 2017 21:45:52 +0000 (21:45 +0000)]
[InstCombine] remove duplicate test; NFC

I moved this test to 'not.ll' in r299824 but accidentally added a copy here.

llvm-svn: 299828

7 years ago[Mem2Reg] Remove AliasSetTracker updating logic from the pass.
Davide Italiano [Sun, 9 Apr 2017 20:47:14 +0000 (20:47 +0000)]
[Mem2Reg] Remove AliasSetTracker updating logic from the pass.

No caller has been passing it for a long time.

llvm-svn: 299827

7 years ago[SimplifyCFG] auto-generate better checks; NFC
Sanjay Patel [Sun, 9 Apr 2017 16:16:32 +0000 (16:16 +0000)]
[SimplifyCFG] auto-generate better checks; NFC

llvm-svn: 299825

7 years ago[InstCombine] auto-generate better checks; NFC
Sanjay Patel [Sun, 9 Apr 2017 15:44:59 +0000 (15:44 +0000)]
[InstCombine] auto-generate better checks; NFC

Also, move a test next to its sibling to eliminate a file with just one test.

llvm-svn: 299824

7 years ago[MemorySSA] Fix use of pointsToConstantMemory in isUseTriviallyOptimizableToLiveOnEntry
Hal Finkel [Sun, 9 Apr 2017 12:57:50 +0000 (12:57 +0000)]
[MemorySSA] Fix use of pointsToConstantMemory in isUseTriviallyOptimizableToLiveOnEntry

In isUseTriviallyOptimizableToLiveOnEntry, pointsToConstantMemory needs to be
called on the load's pointer operand, not on the result of the load (which
might not even be a pointer).

llvm-svn: 299823

7 years ago[InstCombine] Extend some OR combines to support vectors.
Craig Topper [Sun, 9 Apr 2017 06:12:41 +0000 (06:12 +0000)]
[InstCombine] Extend some OR combines to support vectors.

This adds support for these combines for vectors
(X^C)|Y -> (X|Y)^C iff Y&C == 0
Y|(X^C) -> (X|Y)^C iff Y&C == 0

llvm-svn: 299822

7 years ago[InstCombine] Extend a canonicalization check to apply to vector constants too.
Craig Topper [Sun, 9 Apr 2017 06:12:39 +0000 (06:12 +0000)]
[InstCombine] Extend a canonicalization check to apply to vector constants too.

llvm-svn: 299821

7 years ago[InstCombine] Add test cases to show missing support for vectors in an OR combine...
Craig Topper [Sun, 9 Apr 2017 06:12:36 +0000 (06:12 +0000)]
[InstCombine] Add test cases to show missing support for vectors in an OR combine. Also add the commuted versions. NFC

llvm-svn: 299820

7 years ago[InstCombine] Use the SubOne helper function to shorten some code. NFC
Craig Topper [Sun, 9 Apr 2017 06:12:34 +0000 (06:12 +0000)]
[InstCombine] Use the SubOne helper function to shorten some code. NFC

llvm-svn: 299819

7 years ago[InstCombine] rename variable for easier reading; NFC
Craig Topper [Sun, 9 Apr 2017 06:12:31 +0000 (06:12 +0000)]
[InstCombine] rename variable for easier reading; NFC

We usually give constants a 'C' somewhere in the name...

llvm-svn: 299818

7 years agoMC: Remove unused virtual function MCObjectWriter::isWeak. NFC.
Peter Collingbourne [Sat, 8 Apr 2017 23:35:49 +0000 (23:35 +0000)]
MC: Remove unused virtual function MCObjectWriter::isWeak. NFC.

llvm-svn: 299817

7 years agoAMDGPU: Actually write nops for writeNopData
Matt Arsenault [Sat, 8 Apr 2017 21:28:38 +0000 (21:28 +0000)]
AMDGPU: Actually write nops for writeNopData

Before this was just writing 0s, which ends up looking like a
v_cndmask_b32 v0, s0, v0, vcc. Write out an encoded s_nop instead.

llvm-svn: 299816

7 years ago[AsmParser]Emit an error if a macro has two (or more) parameters sharing the same...
Coby Tayree [Sat, 8 Apr 2017 20:29:03 +0000 (20:29 +0000)]
[AsmParser]Emit an error if a macro has two (or more) parameters sharing the same name

Introducing a new error to macro parameters' parsing:
currently, llvm-mc won't complain if a macro have two (or more) named params with the same name.
this behavior is false, as there's no merit in having some params sharing a name.
now, instead of tolerate such a phenomena - emit an appropriate error.

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

llvm-svn: 299815

7 years agoReorganize libLTO C API header lto.h (NFC)
Mehdi Amini [Sat, 8 Apr 2017 19:20:30 +0000 (19:20 +0000)]
Reorganize libLTO C API header lto.h (NFC)

This just makes it easier to follow the Doxygen blocks

llvm-svn: 299814

7 years ago[cmake] Support Gentoo install for z3
Michal Gorny [Sat, 8 Apr 2017 14:38:06 +0000 (14:38 +0000)]
[cmake] Support Gentoo install for z3

Add the 'z3' subdirectory to the list of possible path suffixes for
libz3 header search. The z3 headers are installed in /usr/include/z3
on Gentoo.

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

llvm-svn: 299813

7 years ago[ELF] - Stop producing broken output for R_386_GOT32[X] relocations.
George Rimar [Sat, 8 Apr 2017 06:14:14 +0000 (06:14 +0000)]
[ELF] - Stop producing broken output for R_386_GOT32[X] relocations.

Previously we silently produced broken output for R_386_GOT32X/R_386_GOT32
relocations if they were used to compute the address of the symbol’s global
offset table entry without base register when position-independent code is disabled.

Situation happened because of recent ABI changes. Released ABI mentions that
R_386_GOT32X can be calculated in a two different ways (so we did not follow ABI here
before this patch), but draft ABI also mentions R_386_GOT32 relocation here.
We should use the same calculations for both relocations.

Problem is that we always calculated them as G + A - GOT (offset from end of GOT),
but for case when PIC is disabled, according to i386 ABI calculation should be G + A,
what should produce just an address in GOT finally.

ABI: https://github.com/hjl-tools/x86-psABI/wiki/intel386-psABI-draft.pdf (p36, p60).
llvm-svn: 299812

7 years ago[IR] Inline Type::getScalarType() by using isVectorTy() and getVectorElementType...
Craig Topper [Sat, 8 Apr 2017 05:47:09 +0000 (05:47 +0000)]
[IR] Inline Type::getScalarType() by using isVectorTy() and getVectorElementType() that were already available inline.

Seems to have very little compiled code size impact. But might give a tiny performance boost.

llvm-svn: 299811

7 years ago[AArch64] Refine Falkor Machine Model - Part 3
Balaram Makam [Sat, 8 Apr 2017 03:30:15 +0000 (03:30 +0000)]
[AArch64] Refine Falkor Machine Model - Part 3

  This concludes the refinements to Falkor Machine Model.
  It includes SchedPredicates for immediate zero and LSL Fast.
  Forwarding logic is also modeled for vector multiply and
  accumulate only.

llvm-svn: 299810

7 years ago[coroutines] Make CoroSplit pass deterministic
Gor Nishanov [Sat, 8 Apr 2017 00:49:46 +0000 (00:49 +0000)]
[coroutines] Make CoroSplit pass deterministic

coro-split-after-phi.ll test was flaky due to non-determinism in
the coroutine frame construction that was sorting the spill
vector using a pointer to a def as a part of the key.

The sorting was intended to make sure that spills for the same def
are kept together, however, we populate the vector by processing
defs in order, so the spill entires will end up together anyways.

This change removes spill sorting and restores the determinism
in the test.

llvm-svn: 299809

7 years agogitignore: Ignore .vs folder (VS2017 config files)
Gor Nishanov [Sat, 8 Apr 2017 00:16:58 +0000 (00:16 +0000)]
gitignore: Ignore .vs folder (VS2017 config files)

llvm-svn: 299808

7 years agoMark this test as XFAIL on all platforms, it's happening everywhere.
Jason Molenda [Fri, 7 Apr 2017 23:20:22 +0000 (23:20 +0000)]
Mark this test as XFAIL on all platforms, it's happening everywhere.
llvm.org/pr32553 and <rdar://problem/30646077> are tracking this.

llvm-svn: 299807

7 years ago[cfi] Emit __cfi_check stub in the frontend.
Evgeniy Stepanov [Fri, 7 Apr 2017 23:00:38 +0000 (23:00 +0000)]
[cfi] Emit __cfi_check stub in the frontend.

Previously __cfi_check was created in LTO optimization pipeline, which
means LLD has no way of knowing about the existence of this symbol
without rescanning the LTO output object. As a result, LLD fails to
export __cfi_check, even when given --export-dynamic-symbol flag.

llvm-svn: 299806

7 years ago[cfi] Take over existing __cfi_check in CrossDSOCFI.
Evgeniy Stepanov [Fri, 7 Apr 2017 23:00:20 +0000 (23:00 +0000)]
[cfi] Take over existing __cfi_check in CrossDSOCFI.

https://reviews.llvm.org/D31796 will emit a dummy __cfi_check in the
frontend.

llvm-svn: 299805

7 years ago[cfi] Accept weak definition of __cfi_check.
Evgeniy Stepanov [Fri, 7 Apr 2017 22:52:08 +0000 (22:52 +0000)]
[cfi] Accept weak definition of __cfi_check.

https://reviews.llvm.org/D31796 results in LLD emitting __cfi_check
as a weak symbol, while Gold keeps it strong. Accept both.

llvm-svn: 299804

7 years ago[ARM] Prefer BIC over BFC in ARM mode.
Eli Friedman [Fri, 7 Apr 2017 22:01:23 +0000 (22:01 +0000)]
[ARM] Prefer BIC over BFC in ARM mode.

BIC is generally faster, and it can put the output in a different
register from the input.

We already do this in Thumb2 mode; not sure why the equivalent fix
never got applied to ARM mode.

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

llvm-svn: 299803

7 years ago[GlobalISel]: Fix bug where we can report GISelFailure on erased instructions
Aditya Nandakumar [Fri, 7 Apr 2017 21:49:30 +0000 (21:49 +0000)]
[GlobalISel]: Fix bug where we can report GISelFailure on erased instructions

The original instruction might get legalized and erased and expanded
into intermediate instructions and the intermediate instructions might
fail legalization. This end up in reporting GISelFailure on the erased
instruction.
Instead report GISelFailure on the intermediate instruction which failed
legalization.

Reviewed by: ab

llvm-svn: 299802

7 years ago[ConstantFolding] Use Intrinsic::not_intrinsic instead of 0 for readability. NFCI
Craig Topper [Fri, 7 Apr 2017 21:36:32 +0000 (21:36 +0000)]
[ConstantFolding] Use Intrinsic::not_intrinsic instead of 0 for readability. NFCI

llvm-svn: 299801

7 years agoToolchains: remove crtbegin on xwindows
Saleem Abdulrasool [Fri, 7 Apr 2017 20:47:06 +0000 (20:47 +0000)]
Toolchains: remove crtbegin on xwindows

crtbegin is not really a proper windows support thing.  This was
duplicated when the toolchain was initially built.  If the injection of
crtbegin is needed, it can be done via the `/include` directive.
Furthermore, since `-fPIC` doesnt make sense on PE/COFF, crtbegin and
crtbeginS dont really need to be different.

llvm-svn: 299800

7 years ago[AArch64] Allow global register asm("x18") or asm("w18") under -ffixed-x18
Petr Hosek [Fri, 7 Apr 2017 20:41:58 +0000 (20:41 +0000)]
[AArch64] Allow global register asm("x18") or asm("w18") under -ffixed-x18

When using -ffixed-x18, the x18 (or w18) register can safely be used
with the "global register variable" GCC extension, but the backend
fails to recognize it.

Patch by Roland McGrath.

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

llvm-svn: 299799

7 years agoRevert "[CMake][libunwind] Use -nodefaultlibs for CMake checks"
Petr Hosek [Fri, 7 Apr 2017 20:24:22 +0000 (20:24 +0000)]
Revert "[CMake][libunwind] Use -nodefaultlibs for CMake checks"

This reverts commit r299796.

llvm-svn: 299798

7 years ago[CMake][libcxxabi] Use -nodefaultlibs for CMake checks
Petr Hosek [Fri, 7 Apr 2017 20:10:41 +0000 (20:10 +0000)]
[CMake][libcxxabi] Use -nodefaultlibs for CMake checks

Since libc++abi is built with -nodefaultlibs, we should be using this
option even for CMake checks to avoid any inconsistency and also to
avoid dependency on a working C++ standard library just for the setting
up the build itself. The implementation is largely similar to the one
used by libc++.

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

llvm-svn: 299797

7 years ago[CMake][libunwind] Use -nodefaultlibs for CMake checks
Petr Hosek [Fri, 7 Apr 2017 20:10:29 +0000 (20:10 +0000)]
[CMake][libunwind] Use -nodefaultlibs for CMake checks

Since libunwind is built with -nodefaultlibs, we should be using this
option even for CMake checks to avoid any inconsistency and also to
avoid dependency on a working C++ standard library just for the setting
up the build itself. The implementation is largely similar to the one
used by libc++.

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

llvm-svn: 299796

7 years agoRemove .rdata section size checks from pdb.test, they are not the same on Windows...
Reid Kleckner [Fri, 7 Apr 2017 19:58:33 +0000 (19:58 +0000)]
Remove .rdata section size checks from pdb.test, they are not the same on Windows and Unix

llvm-svn: 299795

7 years agoUse a temp file to avoid Process Substitution.
Rafael Espindola [Fri, 7 Apr 2017 18:55:03 +0000 (18:55 +0000)]
Use a temp file to avoid Process Substitution.

Thanks to Reid Kleckner for the suggestion.

llvm-svn: 299794

7 years ago[PDB] Re-add RAW FileCheck testing to pdb.test
Reid Kleckner [Fri, 7 Apr 2017 18:38:38 +0000 (18:38 +0000)]
[PDB] Re-add RAW FileCheck testing to pdb.test

Update the expected output to match the current llvm-pdbdump raw output.

llvm-svn: 299793

7 years agoNewGVN: Make CongruenceClass a real class in preparation for splitting
Daniel Berlin [Fri, 7 Apr 2017 18:38:09 +0000 (18:38 +0000)]
NewGVN: Make CongruenceClass a real class in preparation for splitting
NewGVN into analysis and eliminator.

llvm-svn: 299792

7 years agoDe-flake a test that is failing due to coroutine spill insertion non-determinism
Reid Kleckner [Fri, 7 Apr 2017 18:02:53 +0000 (18:02 +0000)]
De-flake a test that is failing due to coroutine spill insertion non-determinism

llvm-svn: 299791

7 years ago[builtins] Remove stray quotes to fix check-builtins on non-Windows :(
Reid Kleckner [Fri, 7 Apr 2017 17:40:25 +0000 (17:40 +0000)]
[builtins] Remove stray quotes to fix check-builtins on non-Windows :(

llvm-svn: 299790

7 years ago[Dominators] Simplify a member function. NFCI.
Davide Italiano [Fri, 7 Apr 2017 17:34:37 +0000 (17:34 +0000)]
[Dominators] Simplify a member function. NFCI.

llvm-svn: 299789

7 years agoRevert "[SelectionDAG] Enable target specific vector scalarization of calls and returns"
Simon Dardis [Fri, 7 Apr 2017 17:25:05 +0000 (17:25 +0000)]
Revert "[SelectionDAG] Enable target specific vector scalarization of calls and returns"

This reverts commit r299766. This change appears to have broken the MIPS
buildbots. Reverting while I investigate.

Revert "[mips] Remove usage of debug only variable (NFC)"

This reverts commit r299769. Follow up commit.

llvm-svn: 299788

7 years ago[builtins] Make some ISA macro checks work with MSVC
Reid Kleckner [Fri, 7 Apr 2017 17:18:43 +0000 (17:18 +0000)]
[builtins] Make some ISA macro checks work with MSVC

llvm-svn: 299786

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