platform/upstream/llvm.git
9 years agoWin64 SEH: Emit the constant 1 for catch-all into xdata
Reid Kleckner [Thu, 22 Jan 2015 02:27:44 +0000 (02:27 +0000)]
Win64 SEH: Emit the constant 1 for catch-all into xdata

llvm-svn: 226767

9 years agoSEH: Emit the constant filter 1 as a catch-all
Reid Kleckner [Thu, 22 Jan 2015 02:25:56 +0000 (02:25 +0000)]
SEH: Emit the constant filter 1 as a catch-all

Minor optimization of code like __try { ... } __except(1) { ... }.

llvm-svn: 226766

9 years ago[modules] If we load two declarations with typedef names for linkage purposes
Richard Smith [Thu, 22 Jan 2015 02:21:23 +0000 (02:21 +0000)]
[modules] If we load two declarations with typedef names for linkage purposes
on top of a local declaration of the same entity, we still need to remember
that we loaded the first one or we may fail to merge the second one properly.

llvm-svn: 226765

9 years agoInstrProf: Avoid creating profile names for symbols in system headers
Justin Bogner [Thu, 22 Jan 2015 02:17:23 +0000 (02:17 +0000)]
InstrProf: Avoid creating profile names for symbols in system headers

We don't emit any coverage mapping for uncovered functions that come
from system headers, but we were creating a GlobalVariable with each
of their names. This is wasteful since the linker will need to dead
strip the unused symbols, and it can lead to issues when merging
coverage with others TUs that do have coverage for those functions.

llvm-svn: 226764

9 years agoAssigning and copying command line option objects shouldn't be allowed.
Chris Bieneman [Thu, 22 Jan 2015 01:49:59 +0000 (01:49 +0000)]
Assigning and copying command line option objects shouldn't be allowed.

Summary:
The default copy and assignment operators for these objects probably don't actually do what the clients intend, so they should be deleted.

Places using the assignment operator to set the value of an option should cast to the option's data type first to call into the override for operator=. Places using the copy constructor just need to be changed to not copy (i.e. passing by const reference instead of value).

Reviewers: dexonsmith, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 226762

9 years ago[modules] It's possible to merge into the pattern of a class template before we
Richard Smith [Thu, 22 Jan 2015 01:41:56 +0000 (01:41 +0000)]
[modules] It's possible to merge into the pattern of a class template before we
load the definition data from the declaration itself. In that case, merge
properly; don't assume the prior definition is the same as our own.

llvm-svn: 226761

9 years agoInitial support for Win64 SEH IR emission
Reid Kleckner [Thu, 22 Jan 2015 01:36:17 +0000 (01:36 +0000)]
Initial support for Win64 SEH IR emission

The lowering looks a lot like normal EH lowering, with the exception
that the exceptions are caught by executing filter expression code
instead of matching typeinfo globals. The filter expressions are
outlined into functions which are used in landingpad clauses where
typeinfo would normally go.

Major aspects that still need work:
- Non-call exceptions in __try bodies won't work yet. The plan is to
  outline the __try block in the frontend to keep things simple.
- Filter expressions cannot use local variables until capturing is
  implemented.
- __finally blocks will not run after exceptions. Fixing this requires
  work in the LLVM SEH preparation pass.

The IR lowering looks like this:

// C code:
bool safe_div(int n, int d, int *r) {
  __try {
    *r = normal_div(n, d);
  } __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) {
    return false;
  }
  return true;
}

; LLVM IR:
define i32 @filter(i8* %e, i8* %fp) {
  %ehptrs = bitcast i8* %e to i32**
  %ehrec = load i32** %ehptrs
  %code = load i32* %ehrec
  %matches = icmp eq i32 %code, i32 u0xC0000094
  %matches.i32 = zext i1 %matches to i32
  ret i32 %matches.i32
}

define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) {
  %rr = invoke i32 @normal_div(i32 %n, i32 %d)
      to label %normal unwind to label %lpad

normal:
  store i32 %rr, i32* %r
  ret i1 1

lpad:
  %ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler
      catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*)
  %ehptr = extractvalue {i8*, i32} %ehvals, i32 0
  %sel = extractvalue {i8*, i32} %ehvals, i32 1
  %filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*))
  %matches = icmp eq i32 %sel, %filter_sel
  br i1 %matches, label %eh.except, label %eh.resume

eh.except:
  ret i1 false

eh.resume:
  resume
}

Reviewers: rjmccall, rsmith, majnemer

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

llvm-svn: 226760

9 years agoRevert "Try to fix -Asserts build bots."
Rafael Espindola [Thu, 22 Jan 2015 01:33:41 +0000 (01:33 +0000)]
Revert "Try to fix -Asserts build bots."

This reverts commit r226758.

Looks like rnk's 226757 fixed the real issue.
Sorry for the noise.

llvm-svn: 226759

9 years agoTry to fix -Asserts build bots.
Rafael Espindola [Thu, 22 Jan 2015 01:26:39 +0000 (01:26 +0000)]
Try to fix -Asserts build bots.

llvm-svn: 226758

9 years agoGive the block inlining test a triple to determinise output
Reid Kleckner [Thu, 22 Jan 2015 01:19:19 +0000 (01:19 +0000)]
Give the block inlining test a triple to determinise output

It fails on Windows due to another temporary being emitted first, so the
LLVM internal renaming scheme gives out the name
__block_descriptor_tmp1.

llvm-svn: 226757

9 years agoRemove an out-of-date and incorrect comment.
Richard Smith [Thu, 22 Jan 2015 01:15:51 +0000 (01:15 +0000)]
Remove an out-of-date and incorrect comment.

llvm-svn: 226756

9 years agoMake ScalarEvolution less aggressive with respect to no-wrap flags.
Sanjoy Das [Thu, 22 Jan 2015 00:48:47 +0000 (00:48 +0000)]
Make ScalarEvolution less aggressive with respect to no-wrap flags.

ScalarEvolution currently lowers a subtraction recurrence to an add
recurrence with the same no-wrap flags as the subtraction.  This is
incorrect because `sub nsw X, Y` is not the same as `add nsw X, -Y`
and `sub nuw X, Y` is not the same as `add nuw X, -Y`.  This patch
fixes the issue, and adds two test cases demonstrating the bug.

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

llvm-svn: 226755

9 years agoFix compiler_builtins.m test to not rely on including system stdlib.h and malloc.h
Hans Wennborg [Thu, 22 Jan 2015 00:45:20 +0000 (00:45 +0000)]
Fix compiler_builtins.m test to not rely on including system stdlib.h and malloc.h

Importing _Builtin_intrinsics.sse and avx would transitively pull in those
headers, and the test would fail when building in an environment where
they were not available on the include path.

This fixes PR20995 for me.

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

llvm-svn: 226754

9 years agoFile::Read(), when asked to read the contents of a file into a heap
Jason Molenda [Thu, 22 Jan 2015 00:41:05 +0000 (00:41 +0000)]
File::Read(), when asked to read the contents of a file into a heap
buffer and to add a nul terminator byte, was incorrectly resizing
its buffer so the nul terminator was not included.

Problem found by clang ASAN instrumentation when using an
expression prefix file which was read via this mechanism.

<rdar://problem/19556459>

llvm-svn: 226753

9 years agoAdd Utility/UriParser.cpp to the lldb-core target so xcode builds
Jason Molenda [Thu, 22 Jan 2015 00:39:36 +0000 (00:39 +0000)]
Add Utility/UriParser.cpp to the lldb-core target so xcode builds
work again.

llvm-svn: 226752

9 years agoEmit DeferredDeclsToEmit in a DFS order.
Rafael Espindola [Thu, 22 Jan 2015 00:24:57 +0000 (00:24 +0000)]
Emit DeferredDeclsToEmit in a DFS order.

Currently we emit DeferredDeclsToEmit in reverse order. This patch changes that.

The advantages of the change are that

* The output order is a bit closer to the source order. The change to
test/CodeGenCXX/pod-member-memcpys.cpp is a good example.

* If we decide to deffer more, it will not cause as large changes in the
estcases as it would without this patch.

llvm-svn: 226751

9 years agoExplicitly describe '///' versus '//' comment delimiters.
Paul Robinson [Thu, 22 Jan 2015 00:19:56 +0000 (00:19 +0000)]
Explicitly describe '///' versus '//' comment delimiters.

llvm-svn: 226750

9 years agoFix lit config typo
Jonathan Roelofs [Thu, 22 Jan 2015 00:05:11 +0000 (00:05 +0000)]
Fix lit config typo

llvm-svn: 226749

9 years agoMake DwarfExpression use the new DIExpressionIterator. NFC.
Adrian Prantl [Thu, 22 Jan 2015 00:00:59 +0000 (00:00 +0000)]
Make DwarfExpression use the new DIExpressionIterator. NFC.

llvm-svn: 226748

9 years agoRewrite DIExpression::Verify() using an iterator. NFC.
Adrian Prantl [Thu, 22 Jan 2015 00:00:52 +0000 (00:00 +0000)]
Rewrite DIExpression::Verify() using an iterator. NFC.

Addresses review comments for r226627.

llvm-svn: 226747

9 years ago[canonicalization] Refactor how we create new stores into a helper
Chandler Carruth [Wed, 21 Jan 2015 23:45:01 +0000 (23:45 +0000)]
[canonicalization] Refactor how we create new stores into a helper
function. This is a bit tidier anyways and will make a subsquent patch
simpler as I want to add another case to this combine.

llvm-svn: 226746

9 years ago[X86][SSE] Missing SSE/AVX1 memory folding integer instructions
Simon Pilgrim [Wed, 21 Jan 2015 23:43:30 +0000 (23:43 +0000)]
[X86][SSE] Missing SSE/AVX1 memory folding integer instructions

Added most of the missing integer vector folding patterns for SSE (to SSE42) and AVX1.

The most useful of these are probably the i32/i64 extraction, i8/i16/i32/i64 insertions, zero/sign extension, unsigned saturation subtractions, i64 subtractions and the variable mask blends (pblendvb) - others include CLMUL, SSE42 string comparisons and bit tests.

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

llvm-svn: 226745

9 years agoExpression evaluation for functions with unknown signatures on works by
Kate Stone [Wed, 21 Jan 2015 23:39:16 +0000 (23:39 +0000)]
Expression evaluation for functions with unknown signatures on works by
inferring the function signature.  This works well where the ABI doesn't
distinguish between variadic and fixed argument lists, but on arm64 the
calling conventions differ.  The default assumption works for fixed argument
lists, but variadic functions require explicit prototypes to be called.

By far the most common case where this is an issue is when attempting to use
 printf().  This change augments the default expression prefix to include a
working variadic prototype for the function.

<rdar://problem/19024779>

llvm-svn: 226744

9 years agoUse CHECK-LABEL when possible. NFC.
Rafael Espindola [Wed, 21 Jan 2015 23:33:55 +0000 (23:33 +0000)]
Use CHECK-LABEL when possible. NFC.

llvm-svn: 226743

9 years agoImplement ProcessWindows::GetMemoryRegionInfo.
Zachary Turner [Wed, 21 Jan 2015 23:26:40 +0000 (23:26 +0000)]
Implement ProcessWindows::GetMemoryRegionInfo.

llvm-svn: 226742

9 years agoAdopt new cl::HideUnrelatedOptions API added r226729.
Chris Bieneman [Wed, 21 Jan 2015 23:26:11 +0000 (23:26 +0000)]
Adopt new cl::HideUnrelatedOptions API added r226729.

Summary: cl::HideUnrelatedOptions allows tools to hide all options not part of a specific OptionCategory. This is the common use case for cl::getRegisteredOptions, which should be deprecated in the future because it exposes implementation details of command line parsing.

Reviewers: dexonsmith

Subscribers: klimek, cfe-commits

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

llvm-svn: 226741

9 years agoDAGCombine: fold (or (and X, M), (and X, N)) -> (and X, (or M, N))
Tim Northover [Wed, 21 Jan 2015 23:17:19 +0000 (23:17 +0000)]
DAGCombine: fold (or (and X, M), (and X, N)) -> (and X, (or M, N))

It can help with argument juggling on some targets, and is generally a good
idea.

llvm-svn: 226740

9 years agoDrop an unused parameter
Tobias Grosser [Wed, 21 Jan 2015 23:11:46 +0000 (23:11 +0000)]
Drop an unused parameter

llvm-svn: 226739

9 years agoDebugInfo: Remove forced column-info workaround for inlined calls
David Blaikie [Wed, 21 Jan 2015 23:08:17 +0000 (23:08 +0000)]
DebugInfo: Remove forced column-info workaround for inlined calls

This workaround was to provide unique call sites to ensure LLVM's inline
debug info handling would properly unique two calls to the same function
on the same line. Instead, this has now been fixed in LLVM (r226736) and
the workaround here can be removed.

Originally committed in r176895, but this isn't a straight revert due to
all the changes since then. I just searched for anything ForcedColumn*
related and removed them.

We could test this - but it didn't strike me as terribly valuable once
we're no longer adding this workaround everything just works as expected
& it's no longer a special case to test for.

llvm-svn: 226738

9 years agoMerge libc++abi's lit configuration with libc++'s
Jonathan Roelofs [Wed, 21 Jan 2015 23:06:22 +0000 (23:06 +0000)]
Merge libc++abi's lit configuration with libc++'s

http://reviews.llvm.org/D6985

llvm-svn: 226737

9 years agoDebugInfo: Use distinct inlinedAt MDLocations to avoid separate inlined calls being...
David Blaikie [Wed, 21 Jan 2015 22:57:29 +0000 (22:57 +0000)]
DebugInfo: Use distinct inlinedAt MDLocations to avoid separate inlined calls being coalesced

When two calls from the same MDLocation are inlined they currently get
treated as one inlined function call (creating difficulty debugging,
duplicate variables, etc).

Clang worked around this by including column information on inline calls
which doesn't address LTO inlining or calls to the same function from
the same line and column (such as through a macro). It also didn't
address ctor and member function calls.

By making the inlinedAt locations distinct, every call site has an
explicitly distinct location that cannot be coalesced with any other
call.

This can produce linearly (2x in the worst case where every call is
inlined and the call instruction has a non-call instruction at the same
location) more debug locations. Any increase beyond that are in cases
where the Clang workaround was insufficient and the new scheme is
creating necessary distinct nodes that were being erroneously coalesced
previously.

After this change to LLVM the incomplete workarounds in Clang. That
should reduce the number of debug locations (in a build without column
info, the default on Darwin, not the default on Linux) by not creating
pseudo-distinct locations for every call to an inline function.

(oh, and I made the inlined-at chain rebuilding iterative instead of
recursive because I was having trouble wrapping my head around it the
way it was - open to discussion on the right design for that function
(including going back to a recursive solution))

llvm-svn: 226736

9 years agoDebugInfo: Remove distinct-call-inlining test case as this is being fixed in LLVM.
David Blaikie [Wed, 21 Jan 2015 22:57:22 +0000 (22:57 +0000)]
DebugInfo: Remove distinct-call-inlining test case as this is being fixed in LLVM.

This test will start failing shortly once this bug is fixed in LLVM. At
that point this behavior is no longer required in Clang and will be
removed. In the interim, remove this test just to avoid the race between
the LLVM and Clang commits.

After the LLVM commit, I'll cleanup the workaround behavior in Clang.

llvm-svn: 226735

9 years agoR600: Add checks for urem/srem by a constant
Matt Arsenault [Wed, 21 Jan 2015 22:56:15 +0000 (22:56 +0000)]
R600: Add checks for urem/srem by a constant

Make sure this uses the faster expansion using magic constants
to avoid the full division path.

llvm-svn: 226734

9 years agoLiveIntervalAnalysis: Mark subregister defs as undef when we determined they are...
Matthias Braun [Wed, 21 Jan 2015 22:55:13 +0000 (22:55 +0000)]
LiveIntervalAnalysis: Mark subregister defs as undef when we determined they are only reading a dead superregister value

This was not necessary before as this case can only be detected when the
liveness analysis is at subregister level.

llvm-svn: 226733

9 years agoFix five of the shared library build targets
Greg Fitzgerald [Wed, 21 Jan 2015 22:54:56 +0000 (22:54 +0000)]
Fix five of the shared library build targets

Before this patch there was a cyclic dependency between lldCore and
lldReaderWriter.  Only lldConfig could be built as a shared library.

* Moved Reader and Writer base classes into lldCore.
* The following shared libraries can now be built:
     lldCore
     lldYAML
     lldNative
     lldPasses
     lldReaderWriter

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

From: Greg Fitzgerald <garious@gmail.com>
llvm-svn: 226732

9 years agoSpeed these tests up quite significantly by using the SB API instead of running the...
Enrico Granata [Wed, 21 Jan 2015 22:51:59 +0000 (22:51 +0000)]
Speed these tests up quite significantly by using the SB API instead of running the "continue" command at each step
The reason why one mechanism is so much faster than the other (as in, ~10 seconds vs. ~1 minute) is quite baffling to me at the moment, but these are not process handling tests, so do what's faster

llvm-svn: 226730

9 years agoAdding a new cl::HideUnrelatedOptions API to allow clang to migrate off cl::getRegist...
Chris Bieneman [Wed, 21 Jan 2015 22:45:52 +0000 (22:45 +0000)]
Adding a new cl::HideUnrelatedOptions API to allow clang to migrate off cl::getRegisteredOptions.

Summary: cl::getRegisteredOptions really exposes some of the innards of how command line parsing is implemented. Exposing new APIs that allow us to disentangle client code from implementation details will allow us to make more extensive changes to command line parsing.

Reviewers: chandlerc, dexonsmith, beanz

Reviewed By: dexonsmith

Subscribers: llvm-commits

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

llvm-svn: 226729

9 years ago[X86][SSE] Added support for SSE3 lane duplication shuffle instructions
Simon Pilgrim [Wed, 21 Jan 2015 22:44:35 +0000 (22:44 +0000)]
[X86][SSE] Added support for SSE3 lane duplication shuffle instructions

This patch adds shuffle matching for the SSE3 MOVDDUP, MOVSLDUP and MOVSHDUP instructions. The big use of these being that they avoid many single source shuffles from needing to use (pre-AVX) dual source instructions such as SHUFPD/SHUFPS: causing extra moves and preventing load folds.

Adding these instructions uncovered an issue in XFormVExtractWithShuffleIntoLoad which crashed on single operand shuffle instructions (now fixed). It also involved fixing getTargetShuffleMask to correctly identify theses instructions as unary shuffles.

Also adds a missing tablegen pattern for MOVDDUP.

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

llvm-svn: 226716

9 years agoR600: Add missing tests for i64 srem
Matt Arsenault [Wed, 21 Jan 2015 22:43:19 +0000 (22:43 +0000)]
R600: Add missing tests for i64 srem

llvm-svn: 226713

9 years agoThis patch gets remote-linux platform able to run processes
Vince Harron [Wed, 21 Jan 2015 22:42:49 +0000 (22:42 +0000)]
This patch gets remote-linux platform able to run processes

Make sure the selected platform is always used

Make sure that the host uses the connect://hostname to connect to both
the lldb-platform and the lldb-gdbserver rather than what the platform
reports as the hostname of the lldb-gdbserver

Make sure that lldb-platform uses the IP address on it's connection
back to the host instead of the hostname that the host sends to it
when launching lldb-gdbserver with the remote host information

Tested on OSX and Linux

llvm-svn: 226712

9 years agoFix load-store optimizer on thumbv4t
Jonathan Roelofs [Wed, 21 Jan 2015 22:39:43 +0000 (22:39 +0000)]
Fix load-store optimizer on thumbv4t

Thumbv4t does not have lo->lo copies other than MOVS,
and that can't be predicated. So emit MOVS when needed
and bail if there's a predicate.

http://reviews.llvm.org/D6592

llvm-svn: 226711

9 years agoAdded test to cover the CFLAA bitset indexing bug.
George Burgess IV [Wed, 21 Jan 2015 22:39:35 +0000 (22:39 +0000)]
Added test to cover the CFLAA bitset indexing bug.

llvm-svn: 226710

9 years agoUse a CHECK-LABEL. NFC
Rafael Espindola [Wed, 21 Jan 2015 22:38:24 +0000 (22:38 +0000)]
Use a CHECK-LABEL. NFC

llvm-svn: 226709

9 years agoInstCombine: Don't strip bitcasts off of callsites marked 'thunk'
David Majnemer [Wed, 21 Jan 2015 22:32:04 +0000 (22:32 +0000)]
InstCombine: Don't strip bitcasts off of callsites marked 'thunk'

The return type of a thunk is meaningless, we just want the arguments
and return value to be forwarded.

llvm-svn: 226708

9 years agoAdd the "thunk" attribute to MS ABI virtual member pointers
Reid Kleckner [Wed, 21 Jan 2015 22:18:17 +0000 (22:18 +0000)]
Add the "thunk" attribute to MS ABI virtual member pointers

This attribute implies indicates that the function musttail calls
another function and returns whatever it returns. The return type of the
thunk is meaningless, as the thunk can dynamically call different
functions with different return types. So long as the callers bitcast
the thunk with the correct type, behavior is well defined.

This attribute was necessary to fix PR20944, where the indirect call
combiner noticed that the thunk returned void and replaced the results
of the indirect call instruction with undef.

Over-the-shoulder reviewed by David Majnemer.

llvm-svn: 226707

9 years agoFix runtime error on Windows.
Rui Ueyama [Wed, 21 Jan 2015 22:16:17 +0000 (22:16 +0000)]
Fix runtime error on Windows.

I believe the original code is valid, but on Windows it failed with an
assertion error saying "Expression: vector iterator is not decrementable."
Don't use rbegin and rend to workaround that error.

llvm-svn: 226706

9 years ago[X86][SSE] movddup shuffle mask decodes
Simon Pilgrim [Wed, 21 Jan 2015 22:02:30 +0000 (22:02 +0000)]
[X86][SSE] movddup shuffle mask decodes

Patch to provide shuffle decodes and asm comments for the SSE3/AVX1 movddup double duplication instructions.

llvm-svn: 226705

9 years agoAbstract the details from regex.h a bit more by not allowing people to specify compil...
Greg Clayton [Wed, 21 Jan 2015 21:51:02 +0000 (21:51 +0000)]
Abstract the details from regex.h a bit more by not allowing people to specify compile and execute flags for regular expressions. Also enable better regular expressions if they are available by check if the REG_ENHANCED is available and using it if it is.

Since REG_ENHANCED is available on MacOSX, this allow the use of \d (digits) \b (word boundaries) and much more without affecting other systems.

<rdar://problem/12082562>

llvm-svn: 226704

9 years agoAdd back a FIXME note to lit.cfg.
Francisco Lopes da Silva [Wed, 21 Jan 2015 21:38:05 +0000 (21:38 +0000)]
Add back a FIXME note to lit.cfg.

llvm-svn: 226703

9 years agoadd_lld_library -> add_llvm_library
Greg Fitzgerald [Wed, 21 Jan 2015 21:26:27 +0000 (21:26 +0000)]
add_lld_library -> add_llvm_library

* Works better for shared libraries (sets PRIVATE instead of INTERFACE)
* Fixes http://llvm.org/bugs/show_bug.cgi?id=22269
* Also, use build-target names instead of component names

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

From: Greg Fitzgerald <garious@gmail.com>
llvm-svn: 226702

9 years agosimplify expression
Adrian Prantl [Wed, 21 Jan 2015 21:23:35 +0000 (21:23 +0000)]
simplify expression

llvm-svn: 226701

9 years agoclang-format: Fix crasher when splitting incomplete escape sequences.
Daniel Jasper [Wed, 21 Jan 2015 19:50:35 +0000 (19:50 +0000)]
clang-format: Fix crasher when splitting incomplete escape sequences.

llvm-svn: 226698

9 years agoFix isTriviallyCopyableType for arrays
Saleem Abdulrasool [Wed, 21 Jan 2015 19:39:10 +0000 (19:39 +0000)]
Fix isTriviallyCopyableType for arrays

Fix isTriviallyCopyableType for arrays. An array of type T is trivially copyable
if T is trivially copyable.

Patch by Agustín Bergé!

llvm-svn: 226696

9 years agoFixed a makefile rule used by several tests
Kate Stone [Wed, 21 Jan 2015 19:30:00 +0000 (19:30 +0000)]
Fixed a makefile rule used by several tests

Now quotes dsymutil path, required when running tests where the toolchain is in a path that contains a space

llvm-svn: 226695

9 years agoFix a compile issue on MSVC and call finalize().
Adrian Prantl [Wed, 21 Jan 2015 19:25:35 +0000 (19:25 +0000)]
Fix a compile issue on MSVC and call finalize().

llvm-svn: 226694

9 years agoFix slow test.
Rui Ueyama [Wed, 21 Jan 2015 19:15:56 +0000 (19:15 +0000)]
Fix slow test.

yaml2obj command ran by this test took more than 15 seconds to finish
because of extremely large .bss section. Other tests only takes 3 seconds.
Reduce the size to make it faster.

llvm-svn: 226693

9 years agoRename all of the tests in preparation for merging lit configs with libcxx
Jonathan Roelofs [Wed, 21 Jan 2015 19:05:37 +0000 (19:05 +0000)]
Rename all of the tests in preparation for merging lit configs with libcxx

http://reviews.llvm.org/D7101

llvm-svn: 226691

9 years agoLiveIntervalAnalysis: Factor out code to update liveness on vreg def removal
Matthias Braun [Wed, 21 Jan 2015 19:02:30 +0000 (19:02 +0000)]
LiveIntervalAnalysis: Factor out code to update liveness on vreg def removal

This cleans up code and is more in line with the general philosophy of
modifying LiveIntervals through LiveIntervalAnalysis instead of changing
them directly.

This also fixes a case where SplitEditor::removeBackCopies() would miss
the subregister ranges.

llvm-svn: 226690

9 years agoLiveIntervalAnalysis: document removePhysRegDefAt() function.
Matthias Braun [Wed, 21 Jan 2015 19:02:26 +0000 (19:02 +0000)]
LiveIntervalAnalysis: document removePhysRegDefAt() function.

llvm-svn: 226689

9 years agoSimplify.
Rui Ueyama [Wed, 21 Jan 2015 18:54:26 +0000 (18:54 +0000)]
Simplify.

What we are trying to do here is to skip object files in group if
group is repeated. This code is simpler than before.

llvm-svn: 226688

9 years agoLiveIntervalAnalysis: Factor out code to update liveness on physreg def removal
Matthias Braun [Wed, 21 Jan 2015 18:50:21 +0000 (18:50 +0000)]
LiveIntervalAnalysis: Factor out code to update liveness on physreg def removal

This cleans up code and is more in line with the general philosophy of
modifying LiveIntervals through LiveIntervalAnalysis instead of changing
them directly.

llvm-svn: 226687

9 years agoLiveIntervalAnalysis: Remove unused pruneValue() variant.
Matthias Braun [Wed, 21 Jan 2015 18:45:57 +0000 (18:45 +0000)]
LiveIntervalAnalysis: Remove unused pruneValue() variant.

llvm-svn: 226686

9 years agoclang-format: Fix crasher caused by incorrect resetting of token info.
Daniel Jasper [Wed, 21 Jan 2015 18:35:47 +0000 (18:35 +0000)]
clang-format: Fix crasher caused by incorrect resetting of token info.

llvm-svn: 226685

9 years agoLet subprograms with instructions without parent scopes fail the
Adrian Prantl [Wed, 21 Jan 2015 18:32:56 +0000 (18:32 +0000)]
Let subprograms with instructions without parent scopes fail the
verification. Tested via a unit test.

Follow-up to r226616.

llvm-svn: 226684

9 years agoRevert "Some fixes for linking Python on Windows."
Zachary Turner [Wed, 21 Jan 2015 18:30:40 +0000 (18:30 +0000)]
Revert "Some fixes for linking Python on Windows."

This reverts commit r226679.  For some reason it was
not generating the same behavior as manually specifying
the include dir, library path, and exe path, and it was
causing the test suite to fail to run.

llvm-svn: 226683

9 years agoR600/SI: Custom lower fround
Matt Arsenault [Wed, 21 Jan 2015 18:18:25 +0000 (18:18 +0000)]
R600/SI: Custom lower fround

This fixes it for SI. It also removes the pattern
used previously for Evergreen for f32. I'm not sure
if the the new R600 output is better or not, but it uses
1 fewer instructions if BFI is available.

llvm-svn: 226682

9 years ago[Hexagon] Converting multiply and accumulate with immediate intrinsics to patterns.
Colin LeMahieu [Wed, 21 Jan 2015 18:13:15 +0000 (18:13 +0000)]
[Hexagon] Converting multiply and accumulate with immediate intrinsics to patterns.

llvm-svn: 226681

9 years agoclang-format: Fix bad memory access.
Daniel Jasper [Wed, 21 Jan 2015 18:04:02 +0000 (18:04 +0000)]
clang-format: Fix bad memory access.

llvm-svn: 226680

9 years agoSome fixes for linking Python on Windows.
Zachary Turner [Wed, 21 Jan 2015 17:53:10 +0000 (17:53 +0000)]
Some fixes for linking Python on Windows.

CMake FindPythonLibs will look for multiple versions of Python
including both debug and release, and build up a list such as
(debug <debugpath> optimized <optimizedpath>).  This confuses
the logic we have in CMake to copy the correct python dll to
the output directory so that it need not be in your system's PATH.

To alleviate this, we manually split this list and extract out
the debug and release versions of the python library, and copy
only the correct one to the output directory.

llvm-svn: 226679

9 years agoclang-format: Fix use-heap-after-free bug.
Daniel Jasper [Wed, 21 Jan 2015 17:35:29 +0000 (17:35 +0000)]
clang-format: Fix use-heap-after-free bug.

Discovered by the awesome test case and ASAN.

llvm-svn: 226678

9 years agoUsed CHECK-DAG since the order is not important.
Rafael Espindola [Wed, 21 Jan 2015 17:12:04 +0000 (17:12 +0000)]
Used CHECK-DAG since the order is not important.

llvm-svn: 226677

9 years ago[X86] Declare SSE4.1/AVX2 vector extloads covered by PMOV[SZ]X legal.
Ahmed Bougacha [Wed, 21 Jan 2015 17:07:06 +0000 (17:07 +0000)]
[X86] Declare SSE4.1/AVX2 vector extloads covered by PMOV[SZ]X legal.

Now that we can fully specify extload legality, we can declare them
legal for the PMOVSX/PMOVZX instructions.  This for instance enables
a DAGCombine to fire on code such as
  (and (<zextload-equivalent> ...), <redundant mask>)
to turn it into:
  (zextload ...)
as seen in the testcase changes.

There is one regression, in widen_load-2.ll: we're no longer able
to do store-to-load forwarding with illegal extload memory types.
This will be addressed separately.

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

llvm-svn: 226676

9 years agoUsed CHECK-DAG since the order is not important.
Rafael Espindola [Wed, 21 Jan 2015 16:56:43 +0000 (16:56 +0000)]
Used CHECK-DAG since the order is not important.

llvm-svn: 226675

9 years ago[msan] Fix origins in realloc.
Evgeniy Stepanov [Wed, 21 Jan 2015 16:48:29 +0000 (16:48 +0000)]
[msan] Fix origins in realloc.

Fixes 2 issues in origins arising from realloc() calls:
 * In the in-place grow case origin for the new memory is not set at all.
 * In the copy-realloc case __msan_memcpy is used, which unwinds stack from
   inside the MSan runtime. This does not generally work (as we may be built
   w/o frame pointers), and produces "bad" stack trace anyway, with several
   uninteresting (internal) frames on top.

This change also makes realloc() honor "zeroise" and "poison_in_malloc" flags.

See https://code.google.com/p/memory-sanitizer/issues/detail?id=73.

llvm-svn: 226674

9 years ago[msan] Refactor shadow operations.
Evgeniy Stepanov [Wed, 21 Jan 2015 16:42:30 +0000 (16:42 +0000)]
[msan] Refactor shadow operations.

Move a bunch of functions to a new source file and rename some of them for
consistency. No functional changes.

llvm-svn: 226673

9 years ago[lit] Format JSONMetricValue strings better.
Eric Fiselier [Wed, 21 Jan 2015 16:38:31 +0000 (16:38 +0000)]
[lit] Format JSONMetricValue strings better.

llvm-svn: 226672

9 years agoFixed a bug with how we determine bitset indices.
George Burgess IV [Wed, 21 Jan 2015 16:37:21 +0000 (16:37 +0000)]
Fixed a bug with how we determine bitset indices.

llvm-svn: 226671

9 years agoInitial support for C++ parameter completion
Francisco Lopes da Silva [Wed, 21 Jan 2015 16:24:11 +0000 (16:24 +0000)]
Initial support for C++ parameter completion

The improved completion in call context now works with:

 - Functions.
 - Member functions.
 - Constructors.
 - New expressions.
 - Function call expressions.
 - Template variants of the previous.

There are still rough edges to be fixed:

 - Provide support for optional parameters.         (fix known)
 - Provide support for member initializers.         (fix known)
 - Provide support for variadic template functions. (fix unknown)
 - Others?

llvm-svn: 226670

9 years agoAdd missing include guards to WindowsSupport.h.
Yaron Keren [Wed, 21 Jan 2015 16:20:38 +0000 (16:20 +0000)]
Add missing include guards to WindowsSupport.h.

llvm-svn: 226669

9 years agoDon't assume variable name.
Rafael Espindola [Wed, 21 Jan 2015 16:18:42 +0000 (16:18 +0000)]
Don't assume variable name.

Should fix the test in -Asserts builds.

llvm-svn: 226668

9 years agoMake the test a bit stricter. NFC.
Rafael Espindola [Wed, 21 Jan 2015 16:13:57 +0000 (16:13 +0000)]
Make the test a bit stricter. NFC.

llvm-svn: 226667

9 years agoMake the test a bit stricter. NFC.
Rafael Espindola [Wed, 21 Jan 2015 16:03:26 +0000 (16:03 +0000)]
Make the test a bit stricter. NFC.

llvm-svn: 226666

9 years agoRevert "DAGCombine: fold (or (and X, M), (and X, N)) -> (and X, (or M, N))"
Tim Northover [Wed, 21 Jan 2015 15:48:52 +0000 (15:48 +0000)]
Revert "DAGCombine: fold (or (and X, M), (and X, N)) -> (and X, (or M, N))"

It hadn't gone through review yet, but was still on my local copy.

This reverts commit r226663

llvm-svn: 226665

9 years agoAArch64: add backend option to reserve x18 (platform register)
Tim Northover [Wed, 21 Jan 2015 15:43:31 +0000 (15:43 +0000)]
AArch64: add backend option to reserve x18 (platform register)

AAPCS64 says that it's up to the platform to specify whether x18 is
reserved, and a first step on that way is to add a flag controlling
it.

From: Andrew Turner <andrew@fubar.geek.nz>
llvm-svn: 226664

9 years agoDAGCombine: fold (or (and X, M), (and X, N)) -> (and X, (or M, N))
Tim Northover [Wed, 21 Jan 2015 15:43:28 +0000 (15:43 +0000)]
DAGCombine: fold (or (and X, M), (and X, N)) -> (and X, (or M, N))

llvm-svn: 226663

9 years agoclang-format function. NFC.
Rafael Espindola [Wed, 21 Jan 2015 14:55:00 +0000 (14:55 +0000)]
clang-format function. NFC.

llvm-svn: 226662

9 years ago[x32] Fast ISel should use LEA64_32r instead of LEA32r to adjust addresses in x32...
Michael Kuperstein [Wed, 21 Jan 2015 14:44:05 +0000 (14:44 +0000)]
[x32] Fast ISel should use LEA64_32r instead of LEA32r to adjust addresses in x32 mode.

llvm-svn: 226661

9 years agoUse a smaller pragma unroll threshold to reduce test execution time.
Alexander Potapenko [Wed, 21 Jan 2015 13:52:02 +0000 (13:52 +0000)]
Use a smaller pragma unroll threshold to reduce test execution time.
When opt is compiled with AddressSanitizer it takes more than 30 seconds
to unroll the loop in unroll_1M().

llvm-svn: 226660

9 years agotsan: remove sleeps from tests
Dmitry Vyukov [Wed, 21 Jan 2015 13:50:02 +0000 (13:50 +0000)]
tsan: remove sleeps from tests

Even sleep(1) lead to episodical flakes on some machines.
Use an invisible by tsan barrier to enforce required execution order instead.
This makes the tests deterministic and faster.

llvm-svn: 226659

9 years ago[msan] Update origin for the entire destination range on memory store.
Evgeniy Stepanov [Wed, 21 Jan 2015 13:21:31 +0000 (13:21 +0000)]
[msan] Update origin for the entire destination range on memory store.

Previously we always stored 4 bytes of origin at the destination address
even for 8-byte (and longer) stores.

This should fix rare missing, or incorrect, origin stacks in MSan reports.

llvm-svn: 226658

9 years ago[mips][microMIPS] MicroMIPS 16-bit unconditional branch instruction B
Jozef Kolek [Wed, 21 Jan 2015 12:39:30 +0000 (12:39 +0000)]
[mips][microMIPS] MicroMIPS 16-bit unconditional branch instruction B

Implement microMIPS 16-bit unconditional branch instruction B.

Implemented 16-bit microMIPS unconditional instruction has real name B16, and
B is an alias which expands to either B16 or BEQ according to the rules:
b 256 --> b16 256 # R_MICROMIPS_PC10_S1
b 12256 --> beq $zero, $zero, 12256 # R_MICROMIPS_PC16_S1
b label --> beq $zero, $zero, label # R_MICROMIPS_PC16_S1

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

llvm-svn: 226657

9 years ago[mips][microMIPS] Implement ADDIUPC instruction
Jozef Kolek [Wed, 21 Jan 2015 12:10:11 +0000 (12:10 +0000)]
[mips][microMIPS] Implement ADDIUPC instruction

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

llvm-svn: 226656

9 years ago[PM] Refactor the InstCombiner interface to use an external worklist.
Chandler Carruth [Wed, 21 Jan 2015 11:38:17 +0000 (11:38 +0000)]
[PM] Refactor the InstCombiner interface to use an external worklist.

Because in its primary function pass the combiner is run repeatedly over
the same function until doing so produces no changes, it is essentially
to not re-allocate the worklist. However, as a utility, the more common
pattern would be to put a limited set of instructions in the worklist
rather than the entire function body. That is also the more likely
pattern when used by the new pass manager.

The result is a very light weight combiner that does the visiting with
a separable worklist. This can then be wrapped up in a helper function
for users that want a combiner utility, or as I have here it can be
wrapped up in a pass which manages the iterations used when combining an
entire function's instructions.

Hopefully this removes some of the worst of the interface warts that
became apparant with the last patch here. However, there is clearly more
work. I've again left some FIXMEs for the most egregious. The ones that
stick out to me are the exposure of the worklist and IR builder as
public members, and the use of pointers rather than references. However,
fixing these is likely to be much more mechanical and less interesting
so I didn't want to touch them in this patch.

llvm-svn: 226655

9 years ago[PM] Simplify (ha! ha!) the way that instcombine calls the
Chandler Carruth [Wed, 21 Jan 2015 11:23:40 +0000 (11:23 +0000)]
[PM] Simplify (ha! ha!) the way that instcombine calls the
SimplifyLibCalls utility by sinking it into the specific call part of
the combiner.

This will avoid us needing to do any contortions to build this object in
a subsequent refactoring I'm doing and seems generally better factored.
We don't need this utility everywhere and it carries no interesting
state so we might as well build it on demand.

llvm-svn: 226654

9 years agoAST: Don't ignore alignas on EnumDecls when calculating alignment
David Majnemer [Wed, 21 Jan 2015 10:54:38 +0000 (10:54 +0000)]
AST: Don't ignore alignas on EnumDecls when calculating alignment

We didn't consider any alignment attributes on an EnumDecl when
calculating alignment.

While we are here, ignore alignment specifications on typedef types if
one is used as the underlying type.  Otherwise, weird things happen:

enum Y : int;
Y y;

typedef int __attribute__((aligned(64))) u;
enum Y : u {};

What is the alignment of 'Y'?  It would be more consistent with the
overall design of enums with fixed underlying types to consider the
underlying type's UnqualifiedDesugaredType.

This fixes PR22279.

llvm-svn: 226653

9 years ago[Mips][Disassembler]When disassembler meets load/store from coprocessor 2 instruction...
Vladimir Medic [Wed, 21 Jan 2015 10:47:36 +0000 (10:47 +0000)]
[Mips][Disassembler]When disassembler meets load/store from coprocessor 2 instructions for mips r6 it crashes as the access to operands array is out of range. This patch adds dedicated decoder method that properly handles decoding of these instructions.

llvm-svn: 226652

9 years ago[ASan] Fix the test expectations for dyld_insert_libraries_reexec.cc
Alexander Potapenko [Wed, 21 Jan 2015 10:04:41 +0000 (10:04 +0000)]
[ASan] Fix the test expectations for dyld_insert_libraries_reexec.cc

llvm-svn: 226651

9 years ago[Msan] Fix the accept unit test to pass on FreeBSD
Viktor Kutuzov [Wed, 21 Jan 2015 09:46:21 +0000 (09:46 +0000)]
[Msan] Fix the accept unit test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D7083

llvm-svn: 226650

9 years ago[Sanitizers] Intercept confstr() on FreeBSD
Viktor Kutuzov [Wed, 21 Jan 2015 08:56:40 +0000 (08:56 +0000)]
[Sanitizers] Intercept confstr() on FreeBSD
Committed unreviewed with permission.

llvm-svn: 226649

9 years ago[Sanitizers] Intercept opendir()
Viktor Kutuzov [Wed, 21 Jan 2015 08:54:01 +0000 (08:54 +0000)]
[Sanitizers] Intercept opendir()
Differential Revision: http://reviews.llvm.org/D6968

llvm-svn: 226648