platform/upstream/llvm.git
8 years agoAdd missing 'REQUIRES' line
Tobias Grosser [Fri, 5 Aug 2016 07:08:45 +0000 (07:08 +0000)]
Add missing 'REQUIRES' line

llvm-svn: 277800

8 years agoGPGPU: Add cuda annotations to specify maximal number of threads per block
Tobias Grosser [Fri, 5 Aug 2016 06:47:43 +0000 (06:47 +0000)]
GPGPU: Add cuda annotations to specify maximal number of threads per block

These annotations ensure that the NVIDIA PTX assembler limits the number of
registers used such that we can be certain the resulting kernel can be executed
for the number of threads in a thread block that we are planning to use.

llvm-svn: 277799

8 years agoReverting r277632 as it breaks the build on MacOS.
Ivan Krasin [Fri, 5 Aug 2016 03:18:27 +0000 (03:18 +0000)]
Reverting r277632 as it breaks the build on MacOS.

Reviewers: kcc

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

llvm-svn: 277798

8 years agoFix crash in template type diffing.
Richard Trieu [Fri, 5 Aug 2016 03:16:36 +0000 (03:16 +0000)]
Fix crash in template type diffing.

When the type being diffed is a type alias, and the orginal type is not a
templated type, then there will be no unsugared TemplateSpecializationType.
When this happens, exit early from the constructor.  Also add assertions to
the other iterator accessor to prevent the iterator from being used.

llvm-svn: 277797

8 years agoAllow -1 to assign max value to unsigned bitfields.
Richard Trieu [Fri, 5 Aug 2016 02:39:30 +0000 (02:39 +0000)]
Allow -1 to assign max value to unsigned bitfields.

Silence the -Wbitfield-constant-conversion warning for when -1 or other
negative values are assigned to unsigned bitfields, provided that the bitfield
is wider than the minimum number of bits needed to encode the negative value.

llvm-svn: 277796

8 years agoCFI: add XFAIL test for a future optimization of two vcalls.
Ivan Krasin [Fri, 5 Aug 2016 01:45:54 +0000 (01:45 +0000)]
CFI: add XFAIL test for a future optimization of two vcalls.

Summary:
Often, a code will call multiple virtual methods of a given object.
If they go in a linear block, it should be possible to check vtable
before the first call, then store vtable pointer and reuse it for
the second vcall without any additional checks.

This is expected to have a positive performance impact on a hot
path in Blink, see https://crbug.com/634139.

Reviewers: kcc

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

llvm-svn: 277795

8 years agoSimplify. NFC.
Rui Ueyama [Fri, 5 Aug 2016 01:25:45 +0000 (01:25 +0000)]
Simplify. NFC.

llvm-svn: 277794

8 years agoInstCombine: Clean up some trailing whitespace. NFC
Justin Bogner [Fri, 5 Aug 2016 01:09:48 +0000 (01:09 +0000)]
InstCombine: Clean up some trailing whitespace. NFC

llvm-svn: 277793

8 years agoInstCombine: Replace some never-null pointers with references. NFC
Justin Bogner [Fri, 5 Aug 2016 01:06:44 +0000 (01:06 +0000)]
InstCombine: Replace some never-null pointers with references. NFC

llvm-svn: 277792

8 years agoMove invariants outside of a lambda. NFC.
Rui Ueyama [Fri, 5 Aug 2016 01:05:01 +0000 (01:05 +0000)]
Move invariants outside of a lambda. NFC.

llvm-svn: 277791

8 years agoMake combine() non-member function.
Rui Ueyama [Fri, 5 Aug 2016 01:04:59 +0000 (01:04 +0000)]
Make combine() non-member function.

Because this function depends only on its arguments.

llvm-svn: 277790

8 years agoChange the indexing done for kernel/kext directories to be recursive.
Jason Molenda [Fri, 5 Aug 2016 00:44:34 +0000 (00:44 +0000)]
Change the indexing done for kernel/kext directories to be recursive.
Also re-write how most of the directory indexing is done - as it has
grown over the years, it has become a bit of a mess and was overdue
for a cleanup.

Most importantly, this allows you to specify a directory with the
platform.plugin.darwin-kernel.kext-directories setting and now lldb
will search for kexts and kernels in those directories recursively.

<rdar://problem/20754467>

llvm-svn: 277789

8 years ago[LIT][Darwin] Change %ld64 to be prefixed with DYLD_INSERT_LIBRARIES
Bruno Cardoso Lopes [Thu, 4 Aug 2016 23:58:30 +0000 (23:58 +0000)]
[LIT][Darwin] Change %ld64 to be prefixed with DYLD_INSERT_LIBRARIES

Followup from r277778, after Mehdi's comments.

Expand %ld64 to perform the necessary preload instead, that way new
tests do not need to worry about setting up DYLD_INSERT_LIBRARIES
themselves.

rdar://problem/24300926

llvm-svn: 277788

8 years ago[Sema] Add sizeof diagnostics for bzero
Bruno Cardoso Lopes [Thu, 4 Aug 2016 23:55:22 +0000 (23:55 +0000)]
[Sema] Add sizeof diagnostics for bzero

For memset (and others) we can get diagnostics like:

  struct stat { int x; };
  void foo(struct stat *stamps) {
    bzero(stamps, sizeof(stamps));
    memset(stamps, 0, sizeof(stamps));
  }

  t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess]
    memset(stamps, 0, sizeof(stamps));
           ~~~~~~            ^~~~~~
  t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
    memset(stamps, 0, sizeof(stamps));
                             ^~~~~~

This patch implements the same class of warnings for bzero.

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

rdar://problem/18963514

llvm-svn: 277787

8 years agoGVN-hoist: enable by default
Sebastian Pop [Thu, 4 Aug 2016 23:49:07 +0000 (23:49 +0000)]
GVN-hoist: enable by default

llvm-svn: 277786

8 years agoGVN-hoist: fix early exit logic
Sebastian Pop [Thu, 4 Aug 2016 23:49:05 +0000 (23:49 +0000)]
GVN-hoist: fix early exit logic

The patch splits a complex && if condition into easier to read and understand
logic.  That wrong early exit condition was letting some instructions with not
all operands available pass through when HoistingGeps was true.

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

llvm-svn: 277785

8 years agoIR: Provide an IRBuilder Inserter that calls a callback after insertion
Justin Bogner [Thu, 4 Aug 2016 23:41:01 +0000 (23:41 +0000)]
IR: Provide an IRBuilder Inserter that calls a callback after insertion

Add a generalized IRBuilderCallbackInserter, which is just given a
callback to execute after insertion. This can be used to get rid of
the custom inserter in InstCombine, which will in turn allow me to add
target specific InstCombineCalls API for intrinsics without horrible
layering violations.

llvm-svn: 277784

8 years ago[ADT] Migrate DepthFirstIterator to use NodeRef
Tim Shen [Thu, 4 Aug 2016 23:03:44 +0000 (23:03 +0000)]
[ADT] Migrate DepthFirstIterator to use NodeRef

Summary: The corresponding LLVM change is D23146.

Reviewers: dblaikie, chandlerc

Subscribers: cfe-commits

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

llvm-svn: 277783

8 years ago[LV, X86] Be more optimistic about vectorizing shifts.
Michael Kuperstein [Thu, 4 Aug 2016 22:48:03 +0000 (22:48 +0000)]
[LV, X86] Be more optimistic about vectorizing shifts.

Shifts with a uniform but non-constant count were considered very expensive to
vectorize, because the splat of the uniform count and the shift would tend to
appear in different blocks. That made the splat invisible to ISel, and we'd
scalarize the shift at codegen time.

Since r201655, CodeGenPrepare sinks those splats to be next to their use, and we
are able to select the appropriate vector shifts. This updates the cost model to
to take this into account by making shifts by a uniform cheap again.

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

llvm-svn: 277782

8 years agoSplit InputSectionDescription::Sort into SortInner and SortOuter.
Rui Ueyama [Thu, 4 Aug 2016 22:27:00 +0000 (22:27 +0000)]
Split InputSectionDescription::Sort into SortInner and SortOuter.

Summary:
The comparator function to compare input sections as instructed by
SORT command was a bit too complicated because it needed to handle
four different cases. This patch split it into two function calls.

This patch also simplifies the parser.

Reviewers: grimar

Subscribers: llvm-commits

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

llvm-svn: 277780

8 years ago[InstCombine] use m_APInt to allow icmp eq (mul X, C1), C2 folds for splat constant...
Sanjay Patel [Thu, 4 Aug 2016 22:19:27 +0000 (22:19 +0000)]
[InstCombine] use m_APInt to allow icmp eq (mul X, C1), C2 folds for splat constant vectors

This concludes the splat vector enhancements for foldICmpEqualityWithConstant().
Other commits in this series:
https://reviews.llvm.org/rL277762
https://reviews.llvm.org/rL277752
https://reviews.llvm.org/rL277738
https://reviews.llvm.org/rL277731
https://reviews.llvm.org/rL277659
https://reviews.llvm.org/rL277638
https://reviews.llvm.org/rL277629

llvm-svn: 277779

8 years ago[LIT][Darwin] Preload libclang_rt.asan_osx_dynamic.dylib when necessary
Bruno Cardoso Lopes [Thu, 4 Aug 2016 22:01:38 +0000 (22:01 +0000)]
[LIT][Darwin] Preload libclang_rt.asan_osx_dynamic.dylib when necessary

Green Dragon's darwin stage2 asan bot fails on some checks:
http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check

  test/tools/lto/hide-linkonce-odr.ll
  test/tools/lto/opt-level.ll

ERROR: Interceptors are not working. This may be because
AddressSanitizer is loaded too late (e.g. via dlopen)

To fix this, %ld64 needs to load 'libclang_rt.asan_osx_dynamic.dylib'
before libLTO.dylib, via DYLD_INSERT_LIBRARIES. This won't work by
updating config.environment, since some shim binary in the way scrubs
the env vars. Instead, provide the path to this lib through %asanrtlib,
which can then be used by tests directly with DYLD_INSERT_LIBRARIES.

rdar://problem/24300926

llvm-svn: 277778

8 years agobuiltins: split out the EABI and VFP ARM sources
Saleem Abdulrasool [Thu, 4 Aug 2016 21:58:39 +0000 (21:58 +0000)]
builtins: split out the EABI and VFP ARM sources

These are meant to only be included on certain targets.  This only disables it
for Windows ARM for now.  Ideally these would be conditionally included as
appropriate.

llvm-svn: 277777

8 years agoClean up the logic of the Archive::Child::Child() with an assert to know Err is not...
Kevin Enderby [Thu, 4 Aug 2016 21:54:19 +0000 (21:54 +0000)]
Clean up the logic of the Archive::Child::Child() with an assert to know Err is not a nullptr
when we are pointed at real data.

David Blaikie pointed out some odd logic in the case the Err value was a nullptr and
Lang Hames suggested it could be cleaned it up with an assert to know that Err is
not a nullptr when we are pointed at real data.  As only in the case of constructing
the sentinel value by pointing it at null data is Err is permitted to be a nullptr,
since no error could occur in that case.

With this change the testing for “if (Err)” is removed from the constructor’s logic
and *Err is used directly without any check after the assert().

llvm-svn: 277776

8 years agoGlobalISel: extend add widening to SUB, MUL, OR, AND and XOR.
Tim Northover [Thu, 4 Aug 2016 21:39:49 +0000 (21:39 +0000)]
GlobalISel: extend add widening to SUB, MUL, OR, AND and XOR.

These are the operations that are trivially identical. Division is omitted for
now because you need to use the correct sign/zero extension.

llvm-svn: 277775

8 years agoGlobalISel: add support for G_MUL
Tim Northover [Thu, 4 Aug 2016 21:39:44 +0000 (21:39 +0000)]
GlobalISel: add support for G_MUL

llvm-svn: 277774

8 years ago[CloneFunction] Add a testcase for r277691/r277693
David Majnemer [Thu, 4 Aug 2016 21:28:59 +0000 (21:28 +0000)]
[CloneFunction] Add a testcase for r277691/r277693

PR28848 had a very nice reduction of the underlying cause of the bug.
Our ValueMap had, in an entry for an Instruction, a ConstantInt.

This is not at all unexpected but should be handled properly.

llvm-svn: 277773

8 years agoUse "llvm-objdump -s" instead of hexdump command.
Rui Ueyama [Thu, 4 Aug 2016 21:23:30 +0000 (21:23 +0000)]
Use "llvm-objdump -s" instead of hexdump command.

llvm-svn: 277771

8 years ago[Mach0YAML] Change n_type from uint8_t to llvm::yaml::Hex8
Chris Bieneman [Thu, 4 Aug 2016 21:07:39 +0000 (21:07 +0000)]
[Mach0YAML] Change n_type from uint8_t to llvm::yaml::Hex8

Since this field is generally masked, it is way easier to understand it as a Hex value than decimal.

llvm-svn: 277770

8 years agoGlobalISel: implement narrowing for G_ADD.
Tim Northover [Thu, 4 Aug 2016 20:54:13 +0000 (20:54 +0000)]
GlobalISel: implement narrowing for G_ADD.

llvm-svn: 277769

8 years agoGlobalISel: refuse to halve size of 1-byte & odd-sized LLTs.
Tim Northover [Thu, 4 Aug 2016 20:54:05 +0000 (20:54 +0000)]
GlobalISel: refuse to halve size  of 1-byte & odd-sized LLTs.

llvm-svn: 277768

8 years agoGVNHoist: Don't hoist convergent calls
Matt Arsenault [Thu, 4 Aug 2016 20:52:57 +0000 (20:52 +0000)]
GVNHoist: Don't hoist convergent calls

llvm-svn: 277767

8 years ago[ExecutionEngine] Refactor - Roll JITSymbolFlags functionality into JITSymbol.h
Lang Hames [Thu, 4 Aug 2016 20:32:37 +0000 (20:32 +0000)]
[ExecutionEngine] Refactor - Roll JITSymbolFlags functionality into JITSymbol.h
and remove the JITSymbolFlags header.

llvm-svn: 277766

8 years ago[coroutines] Part 4[ab]: Coroutine Devirtualization: Lower coro.resume and coro.destroy.
David Majnemer [Thu, 4 Aug 2016 20:30:07 +0000 (20:30 +0000)]
[coroutines] Part 4[ab]: Coroutine Devirtualization: Lower coro.resume and coro.destroy.

This is the forth patch in the coroutine series. CoroEaly pass now lowers coro.resume
and coro.destroy intrinsics by replacing them with an indirect call to an address
returned by coro.subfn.addr intrinsic. This is done so that CGPassManager recognizes
devirtualization when CoroElide replaces a call to coro.subfn.addr with an appropriate
function address.

Patch by Gor Nishanov!

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

llvm-svn: 277765

8 years agoAvoid re-entrancy between __sanitizer::Report, OutputDebugString, and RtlRaiseException
Reid Kleckner [Thu, 4 Aug 2016 20:05:13 +0000 (20:05 +0000)]
Avoid re-entrancy between __sanitizer::Report, OutputDebugString, and RtlRaiseException

Our Report implementation calls OutputDebugString, which calls
RtlRaiseException, which can re-enter back into the ASan runtime and
cause a hang.

Don't treat this special debugger-only exception code as a noreturn
event, since the stack won't really unwind all the way.

llvm-svn: 277763

8 years ago[InstCombine] use m_APInt to allow icmp eq (and X, C1), C2 folds for splat constant...
Sanjay Patel [Thu, 4 Aug 2016 20:05:02 +0000 (20:05 +0000)]
[InstCombine] use m_APInt to allow icmp eq (and X, C1), C2 folds for splat constant vectors

llvm-svn: 277762

8 years ago[MachO] Factor out some common code in the Driver.
Davide Italiano [Thu, 4 Aug 2016 19:56:26 +0000 (19:56 +0000)]
[MachO] Factor out some common code in the Driver.

llvm-svn: 277761

8 years ago[MachO/Core] Remove (now) unused static member function. NFCI.
Davide Italiano [Thu, 4 Aug 2016 19:49:11 +0000 (19:49 +0000)]
[MachO/Core] Remove (now) unused static member function. NFCI.

llvm-svn: 277760

8 years ago[OpenCL] Add missing tests for getOCLTypeName
Yaxun Liu [Thu, 4 Aug 2016 19:45:00 +0000 (19:45 +0000)]
[OpenCL] Add missing tests for getOCLTypeName

Adding missing tests for OCL type names for half, float, double, char, short, long, and unknown.

Patch by Aaron En Ye Shi.

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

llvm-svn: 277759

8 years ago[CodeView] Use llvm::Error instead of std::error_code.
Zachary Turner [Thu, 4 Aug 2016 19:39:55 +0000 (19:39 +0000)]
[CodeView] Use llvm::Error instead of std::error_code.

This eliminates the remnants of std::error_code from the
DebugInfo libraries.

llvm-svn: 277758

8 years ago[analyzer] Make CloneDetector recognize different variable patterns.
Artem Dergachev [Thu, 4 Aug 2016 19:37:00 +0000 (19:37 +0000)]
[analyzer] Make CloneDetector recognize different variable patterns.

CloneDetector should be able to detect clones with renamed variables.
However, if variables are referenced multiple times around the code sample,
the usage patterns need to be recognized.

For example, (x < y ? y : x) and (y < x ? y : x) are no longer clones,
however (a < b ? b : a) is still a clone of the former.

Variable patterns are computed and compared during a separate filtering pass.

Patch by Raphael Isemann!

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

llvm-svn: 277757

8 years ago[OpenCL] Add the lit test for image size which was omitted by r277647.
Yaxun Liu [Thu, 4 Aug 2016 19:35:17 +0000 (19:35 +0000)]
[OpenCL] Add the lit test for image size which was omitted by r277647.

llvm-svn: 277756

8 years agoAArch64: don't assume all i128s are BUILD_PAIRs
Tim Northover [Thu, 4 Aug 2016 19:32:28 +0000 (19:32 +0000)]
AArch64: don't assume all i128s are BUILD_PAIRs

It leads to a crash when they're not. I'm *sure* I've made this mistake before,
at least once.

llvm-svn: 277755

8 years ago[OpenCL] Remove extra native_ functions from opencl-c.h
Yaxun Liu [Thu, 4 Aug 2016 19:30:54 +0000 (19:30 +0000)]
[OpenCL] Remove extra native_ functions from opencl-c.h

There should be no native_ builtin functions with double type arguments.

Patch by Aaron En Ye Shi.

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

llvm-svn: 277754

8 years ago[macho2yaml] String table can contain null strings
Chris Bieneman [Thu, 4 Aug 2016 19:19:25 +0000 (19:19 +0000)]
[macho2yaml] String table can contain null strings

Since the string table being read from the MachO is a properly bounded StringRef including null strings is safe and reasonable.

This occurs frequently with stripped binaries where the string table has been modified.

llvm-svn: 277753

8 years ago[InstCombine] use m_APInt to allow icmp eq (or X, C1), C2 folds for splat constant...
Sanjay Patel [Thu, 4 Aug 2016 19:12:12 +0000 (19:12 +0000)]
[InstCombine] use m_APInt to allow icmp eq (or X, C1), C2 folds for splat constant vectors

llvm-svn: 277752

8 years agoGlobalISel: also add G_TRUNC to IRTranslator.
Tim Northover [Thu, 4 Aug 2016 18:35:17 +0000 (18:35 +0000)]
GlobalISel: also add G_TRUNC to IRTranslator.

llvm-svn: 277749

8 years agoGlobalISel: add code to widen scalar G_ADD
Tim Northover [Thu, 4 Aug 2016 18:35:11 +0000 (18:35 +0000)]
GlobalISel: add code to widen scalar G_ADD

llvm-svn: 277747

8 years agofix whitespaces from https://reviews.llvm.org/D23170
Etienne Bergeron [Thu, 4 Aug 2016 18:30:41 +0000 (18:30 +0000)]
fix whitespaces from https://reviews.llvm.org/D23170

llvm-svn: 277746

8 years ago[compiler-rt] Fix memory allocator for dynamic address space
Etienne Bergeron [Thu, 4 Aug 2016 18:15:38 +0000 (18:15 +0000)]
[compiler-rt] Fix memory allocator for dynamic address space

Summary:
The sanitizer allocators can works with a dynamic address space
(i.e. specified with ~0ULL).

Unfortunately, the code was broken on GetMetadata and GetChunkIdx.

The current patch is moving the Win64 memory test to a dynamic
address space. There is a migration to move every concept to a
dynamic address space on windows.

To have a better coverage, the unittest are now testing
dynamic address space on other platforms too.

Reviewers: rnk, kcc

Subscribers: kubabrecka, dberris, llvm-commits, chrisha

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

llvm-svn: 277745

8 years agoremove FIXME comments (fixed with r277738)
Sanjay Patel [Thu, 4 Aug 2016 18:14:02 +0000 (18:14 +0000)]
remove FIXME comments (fixed with r277738)

llvm-svn: 277744

8 years ago[OpenCL] Added underscores to the names of 'to_addr' OpenCL built-ins.
Alexey Bader [Thu, 4 Aug 2016 18:06:27 +0000 (18:06 +0000)]
[OpenCL] Added underscores to the names of 'to_addr' OpenCL built-ins.

Summary:
In order to re-define OpenCL built-in functions
'to_{private,local,global}' in OpenCL run-time library LLVM names must
be different from the clang built-in function names.

Reviewers: yaxunl, Anastasia

Subscribers: cfe-commits

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

llvm-svn: 277743

8 years ago[WebAssembly] Check return value of getRegForValue in FastISel
Derek Schuff [Thu, 4 Aug 2016 18:01:52 +0000 (18:01 +0000)]
[WebAssembly] Check return value of getRegForValue in FastISel

Previously, FastISel for WebAssembly wasn't checking the return value of
`getRegForValue` in certain cases, which would generate instructions
referencing NoReg. This patch fixes this behavior.

Patch by Dominic Chen

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

llvm-svn: 277742

8 years ago[llvm-cov] Add some documentation for the -tab-size option
Vedant Kumar [Thu, 4 Aug 2016 18:00:42 +0000 (18:00 +0000)]
[llvm-cov] Add some documentation for the -tab-size option

Also, un-hide the cl::opt.

llvm-svn: 277741

8 years ago[Hexagon] Validate register class when doing bit simplification
Krzysztof Parzyszek [Thu, 4 Aug 2016 17:56:19 +0000 (17:56 +0000)]
[Hexagon] Validate register class when doing bit simplification

llvm-svn: 277740

8 years ago[InstCombine] use m_APInt to allow icmp eq (op X, Y), C folds for splat constant...
Sanjay Patel [Thu, 4 Aug 2016 17:48:04 +0000 (17:48 +0000)]
[InstCombine] use m_APInt to allow icmp eq (op X, Y), C folds for splat constant vectors

I'm removing a misplaced pair of more specific folds from InstCombine in this patch as well,
so we know where those folds are happening in InstSimplify.

llvm-svn: 277738

8 years ago[X86][SSE] Rename target shuffle unary permute matching function. NFCI.
Simon Pilgrim [Thu, 4 Aug 2016 17:16:50 +0000 (17:16 +0000)]
[X86][SSE] Rename target shuffle unary permute matching function. NFCI.

In preparation for adding a binary permute matching function.

llvm-svn: 277737

8 years agoadd tests for missing vector folds
Sanjay Patel [Thu, 4 Aug 2016 16:48:30 +0000 (16:48 +0000)]
add tests for missing vector folds

llvm-svn: 277736

8 years agoLoadStoreVectorizer: Remove TargetBaseAlign. Keep alignment for stack adjustments.
Alina Sbirlea [Thu, 4 Aug 2016 16:38:44 +0000 (16:38 +0000)]
LoadStoreVectorizer: Remove TargetBaseAlign. Keep alignment for stack adjustments.

Summary:
TargetBaseAlign is no longer required since LSV checks if target allows misaligned accesses.
A constant defining a base alignment is still needed for stack accesses where alignment can be adjusted.

Previous patch (D22936) was reverted because tests were failing. This patch also fixes the cause of those failures:
- x86 failing tests either did not have the right target, or the right alignment.
- NVPTX failing tests did not have the right alignment.
- AMDGPU failing test (merge-stores) should allow vectorization with the given alignment but the target info
  considers <3xi32> a non-standard type and gives up early. This patch removes the condition and only checks
  for a maximum size allowed and relies on the next condition checking for %4 for correctness.
  This should be revisited to include 3xi32 as a MVT type (on arsenm's non-immediate todo list).

Note that checking the sizeInBits for a MVT is undefined (leads to an assertion failure),
so we need to create an EVT, hence the interface change in allowsMisaligned to include the Context.

Reviewers: arsenm, jlebar, tstellarAMD

Subscribers: jholewinski, arsenm, mzolotukhin, llvm-commits

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

llvm-svn: 277735

8 years agoShamelessly add myself to CREDITS.TXT
Adrian Prantl [Thu, 4 Aug 2016 16:28:22 +0000 (16:28 +0000)]
Shamelessly add myself to CREDITS.TXT

llvm-svn: 277734

8 years ago[ASAN] Mark test/asan/TestCases/ill.cc as unsupported on darwin
Bruno Cardoso Lopes [Thu, 4 Aug 2016 15:57:30 +0000 (15:57 +0000)]
[ASAN] Mark test/asan/TestCases/ill.cc as unsupported on darwin

Introduced in r277621, this test is currently failing all around in
public bots: http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/20787
and internal bots. Mark it as unsupported on darwin until we figure
out how it should behave.

llvm-svn: 277733

8 years ago[mips] Set Personality and LSDA encoding for FreeBSD
Daniel Sanders [Thu, 4 Aug 2016 15:36:03 +0000 (15:36 +0000)]
[mips] Set Personality and LSDA encoding for FreeBSD

Reviewers: seanbruno, sdardis

Subscribers: tberghammer, danalbert, srhines, dsanders, sdardis, llvm-commits, seanbruno

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

llvm-svn: 277732

8 years ago[InstCombine] use m_APInt to allow icmp eq (sub C1, X), C2 folds for splat constant...
Sanjay Patel [Thu, 4 Aug 2016 15:19:25 +0000 (15:19 +0000)]
[InstCombine] use m_APInt to allow icmp eq (sub C1, X), C2 folds for splat constant vectors

llvm-svn: 277731

8 years agoAdd test case for nested creation of tasks
Jonas Hahnfeld [Thu, 4 Aug 2016 14:55:56 +0000 (14:55 +0000)]
Add test case for nested creation of tasks

For discussion in D23115

llvm-svn: 277730

8 years ago[clang-tidy] misc-argument-comment non-strict mode
Alexander Kornienko [Thu, 4 Aug 2016 14:54:54 +0000 (14:54 +0000)]
[clang-tidy] misc-argument-comment non-strict mode

Summary:
The misc-argument-comment check now ignores leading and trailing underscores and
case. The new `StrictMode` local/global option can be used to switch back to
strict checking.

Add getLocalOrGlobal version for integral types, minor cleanups.

Reviewers: hokein, aaron.ballman

Subscribers: aaron.ballman, Prazek, cfe-commits

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

llvm-svn: 277729

8 years ago[X86][SSE] Split off shuffle mask canonicalization from lowerVectorShuffle. NFCI.
Simon Pilgrim [Thu, 4 Aug 2016 14:21:32 +0000 (14:21 +0000)]
[X86][SSE] Split off shuffle mask canonicalization from lowerVectorShuffle. NFCI.

The new function now returns true if the shuffle should be commuted.

This will allow target shuffle combines to share the code.

llvm-svn: 277728

8 years ago[Hexagon] Clear kill flags from modified registers in peephole optimizer
Krzysztof Parzyszek [Thu, 4 Aug 2016 14:17:16 +0000 (14:17 +0000)]
[Hexagon] Clear kill flags from modified registers in peephole optimizer

llvm-svn: 277727

8 years agoGPGPU: Support scalars that are mapped to shared memory
Tobias Grosser [Thu, 4 Aug 2016 13:57:29 +0000 (13:57 +0000)]
GPGPU: Support scalars that are mapped to shared memory

llvm-svn: 277726

8 years ago[X86] Heuristic to selectively build Newton-Raphson SQRT estimation
Nikolai Bozhenov [Thu, 4 Aug 2016 12:47:28 +0000 (12:47 +0000)]
[X86] Heuristic to selectively build Newton-Raphson SQRT estimation

On modern Intel processors hardware SQRT in many cases is faster than RSQRT
followed by Newton-Raphson refinement. The patch introduces a simple heuristic
to choose between hardware SQRT instruction and Newton-Raphson software
estimation.

The patch treats scalars and vectors differently. The heuristic is that for
scalars the compiler should optimize for latency while for vectors it should
optimize for throughput. It is based on the assumption that throughput bound
code is likely to be vectorized.

Basically, the patch disables scalar NR for big cores and disables NR completely
for Skylake. Firstly, scalar SQRT has shorter latency than NR code in big cores.
Secondly, vector SQRT has been greatly improved in Skylake and has better
throughput compared to NR.

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

llvm-svn: 277725

8 years agoGPGPU: Disable verbose debug output
Tobias Grosser [Thu, 4 Aug 2016 12:44:03 +0000 (12:44 +0000)]
GPGPU: Disable verbose debug output

llvm-svn: 277724

8 years agoRemove leftover debug output
Tobias Grosser [Thu, 4 Aug 2016 12:41:28 +0000 (12:41 +0000)]
Remove leftover debug output

llvm-svn: 277723

8 years agoGPGPU: Add private memory support
Tobias Grosser [Thu, 4 Aug 2016 12:39:03 +0000 (12:39 +0000)]
GPGPU: Add private memory support

llvm-svn: 277722

8 years agoGPGPU: Add support for shared memory
Tobias Grosser [Thu, 4 Aug 2016 12:18:14 +0000 (12:18 +0000)]
GPGPU: Add support for shared memory

llvm-svn: 277721

8 years agoRemove redundant argument.
Rafael Espindola [Thu, 4 Aug 2016 12:13:05 +0000 (12:13 +0000)]
Remove redundant argument.

But always set Script<ELFT>::X->OutputSections.

llvm-svn: 277720

8 years ago[mips][microMIPS] Implement CFC1, CFC2, CTC1 and CTC2 instructions
Hrvoje Varga [Thu, 4 Aug 2016 11:22:52 +0000 (11:22 +0000)]
[mips][microMIPS] Implement CFC1, CFC2, CTC1 and CTC2 instructions
Differential Revision: https://reviews.llvm.org/D22347

llvm-svn: 277719

8 years ago[X86] Dropped XOP ctbits checks - they match the AVX checks
Simon Pilgrim [Thu, 4 Aug 2016 11:04:13 +0000 (11:04 +0000)]
[X86] Dropped XOP ctbits checks - they match the AVX checks

llvm-svn: 277718

8 years agokmp_taskdeps.cpp: Fix debugging output
Jonas Hahnfeld [Thu, 4 Aug 2016 11:03:47 +0000 (11:03 +0000)]
kmp_taskdeps.cpp: Fix debugging output

node->dn.task is only filled after the dependencies are already processed.
This currently leads to unhelpful output from KA_TRACE or even a crash
if one enables KMP_SUPPORT_GRAPH_OUTPUT.

llvm-svn: 277717

8 years ago[X86][SSE] Add initial costs for vector CTTZ/CTLZ
Simon Pilgrim [Thu, 4 Aug 2016 10:51:41 +0000 (10:51 +0000)]
[X86][SSE] Add initial costs for vector CTTZ/CTLZ

llvm-svn: 277716

8 years ago[LLVM-COV]Replace tabs to the space indentations in the HTML coverage report.
Ying Yi [Thu, 4 Aug 2016 10:39:43 +0000 (10:39 +0000)]
[LLVM-COV]Replace tabs to the space indentations in the HTML coverage report.

When using orbis-llvm-cov.exe to generate the HTML report, the HTML report
can look quite different to the source file if it includes tabs.The default
tab size is 2 spaces instead of 8 spaces. A command line switch is
be added to set the tab size.

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

llvm-svn: 277715

8 years agoRemove LLVM_ENABLE_LIBCXXABI
Jonas Hahnfeld [Thu, 4 Aug 2016 10:24:48 +0000 (10:24 +0000)]
Remove LLVM_ENABLE_LIBCXXABI

libc++.so is now a linker script that includes -lc++abi if necessary.

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

llvm-svn: 277714

8 years ago[X86][SSE] Don't decide when to scalarize CTTZ/CTLZ for performance at lowering ...
Simon Pilgrim [Thu, 4 Aug 2016 10:14:39 +0000 (10:14 +0000)]
[X86][SSE] Don't decide when to scalarize CTTZ/CTLZ for performance at lowering - this is what cost models are for

Improved CTTZ/CTLZ costings will be added shortly

llvm-svn: 277713

8 years agoMake isExternC work on VarDecls too.
Benjamin Kramer [Thu, 4 Aug 2016 10:02:03 +0000 (10:02 +0000)]
Make isExternC work on VarDecls too.

llvm-svn: 277712

8 years ago[ELF] - Attemp to fix buildbot.
George Rimar [Thu, 4 Aug 2016 09:49:26 +0000 (09:49 +0000)]
[ELF] - Attemp to fix buildbot.

http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/25733/steps/test_lld/logs/stdio

Fix: removed excessive whitespace.
llvm-svn: 277711

8 years ago[ELF] - Linkerscript: implemented ASSERT() keyword.
George Rimar [Thu, 4 Aug 2016 09:29:31 +0000 (09:29 +0000)]
[ELF] - Linkerscript: implemented ASSERT() keyword.

ASSERT(exp, message)
Ensure that exp is non-zero. If it is zero, then exit the linker with an error
code, and print message.

ASSERT is useful and was seen in few projects in the wild.

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

llvm-svn: 277710

8 years ago[clang-rename] add missing clang-format improvements
Kirill Bobyrev [Thu, 4 Aug 2016 09:23:30 +0000 (09:23 +0000)]
[clang-rename] add missing clang-format improvements

r277702 introduced clang-format changes so that later commits wouldn't introduce
non-functional changes while running clang-format before commiting. Though,
few changes by clang-format weren't in the patch.

llvm-svn: 277709

8 years ago[mips] Enable tail calls by default
Simon Dardis [Thu, 4 Aug 2016 09:17:07 +0000 (09:17 +0000)]
[mips] Enable tail calls by default

Enable tail calls by default for (micro)MIPS(64).

microMIPS is slightly more tricky than doing it for MIPS(R6) or microMIPSR6.
microMIPS has two instruction encodings: 16bit and 32bit along with some
restrictions on the size of the instruction that can fill the delay slot.
For safe tail calls for microMIPS, the delay slot filler attempts to find
a correct size instruction for the delay slot of TAILCALL pseudos.

Reviewers: dsanders, vkalintris

Subscribers: jfb, dsanders, sdardis, llvm-commits

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

llvm-svn: 277708

8 years agoGPGPU: Cache PTX kernels
Tobias Grosser [Thu, 4 Aug 2016 09:15:58 +0000 (09:15 +0000)]
GPGPU: Cache PTX kernels

We always keep a number of already compiled kernels available to ensure to avoid
costly recompilation.

llvm-svn: 277707

8 years ago[ELF] - Linkerscript: Fixed SORT_BY_ALIGNMENT sorting order.
George Rimar [Thu, 4 Aug 2016 08:56:17 +0000 (08:56 +0000)]
[ELF] - Linkerscript: Fixed SORT_BY_ALIGNMENT sorting order.

According to spec:
"SORT_BY_ALIGNMENT will sort sections into descending order by
alignment before placing them in the output file"

Previously they were sorted into ascending order.

llvm-svn: 277706

8 years ago[ELF] - Remove trailing whitespaces. NFC.
George Rimar [Thu, 4 Aug 2016 08:26:02 +0000 (08:26 +0000)]
[ELF] - Remove trailing whitespaces. NFC.

llvm-svn: 277705

8 years agoTypo fix in comment. NFC
Diana Picus [Thu, 4 Aug 2016 08:25:08 +0000 (08:25 +0000)]
Typo fix in comment. NFC

llvm-svn: 277704

8 years ago[ELF] Linkerscript: remove repeated sections in filter()
Eugene Leviant [Thu, 4 Aug 2016 08:20:23 +0000 (08:20 +0000)]
[ELF] Linkerscript: remove repeated sections in filter()

llvm-svn: 277703

8 years agoRun clang-format on clang-rename code
Miklos Vajna [Thu, 4 Aug 2016 07:43:29 +0000 (07:43 +0000)]
Run clang-format on clang-rename code

So that later commits don't introduce non-functional changes when
running clang-format before committing.

Reviewers: klimek

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

llvm-svn: 277702

8 years ago[XRay] Align entry and return sleds to 2 byte boundaries
Dean Michael Berris [Thu, 4 Aug 2016 07:37:28 +0000 (07:37 +0000)]
[XRay] Align entry and return sleds to 2 byte boundaries

This should ensure that we can atomically write two bytes (on top of the
retq and the one past it) and have those two bytes not straddle cache
lines.

We also move the label past the alignment instruction so that we can refer
to the actual first instruction, as opposed to potential padding before the
aligned instruction.

Update the tests to allow us to reflect the new order of assembly.

Reviewers: rSerge, echristo, majnemer

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 277701

8 years agoAMDGPU: Fix a slow test by using basic regalloc
Matt Arsenault [Thu, 4 Aug 2016 07:04:54 +0000 (07:04 +0000)]
AMDGPU: Fix a slow test by using basic regalloc

This just tests that the register limit isn't exceeded,
so the regisetr allocation doesn't need to be great.'

The critically slow part is all in greedy RA, so
switch to basic.

llvm-svn: 277700

8 years agoGPGPU: Handle scalar array references
Tobias Grosser [Thu, 4 Aug 2016 06:55:59 +0000 (06:55 +0000)]
GPGPU: Handle scalar array references

Pass the content of scalar array references to the alloca on the kernel side
and do not pass them additional as normal LLVM scalar value.

llvm-svn: 277699

8 years agoBlockGenerator: Assert that we do not get alloca of array access
Tobias Grosser [Thu, 4 Aug 2016 06:55:53 +0000 (06:55 +0000)]
BlockGenerator: Assert that we do not get alloca of array access

llvm-svn: 277698

8 years agoGPGPU: Pass subtree values correctly to the kernel
Tobias Grosser [Thu, 4 Aug 2016 06:55:49 +0000 (06:55 +0000)]
GPGPU: Pass subtree values correctly to the kernel

llvm-svn: 277697

8 years agoAfter PR28761 use -Wall with -Werror in builtins tests to identify
Eric Christopher [Thu, 4 Aug 2016 06:02:50 +0000 (06:02 +0000)]
After PR28761 use -Wall with -Werror in builtins tests to identify
possible problems in headers.

llvm-svn: 277696

8 years agoFix intrinsics.ll test
Amaury Sechet [Thu, 4 Aug 2016 05:35:25 +0000 (05:35 +0000)]
Fix intrinsics.ll test

llvm-svn: 277695

8 years agoAdd popcount(n) == bitsize(n) -> n == -1 transformation.
Amaury Sechet [Thu, 4 Aug 2016 05:27:20 +0000 (05:27 +0000)]
Add popcount(n) == bitsize(n)  -> n == -1 transformation.

Summary: As per title.

Reviewers: majnemer, spatel

Subscribers: llvm-commits

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

llvm-svn: 277694