platform/upstream/llvm.git
9 years agoUpdate documentation for unroll pragmas on loops with runtime trip counts.
Mark Heffernan [Mon, 13 Jul 2015 18:31:37 +0000 (18:31 +0000)]
Update documentation for unroll pragmas on loops with runtime trip counts.

This change updates the documentation for the loop unrolling pragma behavior
change in r242047. Specifically, with that change "#pragma unroll" will not
unroll loops with a runtime trip count.

llvm-svn: 242048

9 years agoEnable runtime unrolling with unroll pragma metadata
Mark Heffernan [Mon, 13 Jul 2015 18:26:27 +0000 (18:26 +0000)]
Enable runtime unrolling with unroll pragma metadata

Enable runtime unrolling for loops with unroll count metadata ("#pragma unroll N")
and a runtime trip count. Also, do not unroll loops with unroll full metadata if the
loop has a runtime loop count. Previously, such loops would be unrolled with a
very large threshold (pragma-unroll-threshold) if runtime unrolled happened to be
enabled resulting in a very large (and likely unwise) unroll factor.

llvm-svn: 242047

9 years agoService the doxygen comments in DwarfUnit and DwarfDebug.
Adrian Prantl [Mon, 13 Jul 2015 18:25:29 +0000 (18:25 +0000)]
Service the doxygen comments in DwarfUnit and DwarfDebug.

llvm-svn: 242046

9 years agoMIR Serialization: Serialize the fixed stack objects.
Alex Lorenz [Mon, 13 Jul 2015 18:07:26 +0000 (18:07 +0000)]
MIR Serialization: Serialize the fixed stack objects.

This commit serializes the fixed stack objects, including fixed spill slots.
The fixed stack objects are serialized using a YAML sequence of YAML inline
mappings. Each mapping has the object's ID, type, size, offset, and alignment.
The objects that aren't spill slots also serialize the isImmutable and isAliased
flags.

The fixed stack objects are a part of the machine function's YAML mapping.

Reviewers: Duncan P. N. Exon Smith
llvm-svn: 242045

9 years ago[WinEH] Strip the \01 character from the __CxxFrameHandler3 thunk name
Reid Kleckner [Mon, 13 Jul 2015 17:55:14 +0000 (17:55 +0000)]
[WinEH] Strip the \01 character from the __CxxFrameHandler3 thunk name

Add another C++ 32-bit EH table test.

llvm-svn: 242044

9 years agofixed typo in debug assertion reported by John Mellor-Crummey
Andrey Churbanov [Mon, 13 Jul 2015 17:52:41 +0000 (17:52 +0000)]
fixed typo in debug assertion reported by John Mellor-Crummey

llvm-svn: 242043

9 years agoRemove macro guards for extern template instantiations.
Benjamin Kramer [Mon, 13 Jul 2015 17:21:31 +0000 (17:21 +0000)]
Remove macro guards for extern template instantiations.

This is a C++11 feature that both GCC and MSVC have supported as ane extension
long before C++11 was approved.

llvm-svn: 242042

9 years agoAvoid using Loop::getSubLoopsVector.
Benjamin Kramer [Mon, 13 Jul 2015 17:21:14 +0000 (17:21 +0000)]
Avoid using Loop::getSubLoopsVector.

Passes should never modify it, just use the const version. While there
reduce copying in LoopInterchange. No functional change intended.

llvm-svn: 242041

9 years agoFix handling of the 'n' asm constraint with invalid operands.
James Y Knight [Mon, 13 Jul 2015 16:36:22 +0000 (16:36 +0000)]
Fix handling of the 'n' asm constraint with invalid operands.

It had accidently accepted a symbol+offset value (and emitted
incorrect code for it, keeping only the offset part) instead of
properly reporting the constraint as invalid.

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

llvm-svn: 242040

9 years agoclang-format: Print token type name instead of number in -debug output
Birunthan Mohanathas [Mon, 13 Jul 2015 16:19:34 +0000 (16:19 +0000)]
clang-format: Print token type name instead of number in -debug output

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

llvm-svn: 242039

9 years agoAMDGPU/SI: Select mad patterns to v_mac_f32
Tom Stellard [Mon, 13 Jul 2015 15:47:57 +0000 (15:47 +0000)]
AMDGPU/SI: Select mad patterns to v_mac_f32

The two-address instruction pass will convert these back to v_mad_f32
if necessary.

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

llvm-svn: 242038

9 years agoARM: Fix cttz expansion on vector types.
Logan Chien [Mon, 13 Jul 2015 15:37:30 +0000 (15:37 +0000)]
ARM: Fix cttz expansion on vector types.

The 64/128-bit vector types are legal if NEON instructions are
available.  However, there was no matching patterns for @llvm.cttz.*()
intrinsics and result in fatal error.

This commit fixes the problem by lowering cttz to:
a. ctpop((x & -x) - 1)
b. width - ctlz(x & -x) - 1

llvm-svn: 242037

9 years ago[ARM] Handle commutativity when converting to tADDhirr in Thumb2
Scott Douglass [Mon, 13 Jul 2015 15:31:48 +0000 (15:31 +0000)]
[ARM] Handle commutativity when converting to tADDhirr in Thumb2

Also, run thumb_rewrite.s tests in Thumb2 now that they pass.

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

llvm-svn: 242036

9 years ago[ARM] Add Thumb2 ADD with SP narrowing from 3 operand to 2
Scott Douglass [Mon, 13 Jul 2015 15:31:40 +0000 (15:31 +0000)]
[ARM] Add Thumb2 ADD with SP narrowing from 3 operand to 2

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

llvm-svn: 242035

9 years ago[ARM] Small refactor of tryConvertingToTwoOperandForm (nfc)
Scott Douglass [Mon, 13 Jul 2015 15:31:33 +0000 (15:31 +0000)]
[ARM] Small refactor of tryConvertingToTwoOperandForm (nfc)

Also, add more Thumb2 ADD tests requested during review of
http://reviews.llvm.org/D11053.

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

llvm-svn: 242034

9 years agoCleanup after r241809 - remove uncessary call to std::sort
Silviu Baranga [Mon, 13 Jul 2015 14:48:24 +0000 (14:48 +0000)]
Cleanup after r241809 - remove uncessary call to std::sort

Summary:
The iteration order within a member of DepCands is deterministic
and therefore we don't have to sort the accesses within a member.
We also don't have to copy the indices of the pointers into a
vector, since we can iterate over the members of the class.

Subscribers: llvm-commits

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

llvm-svn: 242033

9 years agoRemove unused variable.
Rafael Espindola [Mon, 13 Jul 2015 14:43:33 +0000 (14:43 +0000)]
Remove unused variable.

Sorry I missed it in the previous commit.

llvm-svn: 242032

9 years agoAliases don't have available_externally linkage.
Rafael Espindola [Mon, 13 Jul 2015 14:39:02 +0000 (14:39 +0000)]
Aliases don't have available_externally linkage.

Allowing that is probably a good idea, but currently we don't, so
this is dead code.

llvm-svn: 242031

9 years agoDon't change the visibility when converting a definition to a declaration.
Rafael Espindola [Mon, 13 Jul 2015 14:18:22 +0000 (14:18 +0000)]
Don't change the visibility when converting a definition to a declaration.

llvm-svn: 242030

9 years agoSupport alternate attribute spelling __enable_if__
Ulrich Weigand [Mon, 13 Jul 2015 14:13:01 +0000 (14:13 +0000)]
Support alternate attribute spelling __enable_if__

Attribute names usually support an alternate spelling that uses double
underscores before and after the attribute name, like e.g. attribute
((__aligned__)) for attribute ((aligned)). This is necessary to allow
use of attributes in system headers without polluting the name space.

However, for attribute ((enable_if)) that alternate spelling does not
work correctly. This is because of code in Parser::ParseGNUAttributeArgs
(ParseDecl.cpp) that specifically checks for the "enable_if" spelling
without allowing the alternate spelling.

Similar code in ParseDecl.cpp uses the normalizeAttrName helper to allow
both spellings. This patch adds use of that helper for the "enable_if"
check as well, which fixes attribute ((__enable_if__)).

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

llvm-svn: 242029

9 years agoRemoving several -Wunused-but-set-variable warnings; NFC intended.
Aaron Ballman [Mon, 13 Jul 2015 14:04:30 +0000 (14:04 +0000)]
Removing several -Wunused-but-set-variable warnings; NFC intended.

llvm-svn: 242028

9 years agoPrint the visibility of available_externally functions.
Rafael Espindola [Mon, 13 Jul 2015 13:55:18 +0000 (13:55 +0000)]
Print the visibility of available_externally functions.

We were already printing it for declarations, but not available_externally.

llvm-svn: 242027

9 years agoRevert r241981 "Revert "Revert r236894 "[BasicAA] Fix zext & sext handling"""
Manuel Klimek [Mon, 13 Jul 2015 13:50:55 +0000 (13:50 +0000)]
Revert r241981 "Revert "Revert r236894 "[BasicAA] Fix zext & sext handling"""

The repros from PR23626 still fail.

llvm-svn: 242025

9 years agoAVX-512: Added all AVX-512 forms of Vector Convert for Float/Double/Int/Long types.
Elena Demikhovsky [Mon, 13 Jul 2015 13:26:20 +0000 (13:26 +0000)]
AVX-512: Added all AVX-512 forms of Vector Convert for Float/Double/Int/Long types.
In this patch I have only encoding. Intrinsics and DAG lowering will be in the next patch.
I temporary removed the old intrinsics test (just to split this patch).
Half types are not covered here.

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

llvm-svn: 242023

9 years agoAvoid dependency on uuid.h in MacOSXDYLD
Pavel Labath [Mon, 13 Jul 2015 12:27:28 +0000 (12:27 +0000)]
Avoid dependency on uuid.h in MacOSXDYLD

Summary:
r241964 has added a dependency on uuid.h, which (on linux at least) necessitates instalation of a
new package. Since the only thing we need from that file is uuid_t (and this is already defined
in UuidCompatibility.h), we can avoid this dependency by making this include __APPLE__ specific.
If in future, we need more from this library, we can revisit this decision.

Reviewers: jasonmolenda

Subscribers: lldb-commits

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

llvm-svn: 242022

9 years agoUpdate comment
Ulrich Weigand [Mon, 13 Jul 2015 11:52:14 +0000 (11:52 +0000)]
Update comment

As noticed by David Majnemer, update an out-of-date comment in
CGClass.cpp after the r241916 commit.

llvm-svn: 242021

9 years ago[llvm-stress] Remove unneeded llvm:: prefix. NFC.
Pawel Bylica [Mon, 13 Jul 2015 11:25:56 +0000 (11:25 +0000)]
[llvm-stress] Remove unneeded llvm:: prefix. NFC.

llvm-svn: 242020

9 years agoRemove hack about the size of long doubles from DataExtractor
Tamas Berghammer [Mon, 13 Jul 2015 10:50:55 +0000 (10:50 +0000)]
Remove hack about the size of long doubles from DataExtractor

The size of a long double was hardcoded in DataExtractor for x86 and
x86_64 architectures. This CL removes the hard coded values and use the
actual size based on the floating point semantics specified.

Differential revision: http://reviews.llvm.org/D8417

llvm-svn: 242019

9 years agoIntroduce a MainLoop class and switch llgs to use it
Pavel Labath [Mon, 13 Jul 2015 10:44:55 +0000 (10:44 +0000)]
Introduce a MainLoop class and switch llgs to use it

Summary:
This is the first part of our effort to make llgs single threaded. Currently, llgs consists of
about three threads and the synchronisation between them is a major source of latency when
debugging linux and android applications.

In order to be able to go single threaded, we must have the ability to listen for events from
multiple sources (primarily, client commands coming over the network and debug events from the
inferior) and perform necessary actions. For this reason I introduce the concept of a MainLoop.
A main loop has the ability to register callback's which will be invoked upon receipt of certain
events. MainLoopPosix has the ability to listen for file descriptors and signals.

For the moment, I have merely made the GDBRemoteCommunicationServerLLGS class use MainLoop
instead of waiting on the network socket directly, but the other threads still remain. In the
followup patches I indend to migrate NativeProcessLinux to this class and remove the remaining
threads.

Reviewers: ovyalov, clayborg, amccarth, zturner, emaste

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 242018

9 years agoSkip oatdata and oatexec symbols in system@framework@boot.oat
Tamas Berghammer [Mon, 13 Jul 2015 09:54:41 +0000 (09:54 +0000)]
Skip oatdata and oatexec symbols in system@framework@boot.oat

On Android the oatdata and the oatexec symbols in
system@framework@boot.oat covers the full .text section what causes
issues with displaying unusable symbol name to the user and very slow
unwinding speed because the instruction emulation based unwind plans
try to emulate all instructions in these symbols. Don't add these
symbols to the symbol list as they have no use for the debugger and
they are causing a lot of trouble.

Differential revision: http://reviews.llvm.org/D11065

llvm-svn: 242017

9 years ago[LLDB][MIPS] Add mips cores in cores_match () in ArchSpec
Sagar Thakur [Mon, 13 Jul 2015 09:52:06 +0000 (09:52 +0000)]
[LLDB][MIPS] Add mips cores in cores_match () in ArchSpec

    This patch:
        - Allows mips32 cores to match with any mips32/mips64 cores.
        - Allows mips32r2 cores to match with core only up-to mips32r2/mips64r2.
        - Allows mips32r3 cores to match with core only up-to mips32r3/mips64r3.
        - Allows mips32r5 cores to match with core only up-to mips32r3/mips64r5.
        - Allows mips32r6 core to match with only mips32r6/mips64r6 or mips32/mips64.

Reviewers: emaste, jaydeep, clayborg
Subscribers: mohit.bhakkad, nitesh.jain, bhushan, lldb-commits
Differential Revision: http://reviews.llvm.org/D10921

llvm-svn: 242016

9 years ago[mips] Explained the 'w' modifier in the Inline Assembler documentation.
Daniel Sanders [Mon, 13 Jul 2015 09:24:21 +0000 (09:24 +0000)]
[mips] Explained the 'w' modifier in the Inline Assembler documentation.

It exists for compatibility with GCC which requires it to print MSA registers
for the 'f' constraint. Although LLVM doesn't need it, the 'w' modifier should
still be used for portability between the two compilers.

llvm-svn: 242015

9 years ago[Mips] Support MIPS big-endian 32/64-bits targets
Simon Atanasyan [Mon, 13 Jul 2015 09:11:35 +0000 (09:11 +0000)]
[Mips] Support MIPS big-endian 32/64-bits targets

llvm-svn: 242014

9 years agoprofile: Autoconf build system support for r241824
Justin Bogner [Mon, 13 Jul 2015 06:39:53 +0000 (06:39 +0000)]
profile: Autoconf build system support for r241824

r241824 didn't update the autoconf build system to handle the new file
in the profile library.

llvm-svn: 242013

9 years agoSet the linkage before setting the visibility.
Rafael Espindola [Mon, 13 Jul 2015 06:07:58 +0000 (06:07 +0000)]
Set the linkage before setting the visibility.

Otherwise the visibility setting code would not know that a given
function was available_externally.

Fixes PR24097.

llvm-svn: 242012

9 years ago[LSR] don't attempt to promote ephemeral values to indvars
Jingyue Wu [Mon, 13 Jul 2015 03:28:53 +0000 (03:28 +0000)]
[LSR] don't attempt to promote ephemeral values to indvars

Summary:
This at least saves compile time. I also encountered a case where
ephemeral values affect whether other variables are promoted, causing
performance issues. It may be a bug in LSR, but I didn't manage to
reduce it yet. Anyhow, I believe it's in general not worth considering
ephemeral values in LSR.

Reviewers: atrick, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 242011

9 years agoIntrin.h: Don't invade the program's namespace
David Majnemer [Mon, 13 Jul 2015 02:53:23 +0000 (02:53 +0000)]
Intrin.h: Don't invade the program's namespace

The program is permitted to have stuff like '#define x' in it so avoid
using identifiers not reserved for the implementation.

llvm-svn: 242010

9 years agoIntrin.h: Clean up our atomic intrinsics
David Majnemer [Mon, 13 Jul 2015 02:53:19 +0000 (02:53 +0000)]
Intrin.h: Clean up our atomic intrinsics

Three things:
- The atomic intrinsics mandate memory barriers, let's start emitting
  some.
- We don't need to manually create RMW operations, we can just do
  __atomic_fetch_foo instead of performing __atomic_foo_fetch and
  undoing foo.
- Don't use inline assembly, we don't need it for these intrinsics.

This fixes PR24101.

llvm-svn: 242009

9 years ago[InstSimplify] Teach InstSimplify how to simplify extractelement
David Majnemer [Mon, 13 Jul 2015 01:15:53 +0000 (01:15 +0000)]
[InstSimplify] Teach InstSimplify how to simplify extractelement

llvm-svn: 242008

9 years ago[InstSimplify] Teach InstSimplify how to simplify extractvalue
David Majnemer [Mon, 13 Jul 2015 01:15:46 +0000 (01:15 +0000)]
[InstSimplify] Teach InstSimplify how to simplify extractvalue

llvm-svn: 242007

9 years agoMake COFF linker work when it's built by clang again.
Nico Weber [Mon, 13 Jul 2015 00:55:26 +0000 (00:55 +0000)]
Make COFF linker work when it's built by clang again.

clang-cl doesn't compile std::atomic_flag correctly (PR24101).  Since the COFF
linker doesn't use threads yet, just revert r241420 and r241481 for now to
work around this clang-cl bug.

llvm-svn: 242006

9 years agoFix clang/unittests/ASTMatchers/Dynamic/Makefile. clangDynamicASTMatchers should...
NAKAMURA Takumi [Mon, 13 Jul 2015 00:52:19 +0000 (00:52 +0000)]
Fix clang/unittests/ASTMatchers/Dynamic/Makefile. clangDynamicASTMatchers should be linked in advance of clangAST and clangASTMatchers.

llvm-svn: 242005

9 years agoFix lld tests with LLVM_ENABLE_THREADS disabled.
Nico Weber [Mon, 13 Jul 2015 00:51:43 +0000 (00:51 +0000)]
Fix lld tests with LLVM_ENABLE_THREADS disabled.

With LLVM_ENABLE_THREADS disabled, all the llvm code assumes that it runs on
a single thread and doesn't use any mutexes.  lld still spawned lots of threads
in that case and called into llvm, assuming that llvm is thread-safe.

As fix, let lld use only a single thread if LLVM_ENABLE_THREADS is disabled.
I left in all the mutexes in lld. That means lld is a bit slower than
necessary in single-thread mode, but that's probably worth the simpler code.

llvm-svn: 242004

9 years agosanitizer_common: Only use _ReadWriteBarrier when targeting MSVC cl.exe.
Peter Collingbourne [Mon, 13 Jul 2015 00:26:04 +0000 (00:26 +0000)]
sanitizer_common: Only use _ReadWriteBarrier when targeting MSVC cl.exe.

Fixes check-ubsan when self hosting on Windows.

llvm-svn: 242003

9 years agosanitizer_common: Fix implementation of bit count operations on 64-bit Windows.
Peter Collingbourne [Mon, 13 Jul 2015 00:26:03 +0000 (00:26 +0000)]
sanitizer_common: Fix implementation of bit count operations on 64-bit Windows.

llvm-svn: 242002

9 years agoMinor simplification, no functionality change.
Richard Smith [Sun, 12 Jul 2015 23:51:20 +0000 (23:51 +0000)]
Minor simplification, no functionality change.

llvm-svn: 242001

9 years ago[modules] Improve performance when there is a local declaration of an entity
Richard Smith [Sun, 12 Jul 2015 23:43:21 +0000 (23:43 +0000)]
[modules] Improve performance when there is a local declaration of an entity
before the first imported declaration.

We don't need to track all formerly-canonical declarations of an entity; it's sufficient to track those ones for which no other formerly-canonical declaration was imported into the same module. We call those ones "key declarations", and use them as our starting points for collecting redeclarations and performing namespace lookups.

llvm-svn: 241999

9 years ago[Sema] If lvalue to rvalue reference cast is valid don't emit diagnostic.
Davide Italiano [Sun, 12 Jul 2015 22:10:56 +0000 (22:10 +0000)]
[Sema] If lvalue to rvalue reference cast is valid don't emit diagnostic.

In the test, y1 is not reference compatible to y2 and we currently assume
the cast is ill-formed so we emit a diagnostic. Instead, in order to honour
the standard, if y1 it's not reference-compatible to y2 then it can't be
converted using a static_cast, and a reinterpret_cast should be tried instead.
Richard Smith provided the correct interpretation of the standard and
explanation about the subtle difference between "can't be cast" and "the cast
is ill-formed". The former applies in this case.

PR: 23802
llvm-svn: 241998

9 years agoFix PR24099 reported by Tomas Brukner.
Yaron Keren [Sun, 12 Jul 2015 20:40:41 +0000 (20:40 +0000)]
Fix PR24099 reported by Tomas Brukner.

llvm-svn: 241997

9 years ago[ARM] Add support for nest attribute using r12
Renato Golin [Sun, 12 Jul 2015 18:16:40 +0000 (18:16 +0000)]
[ARM] Add support for nest attribute using r12

Register r12 ('ip') is used by GCC for this purpose
and hence is used here. As discussed on the GCC mailing
list, the register choice is an ABI issue and so
choosing the same register as GCC means
__builtin_call_with_static_chain is compatible.

A similar patch has just gone in the AArch64 backend,
so this is just the ARM counterpart, following the same
discussion.

Patch by Stephen Cross.

llvm-svn: 241996

9 years ago[X86][SSE] Tidied up vector extend/truncation tests. NFCI.
Simon Pilgrim [Sun, 12 Jul 2015 17:40:49 +0000 (17:40 +0000)]
[X86][SSE] Tidied up vector extend/truncation tests. NFCI.

llvm-svn: 241995

9 years ago[X86][SSE] (V)PMINSB is commutable.
Simon Pilgrim [Sun, 12 Jul 2015 16:44:11 +0000 (16:44 +0000)]
[X86][SSE] (V)PMINSB is commutable.

(V)PMINSB is no different to the other (V)PMIN/(V)PMAX B/D/W instructions - it is fully commutable.

llvm-svn: 241994

9 years agoRemove include directive for the unused libunwind_ext.h.
Logan Chien [Sun, 12 Jul 2015 14:47:53 +0000 (14:47 +0000)]
Remove include directive for the unused libunwind_ext.h.

llvm-svn: 241993

9 years agoTweak libclang's users, c-arcmt-test, c-index-test and libclangTests to satisfy LDFLA...
NAKAMURA Takumi [Sun, 12 Jul 2015 12:17:55 +0000 (12:17 +0000)]
Tweak libclang's users, c-arcmt-test, c-index-test and libclangTests to satisfy LDFLAGS=-static.

llvm-svn: 241992

9 years agoReformat Makefile.
NAKAMURA Takumi [Sun, 12 Jul 2015 12:14:39 +0000 (12:14 +0000)]
Reformat Makefile.

llvm-svn: 241991

9 years agoTrim trailing whitespaces. NFC.
Simon Pilgrim [Sun, 12 Jul 2015 11:17:33 +0000 (11:17 +0000)]
Trim trailing whitespaces. NFC.

llvm-svn: 241990

9 years ago[X86][SSE] Vectorized v4i32 non-uniform shifts.
Simon Pilgrim [Sun, 12 Jul 2015 11:15:19 +0000 (11:15 +0000)]
[X86][SSE] Vectorized v4i32 non-uniform shifts.

While the v4i32 shl operation is already vectorized using a cvttps2dq/pmulld pattern, the lshr/ashr opeations are still scalarized.

This patch adds vectorization support for non-uniform v4i32 shift operations - it splats constant shift amounts to allow them to use the immediate sse shift instructions, or extracts/zero-extends non-constant shift amounts. The individual results are then blended together.

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

llvm-svn: 241989

9 years agoelf: Make error output from AtomSection<ELFT>::write() deterministic.
Nico Weber [Sun, 12 Jul 2015 04:45:35 +0000 (04:45 +0000)]
elf: Make error output from AtomSection<ELFT>::write() deterministic.

The function uses parallel_for() and then writes error messages from the
parallel loop's body.  This produces nondetermistic error messages.  Instead,
copy error messages to a vector and sort it by the atom's file offsets before
printing all error messages after the parallel_for().  This results in a few
string copies, but only in the error case.  (And passing tests seem more
important than performance.)

This makes tests elf/AArch64/rel-prel16-overflow.test and
elf/AArch64/rel-prel32-overflow.test pass on Windows: Both tests check that
atom error messages are emitted in a certain order, and on Windows they
happened to be emitted in a different order before this patch.

llvm-svn: 241988

9 years ago[LICM] Don't try to sink values out of loops without any exits
David Majnemer [Sun, 12 Jul 2015 03:53:05 +0000 (03:53 +0000)]
[LICM] Don't try to sink values out of loops without any exits

There is no suitable basic block to sink instructions in loops without
exits.  The only way an instruction in a loop without exits can be used
is as an incoming value to a PHI.  In such cases, the incoming block for
the corresponding value is unreachable.

This fixes PR24013.

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

llvm-svn: 241987

9 years agoclang-format: Add Mozilla brace breaking style
Birunthan Mohanathas [Sun, 12 Jul 2015 03:13:54 +0000 (03:13 +0000)]
clang-format: Add Mozilla brace breaking style

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

llvm-svn: 241986

9 years ago[PowerPC] Make use of the TargetRecip system
Hal Finkel [Sun, 12 Jul 2015 02:33:57 +0000 (02:33 +0000)]
[PowerPC] Make use of the TargetRecip system

r238842 added the TargetRecip system for controlling use of reciprocal
estimates for sqrt and division using a set of parameters that can be set by
the frontend. Clang now supports a sophisticated -mrecip option, and this will
allow that option to effectively control the relevant code-generation
functionality of the PPC backend.

llvm-svn: 241985

9 years ago[PowerPC] Support the nest parameter attribute
Hal Finkel [Sun, 12 Jul 2015 00:37:44 +0000 (00:37 +0000)]
[PowerPC] Support the nest parameter attribute

This adds support for the 'nest' attribute, which allows the static chain
register to be set for functions calls under non-Darwin PPC/PPC64 targets. r11
is the chain register (which the PPC64 ELF ABI calls the "environment
pointer"). For indirect calls under PPC64 ELFv1, this would normally be loaded
from the function descriptor, but providing an explicit 'nest' parameter will
override that process and use the value provided.

This allows __builtin_call_with_static_chain to work as expected on PowerPC.

llvm-svn: 241984

9 years agoRevert "[ExecutionEngine] Use std::function rather than a function pointer for the...
Renato Golin [Sat, 11 Jul 2015 13:42:48 +0000 (13:42 +0000)]
Revert "[ExecutionEngine] Use std::function rather than a function pointer for the LazyFunctionCreator."

This reverts commit r241962, as it was breaking all ARM buildbots.

It also reverts the two subsequent related commits:

r241974: "[ExecutionEngine] Add a static cast to the unittest for r241962 to suppress a warning."

r241973: "[ExecutionEngine] Remove cruft and fix a couple of warnings in the test case for r241962."
llvm-svn: 241983

9 years agoRevert "Revert r236894 "[BasicAA] Fix zext & sext handling""
Hal Finkel [Sat, 11 Jul 2015 11:04:54 +0000 (11:04 +0000)]
Revert "Revert r236894 "[BasicAA] Fix zext & sext handling""

r236894 caused PR23626 (Clang miscompiles webkit's base64 decoder), and was
reverted in r237984. This reapplies the patch with an additional test case for
PR23626 and the associated fix (both scales and offsets in the
BasicAliasAnalysis::constantOffsetHeuristic should initially be zero).

Patch by Nick White, thanks!

llvm-svn: 241981

9 years agoMove getStrideFromPointer and friends from LoopVectorize to VectorUtils
Hal Finkel [Sat, 11 Jul 2015 10:52:42 +0000 (10:52 +0000)]
Move getStrideFromPointer and friends from LoopVectorize to VectorUtils

The following functions are moved from the LoopVectorizer to VectorUtils:

  - getGEPInductionOperand
  - stripGetElementPtr
  - getUniqueCastUse
  - getStrideFromPointer

These used to be static functions in LoopVectorize, but will also be used by
the upcoming loop versioning LICM transformation.

Patch by Ashutosh Nema!

llvm-svn: 241980

9 years agoAdd argmemonly attribute.
Igor Laevsky [Sat, 11 Jul 2015 10:30:36 +0000 (10:30 +0000)]
Add argmemonly attribute.

This change adds new attribute called "argmemonly". Function marked with this attribute can only access memory through it's argument pointers. This attribute directly corresponds to the "OnlyAccessesArgumentPointees" ModRef behaviour in alias analysis.

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

llvm-svn: 241979

9 years agoFix include guard typo introduced in r239315.
Yaron Keren [Sat, 11 Jul 2015 09:40:28 +0000 (09:40 +0000)]
Fix include guard typo introduced in r239315.

llvm-svn: 241978

9 years agoDefine a new intrinsic @llvm.canonicalize.
Owen Anderson [Sat, 11 Jul 2015 07:01:27 +0000 (07:01 +0000)]
Define a new intrinsic @llvm.canonicalize.

This is used the canonicalize floating point values, which is useful for
implementing certain numeric primitives.  See the LangRef changes for
the full details of its semantics.

llvm-svn: 241977

9 years agoclang-format: Extend vim integration so that a line range can be passed in.
Daniel Jasper [Sat, 11 Jul 2015 06:46:26 +0000 (06:46 +0000)]
clang-format: Extend vim integration so that a line range can be passed in.

llvm-svn: 241976

9 years ago[PM/AA] Completely remove the AliasAnalysis::copyValue interface.
Chandler Carruth [Sat, 11 Jul 2015 04:39:00 +0000 (04:39 +0000)]
[PM/AA] Completely remove the AliasAnalysis::copyValue interface.

No in-tree alias analysis used this facility, and it was not called in
any particularly rigorous way, so it seems unlikely to be correct.

Note that one of the only stateful AA implementations in-tree,
GlobalsModRef is completely broken currently (and any AA passes like it
are equally broken) because Module AA passes are not effectively
invalidated when a function pass that fails to update the AA stack runs.

Ultimately, it doesn't seem like we know how we want to build stateful
AA, and until then trying to support and maintain correctness for an
untested API is essentially impossible. To that end, I'm planning to rip
out all of the update API. It can return if and when we need it and know
how to build it on top of the new pass manager and as part of *tested*
stateful AA implementations in the tree.

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

llvm-svn: 241975

9 years ago[ExecutionEngine] Add a static cast to the unittest for r241962 to suppress a
Lang Hames [Sat, 11 Jul 2015 02:07:28 +0000 (02:07 +0000)]
[ExecutionEngine] Add a static cast to the unittest for r241962 to suppress a
warning.

llvm-svn: 241974

9 years ago[ExecutionEngine] Remove cruft and fix a couple of warnings in the test case for
Lang Hames [Sat, 11 Jul 2015 01:59:04 +0000 (01:59 +0000)]
[ExecutionEngine] Remove cruft and fix a couple of warnings in the test case for
r241962.

llvm-svn: 241973

9 years agoRenamed some uses of unroll to interleave in the vectorizer.
Tyler Nowicki [Sat, 11 Jul 2015 00:31:11 +0000 (00:31 +0000)]
Renamed some uses of unroll to interleave in the vectorizer.

llvm-svn: 241971

9 years agoMC: Shrink MCDwarfLoc/MCLineEntry
Duncan P. N. Exon Smith [Fri, 10 Jul 2015 23:55:34 +0000 (23:55 +0000)]
MC: Shrink MCDwarfLoc/MCLineEntry

Drop 8 bytes off of `MCDwarfLoc` by restricting the `Isa`, `Column`, and
`Flags` members to appropriate sizes (from `DWARFDebugLine::Row`).
Saves a little over 0.5% off the heap of llc with no real functionality
change.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

llvm-svn: 241970

9 years agoClean up the comments in DIBuilder.h to adhere to the coding standards
Adrian Prantl [Fri, 10 Jul 2015 23:31:08 +0000 (23:31 +0000)]
Clean up the comments in DIBuilder.h to adhere to the coding standards
a little more.

llvm-svn: 241969

9 years agoRevert "Clean up the comments in DIBuilder.h to adhere to the coding standards"
Adrian Prantl [Fri, 10 Jul 2015 23:31:05 +0000 (23:31 +0000)]
Revert "Clean up the comments in DIBuilder.h to adhere to the coding standards"

This reverts commit 241965. (I accidentally committed too much).

llvm-svn: 241968

9 years ago[libcxx] LWG2420 bits for bind<void> - Patch from K-Ballo
Eric Fiselier [Fri, 10 Jul 2015 23:29:18 +0000 (23:29 +0000)]
[libcxx] LWG2420 bits for bind<void> - Patch from K-Ballo

Implemented LWG2420 bits for bind<void>

Review: http://reviews.llvm.org/D10997
llvm-svn: 241967

9 years agoCleanup a couple of comments in DIBuilder.cpp
Adrian Prantl [Fri, 10 Jul 2015 23:26:02 +0000 (23:26 +0000)]
Cleanup a couple of comments in DIBuilder.cpp

llvm-svn: 241966

9 years agoClean up the comments in DIBuilder.h to adhere to the coding standards
Adrian Prantl [Fri, 10 Jul 2015 23:25:54 +0000 (23:25 +0000)]
Clean up the comments in DIBuilder.h to adhere to the coding standards
a little more.

llvm-svn: 241965

9 years agoAdd a another packet to the gdb-remote protocol,
Jason Molenda [Fri, 10 Jul 2015 23:15:22 +0000 (23:15 +0000)]
Add a another packet to the gdb-remote protocol,
jGetLoadedDynamicLibrariesInfos.  This packet is similar to
qXfer:libraries:read except that lldb supplies the number of solibs
that should be reported about, and the start address for the list
of them.  At the initial process launch we'll read the full list
of solibs linked by the process -- at this point we could be using
qXfer:libraries:read -- but on subsequence solib-loaded notifications,
we'll be fetching a smaller number of solibs, often only one or two.

A typical Mac/iOS GUI app may have a couple hundred different
solibs loaded  - doing all of the loads via memory reads takes
a couple of megabytes of traffic between lldb and debugserver.
Having debugserver summarize the load addresses of all the solibs
and sending it in JSON requires a couple of hundred kilobytes
of traffic.  It's a significant performance improvement when
communicating over a slower channel.

This patch leaves all of the logic for loading the libraries
in DynamicLoaderMacOSXDYLD -- it only call over ot ProcesGDBRemote
to get the JSON result.

If the jGetLoadedDynamicLibrariesInfos packet is not implemented,
the normal technique of using memory read packets to get all of
the details from the target will be used.

<rdar://problem/21007465>

llvm-svn: 241964

9 years agoSema: Allow null names to be passed in to isAcceptableTagRedeclaration
Justin Bogner [Fri, 10 Jul 2015 23:05:47 +0000 (23:05 +0000)]
Sema: Allow null names to be passed in to isAcceptableTagRedeclaration

It's possible for TagRedeclarations to involve decls without a name,
ie, anonymous enums. We hit some undefined behaviour if we bind these
null names to the reference here.

We never dereference the name, so it's harmless if it's null - make it
a pointer to allow that.

Fixes the Modules/submodules-merge-defs.cpp test under ubsan.

llvm-svn: 241963

9 years ago[ExecutionEngine] Use std::function rather than a function pointer for the
Lang Hames [Fri, 10 Jul 2015 22:56:47 +0000 (22:56 +0000)]
[ExecutionEngine] Use std::function rather than a function pointer for the
LazyFunctionCreator.

Patch by Pierre-Andre Saulais. Thanks Pierre!

llvm-svn: 241962

9 years agoMC: Only allow changing feature bits in MCSubtargetInfo
Duncan P. N. Exon Smith [Fri, 10 Jul 2015 22:52:15 +0000 (22:52 +0000)]
MC: Only allow changing feature bits in MCSubtargetInfo

Disallow all mutation of `MCSubtargetInfo` expect the feature bits.

Besides deleting the assignment operators -- which were dead "code" --
this restricts `InitMCProcessorInfo()` to subclass initialization
sequences, and exposes a new more limited function called
`setDefaultFeatures()` for use by the ARMAsmParser `.cpu` directive.

There's a small functional change here: ARMAsmParser used to adjust
`MCSubtargetInfo::CPUSchedModel` as a side effect of calling
`InitMCProcessorInfo()`, but I've removed that suspicious behaviour.
Since the AsmParser shouldn't be doing any scheduling, there shouldn't
be any observable change...

llvm-svn: 241961

9 years agoAMDGPU: Fix chains for memory ops dependent on argument loads
Matt Arsenault [Fri, 10 Jul 2015 22:51:36 +0000 (22:51 +0000)]
AMDGPU: Fix chains for memory ops dependent on argument loads

Most loads and stores are derived from pointers derived from
a kernel argument load inserted during argument lowering.
This was just using the EntryToken chain for the argument loads,
and any users of these loads were also on the EntryToken chain.

Return the chain of the lowered argument load so that dependent loads
end up on the correct chain.

No test since I'm not aware of any case where this actually
broke.

llvm-svn: 241960

9 years agoMIR Serialization: Serialize the virtual register operands.
Alex Lorenz [Fri, 10 Jul 2015 22:51:20 +0000 (22:51 +0000)]
MIR Serialization: Serialize the virtual register operands.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 241959

9 years ago[IR] Switch static const to an enum to silence MSVC linker warnings
David Majnemer [Fri, 10 Jul 2015 22:46:02 +0000 (22:46 +0000)]
[IR] Switch static const to an enum to silence MSVC linker warnings

Integral class statics are handled oddly in MSVC, we don't need them
in this case, use an enum instead.

llvm-svn: 241958

9 years agoMC: Remove MCSubtargetInfo() default constructor
Duncan P. N. Exon Smith [Fri, 10 Jul 2015 22:43:42 +0000 (22:43 +0000)]
MC: Remove MCSubtargetInfo() default constructor

Force all creators of `MCSubtargetInfo` to immediately initialize it,
merging the default constructor and the initializer into an initializing
constructor.  Besides cleaning up the code a little, this makes it clear
that the initializer is never called again later.

Out-of-tree backends need a trivial change: instead of calling:

    auto *X = new MCSubtargetInfo();
    InitXYZMCSubtargetInfo(X, ...);
    return X;

they should call:

    return createXYZMCSubtargetInfoImpl(...);

There's no real functionality change here.

llvm-svn: 241957

9 years agoMC: Remove MCSubtargetInfo::InitCPUSched()
Duncan P. N. Exon Smith [Fri, 10 Jul 2015 22:33:01 +0000 (22:33 +0000)]
MC: Remove MCSubtargetInfo::InitCPUSched()

Remove all calls to `MCSubtargetInfo::InitCPUSched()` and merge its body
into the only relevant caller, `MCSubtargetInfo::InitMCProcessorInfo()`.
We were only calling the former after explicitly calling the latter with
the same CPU; it's confusing to have both methods exposed.

Besides a minor (surely unmeasurable) speedup in ARM and X86 from
avoiding running the logic twice, no functionality change.

llvm-svn: 241956

9 years ago[InstCombine] Actually combine AA metadata when replacing one load with another
Bjorn Steinbrink [Fri, 10 Jul 2015 22:30:17 +0000 (22:30 +0000)]
[InstCombine] Actually combine AA metadata when replacing one load with another

Fixes PR24083

llvm-svn: 241955

9 years agoAMDGPU: Use requested chain when lowering arguments
Matt Arsenault [Fri, 10 Jul 2015 22:28:41 +0000 (22:28 +0000)]
AMDGPU: Use requested chain when lowering arguments

No test since I'm not aware of any case where this will
end up being a different chain.

llvm-svn: 241954

9 years ago[modules] When checking the include guard for a header, check whether it's
Richard Smith [Fri, 10 Jul 2015 22:27:17 +0000 (22:27 +0000)]
[modules] When checking the include guard for a header, check whether it's
visible in the module we're considering entering. Previously we assumed that if
we knew the include guard for a modular header, we'd already parsed it, but
that need not be the case if a header is present in the current module and one
of its dependencies; the result of getting this wrong was that the current
module's submodule for the header would end up empty.

llvm-svn: 241953

9 years agoDisable C++ EH by default for clang-cl and MSVC environments
Reid Kleckner [Fri, 10 Jul 2015 22:25:44 +0000 (22:25 +0000)]
Disable C++ EH by default for clang-cl and MSVC environments

We don't need any more bug reports from users telling us that MSVC-style
C++ exceptions are broken. Developers and adventurous users can still
test the existing functionality by passing along -fexceptions to either
clang or clang-cl.

llvm-svn: 241952

9 years agoARM: Use SpecificBumpPtrAllocator to fix leak introduced in r241920
Matthias Braun [Fri, 10 Jul 2015 22:23:57 +0000 (22:23 +0000)]
ARM: Use SpecificBumpPtrAllocator to fix leak introduced in r241920

llvm-svn: 241951

9 years ago[SEH] Push reloads of the SEH code past phi nodes
Reid Kleckner [Fri, 10 Jul 2015 22:21:54 +0000 (22:21 +0000)]
[SEH] Push reloads of the SEH code past phi nodes

This in turn would sometimes introduce new cleanupblocks that didn't
previously exist. The uses were being introduced by SSA value demotion.
We actually want to *promote* uses of EH pointers and selectors, so I
added some spcecial casing to avoid demoting such instructions.  This is
getting overly complicated, but hopefully we'll come along and delete it
in the new representation.

llvm-svn: 241950

9 years agoAdd <type_traits> for is_pod, fixing r241947
Duncan P. N. Exon Smith [Fri, 10 Jul 2015 22:17:49 +0000 (22:17 +0000)]
Add <type_traits> for is_pod, fixing r241947

llvm-svn: 241949

9 years agoDAGCombiner: Assume invariant load cannot alias a store
Matt Arsenault [Fri, 10 Jul 2015 22:17:40 +0000 (22:17 +0000)]
DAGCombiner: Assume invariant load cannot alias a store

The motivation is to allow GatherAllAliases / FindBetterChain
to not give up on dependent loads of a pointer from constant memory.

This is important for AMDGPU, because most loads are pointers
derived from a load of a kernel argument from constant memory.

llvm-svn: 241948

9 years agoMC: Remove the copy of MCSchedModel in MCSubtargetInfo
Duncan P. N. Exon Smith [Fri, 10 Jul 2015 22:13:43 +0000 (22:13 +0000)]
MC: Remove the copy of MCSchedModel in MCSubtargetInfo

`MCSchedModel` is large.  Make `MCSchedModel::GetDefaultSchedModel()`
return by-reference instead of by-value, so we can store a pointer in
`MCSubtargetInfo::CPUSchedModel` instead of a copy.

Note: since `MCSchedModel` is POD, this doesn't create a static
constructor.

llvm-svn: 241947

9 years ago[ShrinkWrap][PEI] Do not insert epilogue for unreachable blocks.
Quentin Colombet [Fri, 10 Jul 2015 22:09:55 +0000 (22:09 +0000)]
[ShrinkWrap][PEI] Do not insert epilogue for unreachable blocks.

Although this is not incorrect to insert such code, it is useless
and it hurts the binary size.

llvm-svn: 241946

9 years ago[MC] Switch static const to an enum to silence MSVC linker warnings
David Majnemer [Fri, 10 Jul 2015 21:50:04 +0000 (21:50 +0000)]
[MC] Switch static const to an enum to silence MSVC linker warnings

Integral class statics are handled oddly in MSVC, we don't need them in
this case, use an enum instead.

llvm-svn: 241945

9 years ago[analyzer] When forced to fake a block type, do it correctly.
Jordan Rose [Fri, 10 Jul 2015 21:41:59 +0000 (21:41 +0000)]
[analyzer] When forced to fake a block type, do it correctly.

BlockDecl has a poor AST representation because it doesn't carry its type
with it. Instead, the containing BlockExpr has the full type. This almost
never matters for the analyzer, but if the block decl contains static
local variables we need to synthesize a region to put them in, and this
region will necessarily not have the right type.

Even /that/ doesn't matter, unless

(1) the block calls the function or method containing the block, and
(2) the value of the block expr is used in some interesting way.

In this case, we actually end up needing the type of the block region,
and it will be set to our synthesized type. It turns out we've been doing
a terrible job faking that type -- it wasn't a block pointer type at all.
This commit fixes that to at least guarantee a block pointer type, using
the signature written by the user if there is one.

This is not really a correct answer because the block region's type will
/still/ be wrong, but further efforts to make this right in the analyzer
would probably be silly. We should just change the AST.

rdar://problem/21698099

llvm-svn: 241944