platform/upstream/llvm.git
8 years agoAdd missing %run to test to fix AArch64 buildbot
Reid Kleckner [Fri, 11 Nov 2016 18:11:33 +0000 (18:11 +0000)]
Add missing %run to test to fix AArch64 buildbot

llvm-svn: 286609

8 years ago[asan/win] Fix wrong TerminateProcess exit code
Reid Kleckner [Fri, 11 Nov 2016 17:51:51 +0000 (17:51 +0000)]
[asan/win] Fix wrong TerminateProcess exit code

Add a test for it.

llvm-svn: 286608

8 years agoRevert "Use private linkage for MergedGlobals variables" on Darwin.
Adrian Prantl [Fri, 11 Nov 2016 17:50:09 +0000 (17:50 +0000)]
Revert "Use private linkage for MergedGlobals variables" on Darwin.

This is a partial revert of r244615 (http://reviews.llvm.org/D11942),
which caused a major regression in debug info quality.

Turning the artificial __MergedGlobal symbols into private symbols
(l__MergedGlobal) means that the linker will not include them in the
symbol table of the final executable. Without a symbol table entry
dsymutil is not be able to process the debug info for any of the
merged globals and thus drops the debug info for all of them.

This patch is enabling the old behavior for all MachO targets while
leaving all other targets unaffected.

rdar://problem/29160481
https://reviews.llvm.org/D26531

llvm-svn: 286607

8 years ago[AArch64] Remove lots of redundant code. NFC.
Chad Rosier [Fri, 11 Nov 2016 17:49:34 +0000 (17:49 +0000)]
[AArch64] Remove lots of redundant code. NFC.

llvm-svn: 286606

8 years agoForce the locale when executing ld gold
Sylvestre Ledru [Fri, 11 Nov 2016 17:46:51 +0000 (17:46 +0000)]
Force the locale when executing ld gold

Summary:
If run with other locales (like French),
the decode operation might fail

This is the same change as in r246421 for llvm.

llvm-svn: 286605

8 years ago[InstCombine] fix formatting of FoldOpIntoSelect(); NFCI
Sanjay Patel [Fri, 11 Nov 2016 17:42:16 +0000 (17:42 +0000)]
[InstCombine] fix formatting of FoldOpIntoSelect(); NFCI

llvm-svn: 286604

8 years agoFixed issues found by Paul Robinson with my patch for:
Greg Clayton [Fri, 11 Nov 2016 17:38:14 +0000 (17:38 +0000)]
Fixed issues found by Paul Robinson with my patch for:

https://reviews.llvm.org/D26526

- Fixed DW_FORM_strp to be correctly sized and extracted for DWARF64
- Added some missing strp variants as well
- Fixed comment typo

llvm-svn: 286603

8 years agoAdd a new optimization option -Og
Sylvestre Ledru [Fri, 11 Nov 2016 17:29:56 +0000 (17:29 +0000)]
Add a new optimization option -Og

Summary:
Just like gcc, we should have the -Og option as more and more software are using it:
https://llvm.org/bugs/show_bug.cgi?id=20765

Reviewers: echristo, dberlin, dblaikie, keith.walker.arm, rengolin

Subscribers: aprantl, friss, mehdi_amini, RKSimon, probinson, majnemer, cfe-commits

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

llvm-svn: 286602

8 years ago[AArch64] Early return and minor renaming/refactoring to ease code review. NFC.
Chad Rosier [Fri, 11 Nov 2016 17:07:37 +0000 (17:07 +0000)]
[AArch64] Early return and minor renaming/refactoring to ease code review. NFC.

llvm-svn: 286601

8 years agoFix windows buildbot where warnings are errors. We had a switch statement where all...
Greg Clayton [Fri, 11 Nov 2016 16:55:31 +0000 (16:55 +0000)]
Fix windows buildbot where warnings are errors. We had a switch statement where all enumerations were handled, but some compilers don't recognize this. Simplify the logic so that all compilers will know a return value is returned in all cases.

llvm-svn: 286600

8 years agoFix mismatched enum value name and diagnostic text.
Douglas Katzman [Fri, 11 Nov 2016 16:51:40 +0000 (16:51 +0000)]
Fix mismatched enum value name and diagnostic text.

ExpectedFunctionGlobalVarMethodOrProperty
would previously say "functions and global variables"
instead of "functions, methods, properties, and global variables"

The newly added ExpectedFunctionOrGlobalVariable
says "functions and global variables"

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

llvm-svn: 286599

8 years agoFix code to deal with recent LLVM changes.
Greg Clayton [Fri, 11 Nov 2016 16:23:47 +0000 (16:23 +0000)]
Fix code to deal with recent LLVM changes.

https://reviews.llvm.org/D26526

llvm-svn: 286598

8 years agoClean up DWARFFormValue by reducing duplicated code and removing DWARFFormValue:...
Greg Clayton [Fri, 11 Nov 2016 16:21:37 +0000 (16:21 +0000)]
Clean up DWARFFormValue by reducing duplicated code and removing DWARFFormValue::getFixedFormSizes()

In preparation for a follow on patch that improves DWARF parsing speed, clean up DWARFFormValue so that we have can get the fixed byte size of a form value given a DWARFUnit or given the version, address byte size and dwarf32/64.

This patch cleans up code so that everyone is using one of the new DWARFFormValue functions:

static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, const DWARFUnit *U = nullptr);
static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, uint16_t Version, uint8_t AddrSize, bool Dwarf32);

This patch changes DWARFFormValue::skipValue() to rely on the output of DWARFFormValue::getFixedByteSize(...) instead of duplicating the code in each function. This will reduce the number of changes we need to make to DWARF to fewer places in DWARFFormValue when we add support for new form.

This patch also starts to support DWARF64 so that we can get correct byte sizes for forms that vary according the DWARF 32/64.

To reduce the code duplication a new FormSizeHelper pure virtual class was created that can be created as a FormSizeHelperDWARFUnit when you have a DWARFUnit, or FormSizeHelperManual where you manually specify the DWARF version, address byte size and DWARF32/DWARF64. There is now a single implementation of a function that gets the fixed byte size (instead of two where one took a DWARFUnit and one took the DWARF version, address byte size and DWARFFormat enum) and one function to skip the form values.

https://reviews.llvm.org/D26526

llvm-svn: 286597

8 years ago[PowerPC] Add vector conversion builtins to altivec.h - LLVM portion
Nemanja Ivanovic [Fri, 11 Nov 2016 14:41:19 +0000 (14:41 +0000)]
[PowerPC] Add vector conversion builtins to altivec.h - LLVM portion

This patch corresponds to review:
https://reviews.llvm.org/D26307

Adds all the intrinsics used for various conversion builtins that will
be added to altivec.h. These are type conversions between various types of
vectors.

llvm-svn: 286596

8 years ago[X86] Merge (near) duplicate scalar non-temporal store code. NFCI.
Simon Pilgrim [Fri, 11 Nov 2016 14:38:34 +0000 (14:38 +0000)]
[X86] Merge (near) duplicate scalar non-temporal store code. NFCI.

llvm-svn: 286595

8 years agollvm-strings: Fix r286556 to add required libraries.
NAKAMURA Takumi [Fri, 11 Nov 2016 14:17:37 +0000 (14:17 +0000)]
llvm-strings: Fix r286556 to add required libraries.

llvm-svn: 286594

8 years agoFix test/tools/gold/X86/thinlto_funcimport.ll on non-X86 hosts
John Brawn [Fri, 11 Nov 2016 14:12:15 +0000 (14:12 +0000)]
Fix test/tools/gold/X86/thinlto_funcimport.ll on non-X86 hosts

Pass -m elf_x86_64 to gold, as is done in other tests.

llvm-svn: 286593

8 years ago[AArch64] Enable merging of adjacent zero stores for all subtargets.
Chad Rosier [Fri, 11 Nov 2016 14:10:12 +0000 (14:10 +0000)]
[AArch64] Enable merging of adjacent zero stores for all subtargets.

This optimization merges adjacent zero stores into a wider store.

e.g.,

strh wzr, [x0]
strh wzr, [x0, #2]
; becomes
str wzr, [x0]

e.g.,

str wzr, [x0]
str wzr, [x0, #4]
; becomes
str xzr, [x0]

Previously, this was only enabled for Kryo and Cortex-A57.

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

llvm-svn: 286592

8 years ago[AMDGPU] TargetStreamer: Fix .note section name
Sam Kolton [Fri, 11 Nov 2016 13:41:52 +0000 (13:41 +0000)]
[AMDGPU] TargetStreamer: Fix .note section name

llvm-svn: 286591

8 years ago[ELF] Attempt to fix PPC buildbot
Eugene Leviant [Fri, 11 Nov 2016 13:24:49 +0000 (13:24 +0000)]
[ELF] Attempt to fix PPC buildbot

llvm-svn: 286590

8 years ago[ELF] - Use backward slashes inside response files
George Rimar [Fri, 11 Nov 2016 13:23:13 +0000 (13:23 +0000)]
[ELF] - Use backward slashes inside response files

Patch replaces forward slashes with backward inside response.txt

This is https://llvm.org/bugs/show_bug.cgi?id=30951.

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

llvm-svn: 286589

8 years ago[ELF] Set 'Live = true' in SyntheticSection ctor. NFC.
Eugene Leviant [Fri, 11 Nov 2016 13:03:58 +0000 (13:03 +0000)]
[ELF] Set 'Live = true' in SyntheticSection ctor. NFC.

llvm-svn: 286588

8 years ago[SystemZ] Support CL(G)T instructions
Ulrich Weigand [Fri, 11 Nov 2016 12:48:26 +0000 (12:48 +0000)]
[SystemZ] Support CL(G)T instructions

This adds support for the compare logical and trap (memory)
instructions that were added as part of the miscellaneous
instruction extensions feature with zEC12.

llvm-svn: 286587

8 years ago[SystemZ] Support load-and-zero-rightmost-byte facility
Ulrich Weigand [Fri, 11 Nov 2016 12:46:28 +0000 (12:46 +0000)]
[SystemZ] Support load-and-zero-rightmost-byte facility

This adds support for the LZRF/LZRG/LLZRGF instructions that were
added on z13, and uses them for code generation were appropriate.

SystemZDAGToDAGISel::tryRISBGZero is updated again to prefer LLZRGF
over RISBG where both would be possible.

llvm-svn: 286586

8 years ago[SystemZ] Use LLGT(R) instructions
Ulrich Weigand [Fri, 11 Nov 2016 12:43:51 +0000 (12:43 +0000)]
[SystemZ] Use LLGT(R) instructions

This adds support for the 31-to-64-bit zero extension instructions
LLGT and LLGTR and uses them for code generation where appropriate.

Since this operation can also be performed via RISBG, we have to
update SystemZDAGToDAGISel::tryRISBGZero so that we prefer LLGT
over RISBG in case both are possible.  The patch includes some
simplification to the tryRISBGZero code; this is not intended
to cause any (further) functional change in codegen.

llvm-svn: 286585

8 years agoFix for PR28523: unexpected compilation error.
Alexey Bataev [Fri, 11 Nov 2016 12:36:20 +0000 (12:36 +0000)]
Fix for PR28523: unexpected compilation error.

Clang emits error message for the following code:
```
template <class F> void parallel_loop(F &&f) { f(0); }

int main() {
  int x;
  parallel_loop([&](auto y) {
    {
      x = y;
    };
  });
}
```

$ clang++ --std=gnu++14 clang_test.cc -o clang_test
clang_test.cc:9:7: error: reference to local variable 'x' declared in enclosing function 'main'
      x = y;
            ^
clang_test.cc:2:48: note: in instantiation of function template specialization 'main()::(anonymous class)::operator()<int>' requested here
            template <class F> void parallel_loop(F &&f) { f(0); }
                                                           ^
clang_test.cc:6:3: note: in instantiation of function template specialization 'parallel_loop<(lambda at clang_test.cc:6:17)>' requested here parallel_loop([&](auto y) {
           ^
clang_test.cc:5:7: note: 'x' declared here
      int x;
          ^
1 error generated.

Patch fixes this issue.

llvm-svn: 286584

8 years ago[MSAN][MIPS] Fix test Linux/syscalls_sigaction.cc on mips64
Sagar Thakur [Fri, 11 Nov 2016 12:05:30 +0000 (12:05 +0000)]
[MSAN][MIPS] Fix test Linux/syscalls_sigaction.cc on mips64

Changed the kernel sigaction structure in test syscalls_sigaction.cc for MIPS according to the structure defined in kernel.

Reviewed by eugenis.
Differential: https://reviews.llvm.org/D25814

llvm-svn: 286583

8 years ago[SelectionDAG] Add support for vector demandedelts in BSWAP opcodes
Simon Pilgrim [Fri, 11 Nov 2016 11:51:29 +0000 (11:51 +0000)]
[SelectionDAG] Add support for vector demandedelts in BSWAP opcodes

llvm-svn: 286582

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

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

llvm-svn: 286527

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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