platform/upstream/llvm.git
7 years agoFix TestHelp on linux after version number syntax change
Tamas Berghammer [Fri, 11 Nov 2016 11:39:23 +0000 (11:39 +0000)]
Fix TestHelp on linux after version number syntax change

llvm-svn: 286581

7 years ago[ELF] Convert .got section to input section
Eugene Leviant [Fri, 11 Nov 2016 11:33:32 +0000 (11:33 +0000)]
[ELF] Convert .got section to input section

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

llvm-svn: 286580

7 years ago[X86] Add knownbits vector BSWAP test
Simon Pilgrim [Fri, 11 Nov 2016 11:33:21 +0000 (11:33 +0000)]
[X86] Add knownbits vector BSWAP test

In preparation for demandedelts support

llvm-svn: 286579

7 years ago[SelectionDAG] Add support for vector demandedelts in UREM/SREM opcodes
Simon Pilgrim [Fri, 11 Nov 2016 11:23:43 +0000 (11:23 +0000)]
[SelectionDAG] Add support for vector demandedelts in UREM/SREM opcodes

llvm-svn: 286578

7 years ago[X86] Add knownbits vector UREM/SREM tests
Simon Pilgrim [Fri, 11 Nov 2016 11:11:40 +0000 (11:11 +0000)]
[X86] Add knownbits vector UREM/SREM tests

In preparation for demandedelts support

llvm-svn: 286577

7 years ago[SelectionDAG] Add support for vector demandedelts in UDIV opcodes
Simon Pilgrim [Fri, 11 Nov 2016 10:47:24 +0000 (10:47 +0000)]
[SelectionDAG] Add support for vector demandedelts in UDIV opcodes

llvm-svn: 286576

7 years ago[X86] Add knownbits vector UDIV test
Simon Pilgrim [Fri, 11 Nov 2016 10:39:15 +0000 (10:39 +0000)]
[X86] Add knownbits vector UDIV test

In preparation for demandedelts support

llvm-svn: 286575

7 years agoMark xfail TestNamespaceDefinitions for arm/aarch64 targets
Omair Javaid [Fri, 11 Nov 2016 10:00:53 +0000 (10:00 +0000)]
Mark xfail TestNamespaceDefinitions for arm/aarch64 targets

Fails with all versions of arm/aarch64 gcc available on ubuntu 16.04/14.04.

Passes with Linaro GCC version >= 4.8 but fails with >= 5.0. But There are other regressions when we use Linaro GCC.

llvm-svn: 286574

7 years ago[ARM] Add plumbing for GlobalISel
Diana Picus [Fri, 11 Nov 2016 08:27:37 +0000 (08:27 +0000)]
[ARM] Add plumbing for GlobalISel

Add GlobalISel skeleton, up to the point where we can select a ret void.

llvm-svn: 286573

7 years ago[opt-viewer] Make it work in the absence of hotness information
Adam Nemet [Fri, 11 Nov 2016 06:11:56 +0000 (06:11 +0000)]
[opt-viewer] Make it work in the absence of hotness information

In this case the index page is sorted by the source location.

llvm-svn: 286572

7 years agoFix gold plugin after Error API changes
Mehdi Amini [Fri, 11 Nov 2016 06:04:30 +0000 (06:04 +0000)]
Fix gold plugin after Error API changes

llvm-svn: 286571

7 years agoFix examples files to reflect header split in r286566.
Teresa Johnson [Fri, 11 Nov 2016 06:02:04 +0000 (06:02 +0000)]
Fix examples files to reflect header split in r286566.

I missed these files in examples/

llvm-svn: 286570

7 years agoAdd missing file from r286566
Teresa Johnson [Fri, 11 Nov 2016 05:46:30 +0000 (05:46 +0000)]
Add missing file from r286566

Add the new BitcodeWriter.h header, which was missed in my r286566
commit, and should fix all the bot failures.

llvm-svn: 286569

7 years agoMirror the llvm changes that split Bitcode/ReaderWriter.h
Teresa Johnson [Fri, 11 Nov 2016 05:35:22 +0000 (05:35 +0000)]
Mirror the llvm changes that split Bitcode/ReaderWriter.h

The change in D26502 splits ReaderWriter.h, which contains the APIs
into both the BitReader and BitWriter libraries, into BitcodeReader.h
and BitcodeWriter.h.

Change lld uses to the appropriate split header, removing it
completely in one case where it wasn't needed.

llvm-svn: 286568

7 years agoMirror the llvm changes that split Bitcode/ReaderWriter.h
Teresa Johnson [Fri, 11 Nov 2016 05:35:12 +0000 (05:35 +0000)]
Mirror the llvm changes that split Bitcode/ReaderWriter.h

The change in D26502 splits ReaderWriter.h, which contains the APIs
into both the BitReader and BitWriter libraries, into BitcodeReader.h
and BitcodeWriter.h.

Change clang uses to the appropriate split header(s).

llvm-svn: 286567

7 years agoSplit Bitcode/ReaderWriter.h into separate reader and writer headers
Teresa Johnson [Fri, 11 Nov 2016 05:34:58 +0000 (05:34 +0000)]
Split Bitcode/ReaderWriter.h into separate reader and writer headers

Summary:
Split ReaderWriter.h which contains the APIs into both the BitReader and
BitWriter libraries into BitcodeReader.h and BitcodeWriter.h.

This is to address Chandler's concern about sharing the same API header
between multiple libraries (BitReader and BitWriter). That concern is
why we create a single bitcode library in our downstream build of clang,
which led to r286297 being reverted as it added a dependency that
created a cycle only when there is a single bitcode library (not two as
in upstream).

Reviewers: mehdi_amini

Subscribers: dlj, mehdi_amini, llvm-commits

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

llvm-svn: 286566

7 years agoRevert unwanted changes in lldb when updating llvm::Error()
Mehdi Amini [Fri, 11 Nov 2016 05:07:57 +0000 (05:07 +0000)]
Revert unwanted changes in lldb when updating llvm::Error()

My script updated lldb::Errors, and I failed to fix it entirely
before pushing. This restore everything in lldb as it was before
r286561.

llvm-svn: 286565

7 years ago[opt-viewer] PEPify opt-viewer.py
Mandeep Singh Grang [Fri, 11 Nov 2016 04:51:27 +0000 (04:51 +0000)]
[opt-viewer] PEPify opt-viewer.py

Reviewers: anemet

Subscribers: fhahn

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

llvm-svn: 286564

7 years agoFix build failure, update llvm-strings for the new Error API
Mehdi Amini [Fri, 11 Nov 2016 04:50:18 +0000 (04:50 +0000)]
Fix build failure, update llvm-strings for the new Error API

llvm-svn: 286563

7 years agoPrevent at compile time converting from Error::success() to Expected<T>
Mehdi Amini [Fri, 11 Nov 2016 04:29:25 +0000 (04:29 +0000)]
Prevent at compile time converting from Error::success() to Expected<T>

This would trigger an assertion at runtime otherwise.

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

llvm-svn: 286562

7 years agoMake the Error class constructor protected
Mehdi Amini [Fri, 11 Nov 2016 04:28:40 +0000 (04:28 +0000)]
Make the Error class constructor protected

This is forcing to use Error::success(), which is in a wide majority
of cases a lot more readable.

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

llvm-svn: 286561

7 years agoCMake: make LLVM_OPTIMIZED_TABLEGEN friendly with LLVM_EXTERNAL_CLANG_SOURCE_DIR
Mehdi Amini [Fri, 11 Nov 2016 04:27:59 +0000 (04:27 +0000)]
CMake: make LLVM_OPTIMIZED_TABLEGEN friendly with LLVM_EXTERNAL_CLANG_SOURCE_DIR

This is need because of clang-tblgen

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

llvm-svn: 286560

7 years ago[ADT/MathExtras] Make buildbot happy again.
Davide Italiano [Fri, 11 Nov 2016 04:03:29 +0000 (04:03 +0000)]
[ADT/MathExtras] Make buildbot happy again.

llvm-svn: 286559

7 years agollvm-strings: explicitly include cctype
Saleem Abdulrasool [Fri, 11 Nov 2016 04:00:59 +0000 (04:00 +0000)]
llvm-strings: explicitly include cctype

Include the cctype header to try to fix windows bots.

llvm-svn: 286558

7 years agoRemove a member from InputSectionData and use the pool instead.
Rui Ueyama [Fri, 11 Nov 2016 03:54:59 +0000 (03:54 +0000)]
Remove a member from InputSectionData and use the pool instead.

llvm-svn: 286557

7 years agollvm-strings: introduce basic strings tool
Saleem Abdulrasool [Fri, 11 Nov 2016 03:44:12 +0000 (03:44 +0000)]
llvm-strings: introduce basic strings tool

This is a replacement to binutils' string tool.  It prints strings found in a
binary (object file, executable, or archive library).  It is rather bare and
not functionally equivalent, however, it lays the groundwork necessary for the
strings tool, enabling iterative development of features to reach feature
parity.

llvm-svn: 286556

7 years ago[lli] Simplify the code a bit. No functional change intended.
Davide Italiano [Fri, 11 Nov 2016 03:07:45 +0000 (03:07 +0000)]
[lli] Simplify the code a bit. No functional change intended.

llvm-svn: 286555

7 years ago[IR/DataLayout] Simplify the code using PowerOf2Ceil. NFCI.
Davide Italiano [Fri, 11 Nov 2016 03:00:00 +0000 (03:00 +0000)]
[IR/DataLayout] Simplify the code using PowerOf2Ceil. NFCI.

llvm-svn: 286554

7 years ago[lld/COFF] Don't round alignment if it's already a power-of-two.
Davide Italiano [Fri, 11 Nov 2016 02:53:48 +0000 (02:53 +0000)]
[lld/COFF] Don't round alignment if it's already a power-of-two.

This matches link.exe behaviour.

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

llvm-svn: 286553

7 years agoAMDGPU: Attempt to fix build failure on x86-64 selfhost build
Yaxun Liu [Fri, 11 Nov 2016 02:48:50 +0000 (02:48 +0000)]
AMDGPU: Attempt to fix build failure on x86-64 selfhost build

Remove redundant include file.

llvm-svn: 286552

7 years ago[ADT/MathExtras] Add tests for PowerOf2Floor (previously untested).
Davide Italiano [Fri, 11 Nov 2016 02:38:24 +0000 (02:38 +0000)]
[ADT/MathExtras] Add tests for PowerOf2Floor (previously untested).

llvm-svn: 286551

7 years agoAdd a blank line for a test commit.
Sean Fertile [Fri, 11 Nov 2016 02:33:17 +0000 (02:33 +0000)]
Add a blank line for a test commit.

llvm-svn: 286550

7 years ago[ADT/MathExtras] Introduce PowerOf2Ceil.
Davide Italiano [Fri, 11 Nov 2016 02:22:16 +0000 (02:22 +0000)]
[ADT/MathExtras] Introduce PowerOf2Ceil.

To be used in lld (and probably somewhere else in llvm).

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

llvm-svn: 286549

7 years agoCall flush() after llvm_shutdown().
Rui Ueyama [Fri, 11 Nov 2016 02:16:15 +0000 (02:16 +0000)]
Call flush() after llvm_shutdown().

llvm_shutdown could write something to outs or errs,
so we need to flush them after calling llvm_shutdown.

llvm-svn: 286548

7 years agoHandle Archive::children's error proerly.
Rui Ueyama [Fri, 11 Nov 2016 02:09:28 +0000 (02:09 +0000)]
Handle Archive::children's error proerly.

The previous code didn't make sense at all. Now an error condition
is handled with fatal(). Thanks to Mehdi for pointing out the issue.

llvm-svn: 286547

7 years ago[llvm] Remove duplicate header from PassInfo.h
Mandeep Singh Grang [Fri, 11 Nov 2016 02:01:32 +0000 (02:01 +0000)]
[llvm] Remove duplicate header from PassInfo.h

Reviewers: mehdi_amini

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

llvm-svn: 286546

7 years ago[opt-viewer] Add column number support
Adam Nemet [Fri, 11 Nov 2016 01:51:34 +0000 (01:51 +0000)]
[opt-viewer] Add column number support

With this the yellow (bubble) part of the remark shows up under the
corresponding expression.

llvm-svn: 286545

7 years agoScheduleDAGInstrs: Add condjump deps to addSchedBarrierDeps()
Matthias Braun [Fri, 11 Nov 2016 01:34:21 +0000 (01:34 +0000)]
ScheduleDAGInstrs: Add condjump deps to addSchedBarrierDeps()

addSchedBarrierDeps() is supposed to add use operands to the ExitSU
node. The current implementation adds uses for calls/barrier instruction
and the MBB live-outs in all other cases. The use
operands of conditional jump instructions were missed.

Also added code to macrofusion to set the latencies between nodes to
zero to avoid problems with the fusing nodes lingering around in the
pending list now.

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

llvm-svn: 286544

7 years agoDefine __ANDROID_API__ when specified as part of an Android target.
Stephen Hines [Fri, 11 Nov 2016 01:29:39 +0000 (01:29 +0000)]
Define __ANDROID_API__ when specified as part of an Android target.

Summary:
This macro should be defined only when the user directly specifies an
API level as part of an Android target. For any regular Android target,
we leave this macro undefined.

Bug: https://llvm.org/bugs/show_bug.cgi?id=30940

Reviewers: eugenis, pirama

Subscribers: tberghammer, cfe-commits, pirama, eugenis, danalbert

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

llvm-svn: 286543

7 years agoDon't require nullability on 'va_list', even when it's a pointer.
Jordan Rose [Fri, 11 Nov 2016 01:29:18 +0000 (01:29 +0000)]
Don't require nullability on 'va_list', even when it's a pointer.

Take 3! This should finally fix the Hexagon, PPC, and Windows bots.

rdar://problem/25846421

llvm-svn: 286542

7 years agoRevert "Speculative fix for va_list/nullability test on Hexagon and PPC."
Jordan Rose [Fri, 11 Nov 2016 01:29:15 +0000 (01:29 +0000)]
Revert "Speculative fix for va_list/nullability test on Hexagon and PPC."

This reverts commit r286533. At this point an array really is still an
array, but the problem is with /non-/array va_lists anyway.

llvm-svn: 286541

7 years ago[opt-viewer] Display inlining context
Adam Nemet [Fri, 11 Nov 2016 01:25:04 +0000 (01:25 +0000)]
[opt-viewer] Display inlining context

When a function is inlined, each instance is optimized in their own
inlining context.  This can produce different remarks all pointing to
the same source line.

This adds a new column on the source view to display the inlining
context.

llvm-svn: 286537

7 years ago[opt-viewer] Add option to set source directory
Adam Nemet [Fri, 11 Nov 2016 01:08:02 +0000 (01:08 +0000)]
[opt-viewer] Add option to set source directory

llvm-svn: 286536

7 years ago[opt-viewer] Mention Pygments in the description
Adam Nemet [Fri, 11 Nov 2016 01:08:00 +0000 (01:08 +0000)]
[opt-viewer] Mention Pygments in the description

llvm-svn: 286535

7 years agoPR30937: don't devirtualize if we find that the callee is a pure virtual
Richard Smith [Fri, 11 Nov 2016 01:01:31 +0000 (01:01 +0000)]
PR30937: don't devirtualize if we find that the callee is a pure virtual
function. In that case, there is no requirement that the callee is actually
defined, and the code may in fact be valid and have defined behavior if the
virtual call is unreachable.

llvm-svn: 286534

7 years agoSpeculative fix for va_list/nullability test on Hexagon and PPC.
Jordan Rose [Fri, 11 Nov 2016 00:55:14 +0000 (00:55 +0000)]
Speculative fix for va_list/nullability test on Hexagon and PPC.

PowerPC's va_list, at least, is a typedef for an array, which means it
decays to a pointer in parameter position. Since the decayed type is
built from the array element type, the typedef sugar is lost.

More rdar://problem/25846421.

llvm-svn: 286533

7 years ago[opt-viewer] Add syntax highlighting
Adam Nemet [Fri, 11 Nov 2016 00:51:32 +0000 (00:51 +0000)]
[opt-viewer] Add syntax highlighting

Uses pygments.

llvm-svn: 286532

7 years agoDon't require nullability on 'va_list' harder.
Jordan Rose [Fri, 11 Nov 2016 00:23:59 +0000 (00:23 +0000)]
Don't require nullability on 'va_list' harder.

Platform headers don't always define 'va_list' in terms of Clang's
'__builtin_va_list', so in addition to checking for our own
synthesized decl, also just look for typedefs literally named
'va_list'. Better to err on the side of false negatives here.

Fix-up for rdar://problem/25846421.

llvm-svn: 286531

7 years agoRevert "[AMDGPU] Allow hoisting of comparisons out of a loop and eliminate condition...
Stanislav Mekhanoshin [Fri, 11 Nov 2016 00:22:34 +0000 (00:22 +0000)]
Revert "[AMDGPU] Allow hoisting of comparisons out of a loop and eliminate condition copies"

This reverts commit r286171, it breaks piglit test fs-discard-exit-2

llvm-svn: 286530

7 years ago[ELF] Remove extra semicolon to placate GCC. NFCI.
Davide Italiano [Fri, 11 Nov 2016 00:05:41 +0000 (00:05 +0000)]
[ELF] Remove extra semicolon to placate GCC. NFCI.

llvm-svn: 286529

7 years ago[CMake] Fixing CMake to append source properties instead of overwrite them.
Chris Bieneman [Thu, 10 Nov 2016 23:56:32 +0000 (23:56 +0000)]
[CMake] Fixing CMake to append source properties instead of overwrite them.

This is a small fix to the version output.

llvm-svn: 286528

7 years agoFix requirements.
Joerg Sonnenberger [Thu, 10 Nov 2016 23:53:45 +0000 (23:53 +0000)]
Fix requirements.

llvm-svn: 286527

7 years agoScheduleDAGInstrs: Ignore dependencies of constant physregs
Matthias Braun [Thu, 10 Nov 2016 23:46:44 +0000 (23:46 +0000)]
ScheduleDAGInstrs: Ignore dependencies of constant physregs

There is no need to track dependencies for constant physregs, as they
don't change their value no matter in what order you read/write to them.

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

llvm-svn: 286526

7 years ago[Sema] Fix-up for MSVC, which is stricter about template types.
Jordan Rose [Thu, 10 Nov 2016 23:41:18 +0000 (23:41 +0000)]
[Sema] Fix-up for MSVC, which is stricter about template types.

llvm-svn: 286525

7 years agoTimer: Remove group-less NamedRegionTimer constructor.
Matthias Braun [Thu, 10 Nov 2016 23:36:44 +0000 (23:36 +0000)]
Timer: Remove group-less NamedRegionTimer constructor.

The NamedRegionTimer initializer without a group name puts the Timer
into the "Misc" group and is (nearly) unused. Remove it.

The only user of this constructor appears to be the HexagonGenInsert pass,
which creates a counter without group to count the complete execution
time of that pass, however since every pass gets a counter by the
PassManager anyway this should be unnecessary. Also removed the
pointless TimerGroup there.

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

llvm-svn: 286524

7 years ago[DAG Combiner] Fix the native computation of the Newton series for reciprocals
Evandro Menezes [Thu, 10 Nov 2016 23:31:06 +0000 (23:31 +0000)]
[DAG Combiner] Fix the native computation of the Newton series for reciprocals

The generic infrastructure to compute the Newton series for reciprocal and
reciprocal square root was conceived to allow a target to compute the series
itself.  However, the original code did not properly consider this condition
if returned by a target.  This patch addresses the issues to allow a target
to compute the series on its own.

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

llvm-svn: 286523

7 years agoDon't require nullability on 'va_list'.
Jordan Rose [Thu, 10 Nov 2016 23:28:34 +0000 (23:28 +0000)]
Don't require nullability on 'va_list'.

There are many non-portable typedefs, but va_list is one that nobody
ever thinks of as a pointer or an array. (When's the last time you saw
someone check for a NULL va_list?) Make an exception for this one
special type.

Part of rdar://problem/25846421.

llvm-svn: 286522

7 years agoWarn when 'assume_nonnull' infers nullability within an array.
Jordan Rose [Thu, 10 Nov 2016 23:28:30 +0000 (23:28 +0000)]
Warn when 'assume_nonnull' infers nullability within an array.

...or within a reference. Both of these add an extra level of
indirection that make us less certain that the pointer really was
supposed to be non-nullable. However, changing the default behavior
would be a breaking change, so we'll just make it a warning instead.

Part of rdar://problem/25846421

llvm-svn: 286521

7 years agoAdd -Wnullability-completeness-on-arrays.
Jordan Rose [Thu, 10 Nov 2016 23:28:26 +0000 (23:28 +0000)]
Add -Wnullability-completeness-on-arrays.

This is an addition to (and sub-warning of) -Wnullability-completeness
that warns when an array parameter is missing nullability. When the
specific warning is switched off, the compiler falls back to only
warning on pointer types written as pointer types.

Note that use of nullability /within/ an array triggers the
completeness checks regardless of whether or not the array-specific
warning is enabled; the intent there is simply to determine whether a
particular header is trying to be nullability-aware at all.

Part of rdar://problem/25846421.

llvm-svn: 286520

7 years agoAccept nullability qualifiers on array parameters.
Jordan Rose [Thu, 10 Nov 2016 23:28:17 +0000 (23:28 +0000)]
Accept nullability qualifiers on array parameters.

Since array parameters decay to pointers, '_Nullable' and friends
should be available for use there as well. This is especially
important for parameters that are typedefs of arrays. The unsugared
syntax for this follows the syntax for 'static'-sized arrays in C:

  void test(int values[_Nullable]);

This syntax was previously accepted but the '_Nullable' (and any other
attributes) were silently discarded. However, applying '_Nullable' to
a typedef was previously rejected and is now accepted; therefore, it
may be necessary to test for the presence of this feature:

  #if __has_feature(nullability_on_arrays)

One important change here is that DecayedTypes don't always
immediately contain PointerTypes anymore; they may contain an
AttributedType instead. This only affected one place in-tree, so I
would guess it's not likely to cause problems elsewhere.

This commit does not change -Wnullability-completeness just yet. I
want to think about whether it's worth doing something special to
avoid breaking existing clients that compile with -Werror. It also
doesn't change '#pragma clang assume_nonnull' behavior, which
currently treats the following two declarations as equivalent:

  #pragma clang assume_nonnull begin
  void test(void *pointers[]);
  #pragma clang assume_nonnull end

  void test(void * _Nonnull pointers[]);

This is not the desired behavior, but changing it would break
backwards-compatibility. Most likely the best answer is going to be
adding a new warning.

Part of rdar://problem/25846421

llvm-svn: 286519

7 years ago[index] Add SymbolSubKind for the GKInspectable annotation.
Argyrios Kyrtzidis [Thu, 10 Nov 2016 23:27:11 +0000 (23:27 +0000)]
[index] Add SymbolSubKind for the GKInspectable annotation.

llvm-svn: 286518

7 years agoGlobalISel: fix mistaken comment change
Tim Northover [Thu, 10 Nov 2016 22:47:38 +0000 (22:47 +0000)]
GlobalISel: fix mistaken comment change

llvm-svn: 286517

7 years ago[SelectionDAG] Add support for vector demandedelts in ADD/SUB opcodes
Simon Pilgrim [Thu, 10 Nov 2016 22:41:49 +0000 (22:41 +0000)]
[SelectionDAG] Add support for vector demandedelts in ADD/SUB opcodes

llvm-svn: 286516

7 years ago[LSR] Tweak loop-strength-reduce-crash test. Test-only change.
Justin Lebar [Thu, 10 Nov 2016 22:37:13 +0000 (22:37 +0000)]
[LSR] Tweak loop-strength-reduce-crash test.  Test-only change.

Run opt instead of llc, and update the comment.

llvm-svn: 286515

7 years agoIR: Introduce inrange attribute on getelementptr indices.
Peter Collingbourne [Thu, 10 Nov 2016 22:34:55 +0000 (22:34 +0000)]
IR: Introduce inrange attribute on getelementptr indices.

If the inrange keyword is present before any index, loading from or
storing to any pointer derived from the getelementptr has undefined
behavior if the load or store would access memory outside of the bounds of
the element selected by the index marked as inrange.

This can be used, e.g. for alias analysis or to split globals at element
boundaries where beneficial.

As previously proposed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2016-July/102472.html

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

llvm-svn: 286514

7 years ago[X86] Updated knownbits vector ADD/SUB test
Simon Pilgrim [Thu, 10 Nov 2016 22:34:12 +0000 (22:34 +0000)]
[X86] Updated knownbits vector ADD/SUB test

In preparation for demandedelts support

llvm-svn: 286513

7 years ago[test] Remove implicit deps on libLTO.dylib on Darwin (NFC)
Vedant Kumar [Thu, 10 Nov 2016 22:31:06 +0000 (22:31 +0000)]
[test] Remove implicit deps on libLTO.dylib on Darwin (NFC)

This un-breaks the `check-clang` target.

llvm-svn: 286512

7 years ago[X86] Add knownbits vector ADD test
Simon Pilgrim [Thu, 10 Nov 2016 22:21:04 +0000 (22:21 +0000)]
[X86] Add knownbits vector ADD test

llvm-svn: 286511

7 years agoScheduleDAGInstrs: Slightly simplify code; NFC
Matthias Braun [Thu, 10 Nov 2016 22:11:00 +0000 (22:11 +0000)]
ScheduleDAGInstrs: Slightly simplify code; NFC

llvm-svn: 286510

7 years ago[SelectionDAG] Add support for splatted vectors in SUB opcode
Simon Pilgrim [Thu, 10 Nov 2016 21:57:42 +0000 (21:57 +0000)]
[SelectionDAG] Add support for splatted vectors in SUB opcode

llvm-svn: 286509

7 years ago[X86] Add knownbits vector SUB test
Simon Pilgrim [Thu, 10 Nov 2016 21:50:23 +0000 (21:50 +0000)]
[X86] Add knownbits vector SUB test

llvm-svn: 286508

7 years ago[clang-format] Fix PR30527: Regression when clang-format insert spaces in [] when...
Nico Weber [Thu, 10 Nov 2016 21:49:25 +0000 (21:49 +0000)]
[clang-format] Fix PR30527: Regression when clang-format insert spaces in [] when in template

Actual regression was introduced in r272668. This revision fixes JS script, but
also regress Cpp case. It manifests with spaces added when template is followed
with array. Bug 30527 mentions case of array as a nested template type
(foo<bar<baz>[]>). Fix is to detect such case and to prevent treating it as
array initialization, but as a subscript case. However, before r272668, this
case was treated simple because we were detecting it as a StartsObjCMethodExpr.
Same was true for other similar case - array of templates (foo<int>[]). This
patch tries to address two problems: 1) fixing regression 2) making sure both
cases (array as a nested type, array of templates) which were entering
StartsObjCMethodExpr branch are handled now appropriately.

https://reviews.llvm.org/D26163
Patch from Branko Kokanovic <branko@kokanovic.org>!

llvm-svn: 286507

7 years ago[Sema] Range-ify for loop, add period to comment. NFC.
George Burgess IV [Thu, 10 Nov 2016 21:47:12 +0000 (21:47 +0000)]
[Sema] Range-ify for loop, add period to comment. NFC.

llvm-svn: 286506

7 years agoOne more try to fix the Xcode project
Chris Bieneman [Thu, 10 Nov 2016 21:43:24 +0000 (21:43 +0000)]
One more try to fix the Xcode project

This time I made sure it actually opened.

llvm-svn: 286505

7 years agoFixing the Xcode build that I broke in r286479
Chris Bieneman [Thu, 10 Nov 2016 21:30:16 +0000 (21:30 +0000)]
Fixing the Xcode build that I broke in r286479

Since Xcode can't seem to handle quotes in preprocessor definitions, I've changed the build to assume that the define is unquoted. This should fix the failing Darwin bots.

llvm-svn: 286504

7 years agoRegisterCoalescer: Ignore interferences for constant physregs
Matthias Braun [Thu, 10 Nov 2016 21:22:47 +0000 (21:22 +0000)]
RegisterCoalescer: Ignore interferences for constant physregs

When copying to/from a constant register interferences can be ignored.

Also update the documentation for isConstantPhysReg() to make it more
obvious that this transformation is valid.

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

llvm-svn: 286503

7 years agoAMDGPU: Emit runtime metadata as a note element in .note section
Yaxun Liu [Thu, 10 Nov 2016 21:18:49 +0000 (21:18 +0000)]
AMDGPU: Emit runtime metadata as a note element in .note section

Currently runtime metadata is emitted as an ELF section with name .AMDGPU.runtime_metadata.

However there is a standard way to convey vendor specific information about how to run an ELF binary, which is called vendor-specific note element (http://www.netbsd.org/docs/kernel/elf-notes.html).

This patch lets AMDGPU backend emits runtime metadata as a note element in .note section.

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

llvm-svn: 286502

7 years ago[asan/win] Move breakpoint from Abort to internal__exit
Reid Kleckner [Thu, 10 Nov 2016 20:44:05 +0000 (20:44 +0000)]
[asan/win] Move breakpoint from Abort to internal__exit

Now that we use TerminateProcess, the debugger doesn't stop on program
exit. Add this breakpoint so that the debugger stops after asan reports
an error and is prepared to exit the program.

llvm-svn: 286501

7 years agoClean up uses of unique_ptr for RAII objects. NFC.
George Burgess IV [Thu, 10 Nov 2016 20:43:52 +0000 (20:43 +0000)]
Clean up uses of unique_ptr for RAII objects. NFC.

- EnterExpressionEvaluationContext allows you to specify whether you
  *actually* want to enter an evaluation context.
- For types that don't allow that, llvm::Optional<Foo> should do the
  same thing as std::unique_ptr<Foo>, but with 100% less heap
  allocations.

llvm-svn: 286500

7 years agoMake the .idata$4 and .idata$5 import lib sections 8 bytes on x64
Reid Kleckner [Thu, 10 Nov 2016 20:38:58 +0000 (20:38 +0000)]
Make the .idata$4 and .idata$5 import lib sections 8 bytes on x64

The MSVC linker relies on this invariant to produce a valid import
table. More ASan tests pass in a stage 2 build now. They still fail when
using LLD since there are no PDBs for the dynamic ASan runtime.

llvm-svn: 286499

7 years agoFix type ambiguity with std::max
Zachary Turner [Thu, 10 Nov 2016 20:35:21 +0000 (20:35 +0000)]
Fix type ambiguity with std::max

llvm-svn: 286498

7 years agoFix initialization order error.
Zachary Turner [Thu, 10 Nov 2016 20:23:32 +0000 (20:23 +0000)]
Fix initialization order error.

llvm-svn: 286497

7 years agoInclude version string into ".comment" section.
Rui Ueyama [Thu, 10 Nov 2016 20:20:37 +0000 (20:20 +0000)]
Include version string into ".comment" section.

Summary:
This patch adds a ".comment" section to an output. The comment
section contains the linker's version string. You can now
find out whether a binary is created by LLD or not using objdump
command like this.

  $ objdump -s -j .comment foo

  foo:     file format elf64-x86-64

  Contents of section .comment:
   0000 00474343 3a202855 62756e74 7520342e  .GCC: (Ubuntu 4.
   0010 382e342d 32756275 6e747531 7e31342e  8.4-2ubuntu1~14.
   ...
   00c0 766d2f74 72756e6b 20323835 38343629  vm/trunk 285846)
   00d0 004c696e 6b65723a 204c4c44 20342e30  .Linker: LLD 4.0
   00e0 2e302028 7472756e 6b203238 36343036  .0 (trunk 286406
   00f0 2900                                 ).

Compilers emits .comment section as well, so the output contains
both compiler and linker information.

Alternative considered:

I first tried to add a SHT_NOTE section because GNU gold does that.
A NOTE section starts with a header which contains content type.
It turned out that ld.gold sets type NT_GNU_GOLD_VERSION to their
NOTE section. So the NOTE type is only for GNU gold (surprise!)

Next, I tried to create ".linker-version" section. However, it seems
that reusing the existing ".comment" section is better because 1)
other tools already know about .comment section and is able to strip
it and 2) the result contans not only linker info but also compiler
info.

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

llvm-svn: 286496

7 years ago[Support] Improve flexibility of binary blob formatter.
Zachary Turner [Thu, 10 Nov 2016 20:16:45 +0000 (20:16 +0000)]
[Support] Improve flexibility of binary blob formatter.

This makes it possible to indent a binary blob by a certain
number of bytes, and also makes some things more idiomatic.
Finally, it integrates this binary blob formatter into ScopedPrinter
which used to have its own implementation of this algorithm.

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

llvm-svn: 286495

7 years agoCorrecting a documentation formatting bug; NFC.
Aaron Ballman [Thu, 10 Nov 2016 19:45:49 +0000 (19:45 +0000)]
Correcting a documentation formatting bug; NFC.

llvm-svn: 286494

7 years ago[LTO] Call llvm_shutdown on early exit.
Davide Italiano [Thu, 10 Nov 2016 19:39:05 +0000 (19:39 +0000)]
[LTO] Call llvm_shutdown on early exit.

In a non-LTO build is a nop. In a LTO build, we deallocate/destroy
managed static and this allows us to get the output of, e.g.,
-time-passes without performing a full shutdown.

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

llvm-svn: 286493

7 years ago[PDB] Begin adding documentation for the PDB file format.
Zachary Turner [Thu, 10 Nov 2016 19:24:21 +0000 (19:24 +0000)]
[PDB] Begin adding documentation for the PDB file format.

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

llvm-svn: 286491

7 years ago[Test-Suite] Fix all the sanitizer tests to be based on compiler capabilities
Chris Bieneman [Thu, 10 Nov 2016 19:16:17 +0000 (19:16 +0000)]
[Test-Suite] Fix all the sanitizer tests to be based on compiler capabilities

Summary: This patch reworks all the @skip... lines for sanitizer libraries to be based on whether or not the compiler actually works, rather than whether or not the compiler-rt sources are present in some magically derived directory.

Reviewers: lldb-commits

Subscribers: kubabrecka, tfiala

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

llvm-svn: 286490

7 years ago[opt-viewer] Avoid duplicated remarks
Adam Nemet [Thu, 10 Nov 2016 18:42:56 +0000 (18:42 +0000)]
[opt-viewer] Avoid duplicated remarks

This can happen if a pass is run multiple times or if the code is in a
header file which is included multiple times.

llvm-svn: 286489

7 years ago[Target] Rename X86/ARM Assembly printer to reflect reality.
Davide Italiano [Thu, 10 Nov 2016 18:39:31 +0000 (18:39 +0000)]
[Target] Rename X86/ARM Assembly printer to reflect reality.

This shows up a lot profiling LTO testcases with -time-passes, so
better have a non confusing name.

llvm-svn: 286488

7 years agoAdd -Wduplicate-protocol for existing diagnostic
Alex Lorenz [Thu, 10 Nov 2016 18:30:26 +0000 (18:30 +0000)]
Add -Wduplicate-protocol for existing diagnostic

Expose a warning flag for warn_duplicate_protocol_def. This allows control
over the severity of duplicate protocol definitions.

For example -Werror=duplicate-protocol or
#pragma clang diagnostic ignored "-Wduplicate-protocol".

Patch provided by Dave Lee!

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

llvm-svn: 286487

7 years agoHandle adding new nested namespace in old namespace.
Eric Liu [Thu, 10 Nov 2016 18:29:01 +0000 (18:29 +0000)]
Handle adding new nested namespace in old namespace.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 286486

7 years ago[change-namespace] dyn_cast -> cast.
Eric Liu [Thu, 10 Nov 2016 18:15:34 +0000 (18:15 +0000)]
[change-namespace] dyn_cast -> cast.

llvm-svn: 286485

7 years agoFix some Clang-tidy modernize-use-default and readability-redundant-member-init and...
Eugene Zelenko [Thu, 10 Nov 2016 18:02:34 +0000 (18:02 +0000)]
Fix some Clang-tidy modernize-use-default and readability-redundant-member-init and Include What You Use warnings; other minor fixes.

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

llvm-svn: 286484

7 years agoRevert r286437 r286438, they caused PR30976
Nico Weber [Thu, 10 Nov 2016 17:55:41 +0000 (17:55 +0000)]
Revert r286437 r286438, they caused PR30976

llvm-svn: 286483

7 years ago[OptDiag] Remove non-printable chars from function name
Adam Nemet [Thu, 10 Nov 2016 17:47:03 +0000 (17:47 +0000)]
[OptDiag] Remove non-printable chars from function name

The r283656 did this in the remark arguments.  We also need to do this
in the main function attribute as that is written to YAML as well.

llvm-svn: 286482

7 years ago[SelectionDAG] Add support for vector demandedelts in TRUNCATE opcodes
Simon Pilgrim [Thu, 10 Nov 2016 17:43:52 +0000 (17:43 +0000)]
[SelectionDAG] Add support for vector demandedelts in TRUNCATE opcodes

llvm-svn: 286481

7 years agoAdd comments about why we put LoopSink pass at the very late stage.
Dehao Chen [Thu, 10 Nov 2016 17:42:18 +0000 (17:42 +0000)]
Add comments about why we put LoopSink pass at the very late stage.

llvm-svn: 286480

7 years agoUnify Darwin and Non-Darwin printing of version output
Chris Bieneman [Thu, 10 Nov 2016 17:33:19 +0000 (17:33 +0000)]
Unify Darwin and Non-Darwin printing of version output

Summary:
This change unifies and simplifies the code paths between the Darwin and non-Darwin code to print the LLDB version information.

It also introduces a new variable in CMake LLDB_VERSION_STRING which can be used to specify custom version information. On Darwin this value is implicitly set based on the resource/LLDB-Info.plist file.

With the LLDB_VERSION_STRING variable set to lldb-360.99.0, the -version output is:

> ./bin/lldb -version
lldb version 4.0.0 (lldb-360.99.0)
  clang revision 286264
  llvm revision 286265

This behavior is unified across all target platforms.

Reviewers: lldb-commits

Subscribers: mgorny, tfiala

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

llvm-svn: 286479

7 years ago[lsan] fix a rare lsan false positive: ensure that we don't re-sort the chunks_ array...
Kostya Serebryany [Thu, 10 Nov 2016 17:27:28 +0000 (17:27 +0000)]
[lsan] fix a rare lsan false positive: ensure that we don't re-sort the chunks_ array while iterating over it. A test is hard to create, but I've added a consistency check that fires w/o the fix on existing tests. The bug analysis and the initial patch were provided by Pierre Bourdon

llvm-svn: 286478