platform/upstream/llvm.git
7 years ago[AVX-512] Add tests to show opportunities for commuting vpermi2/vpermt2 instructions.
Craig Topper [Fri, 21 Oct 2016 05:55:40 +0000 (05:55 +0000)]
[AVX-512] Add tests to show opportunities for commuting vpermi2/vpermt2 instructions.

Commuting will be added in a future commit.

llvm-svn: 284808

7 years agoclang-format: [JS] Fix template string ASI.
Martin Probst [Fri, 21 Oct 2016 05:11:38 +0000 (05:11 +0000)]
clang-format: [JS] Fix template string ASI.

Summary:
Previously, automatic semicolon insertion would add an unwrapped line
when a template string contained a line break.

    var x = `foo${
        bar}`;

Would be formatted with `bar...` on a separate line and no indent.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 284807

7 years agoSimplify. NFC.
Rui Ueyama [Fri, 21 Oct 2016 04:52:13 +0000 (04:52 +0000)]
Simplify. NFC.

llvm-svn: 284806

7 years agoAdd comments.
Rui Ueyama [Fri, 21 Oct 2016 04:52:11 +0000 (04:52 +0000)]
Add comments.

llvm-svn: 284805

7 years agoSimplify by merging a lambda with addSymbol. NFC.
Rui Ueyama [Fri, 21 Oct 2016 04:32:46 +0000 (04:32 +0000)]
Simplify by merging a lambda with addSymbol. NFC.

llvm-svn: 284804

7 years agoDo not create .shstrtab and use .strtab instead.
Rui Ueyama [Fri, 21 Oct 2016 03:23:23 +0000 (03:23 +0000)]
Do not create .shstrtab and use .strtab instead.

In-memory ELF object files created here are consumed immediately,
so as long as the generated files are syntactically correct, we don't
care about the details.

llvm-svn: 284803

7 years agoDon't try to use !Previous.empty() as a proxy for "Is this a redeclaration?" --
Richard Smith [Fri, 21 Oct 2016 03:15:03 +0000 (03:15 +0000)]
Don't try to use !Previous.empty() as a proxy for "Is this a redeclaration?" --
we don't collapse that down to a single entry if it's not a redeclaration.
Instead, set the Redeclaration bit on the Declarator to indicate whether a
function is a redeclaration (which may not have been linked into the
redeclaration chain if it's a dependent context friend).

Fixes a rejects-valid; see testcase.

llvm-svn: 284802

7 years ago[ModuleMap] Add more module entries to cover some non modular headers
Bruno Cardoso Lopes [Fri, 21 Oct 2016 03:14:27 +0000 (03:14 +0000)]
[ModuleMap] Add more module entries to cover some non modular headers

These modules are necessary on Darwin to allow modules with
'no_undeclared_includes' (introduced in clang r284797) to work properly
while using libc++ headers.

Patch extracted from a suggested module.modulemap from Richard Smith!

llvm-svn: 284801

7 years agoDR583, DR1512: Implement a rewrite to C++'s 'composite pointer type' rules.
Richard Smith [Fri, 21 Oct 2016 02:36:37 +0000 (02:36 +0000)]
DR583, DR1512: Implement a rewrite to C++'s 'composite pointer type' rules.
This has two significant effects:

1) Direct relational comparisons between null pointer constants (0 and nullopt)
   and pointers are now ill-formed. This was always the case for C, and it
   appears that C++ only ever permitted by accident. For instance, cases like
     nullptr < &a
   are now rejected.

2) Comparisons and conditional operators between differently-cv-qualified
   pointer types now work, and produce a composite type that both source
   pointer types can convert to (when possible). For instance, comparison
   between 'int **' and 'const int **' is now valid, and uses an intermediate
   type of 'const int *const *'.

Clang previously supported #2 as an extension.

We do not accept the cases in #1 as an extension. I've tested a fair amount of
code to check that this doesn't break it, but if it turns out that someone is
relying on this, we can easily add it back as an extension.

llvm-svn: 284800

7 years agoGuard GetEscapedHostname against a nullptr hostname.
Jason Molenda [Fri, 21 Oct 2016 02:32:08 +0000 (02:32 +0000)]
Guard GetEscapedHostname against a nullptr hostname.
This can happen if you debug an iOS corefile on
a mac, where PlatformPOSIX::GetHostname ends up
not providing a hostname because we're working
with a platform of remote-ios.

llvm-svn: 284799

7 years ago[Driver][Darwin] Pass -no_deduplicate to ld64
Bruno Cardoso Lopes [Fri, 21 Oct 2016 01:49:14 +0000 (01:49 +0000)]
[Driver][Darwin] Pass -no_deduplicate to ld64

Recent versions of ld64 run a deduplicate pass, which is on by default.
Disable the pass by using -no_deduplicate in certain condition and
enhance total compile time.

rdar://problem/25455336

llvm-svn: 284798

7 years ago[Modules] Add 'no_undeclared_includes' module map attribute
Bruno Cardoso Lopes [Fri, 21 Oct 2016 01:41:56 +0000 (01:41 +0000)]
[Modules] Add 'no_undeclared_includes' module map attribute

The 'no_undeclared_includes' attribute should be used in a module to
tell that only non-modular headers and headers from used modules are
accepted.

The main motivation behind this is to prevent dep cycles between system
libraries (such as darwin) and libc++.

Patch by Richard Smith!

llvm-svn: 284797

7 years agoRevert "[GVN/PRE] Hoist global values outside of loops."
Davide Italiano [Fri, 21 Oct 2016 01:37:02 +0000 (01:37 +0000)]
Revert "[GVN/PRE] Hoist global values outside of loops."

There's no agreement about this patch. I personally find the
PRE machinery of the current GVN hard enough to reason about
that I'm not sure I'll try to land this again, instead of working
on the rewrite).

llvm-svn: 284796

7 years agoFix a race condition between "ephemeral watchpoint disable/enable" and continue in...
Jim Ingham [Fri, 21 Oct 2016 00:06:38 +0000 (00:06 +0000)]
Fix a race condition between "ephemeral watchpoint disable/enable" and continue in commands.

Also, watchpoint commands, like breakpoint commands, need to run in async mode.

This was causing intermittent failures in TestWatchpointCommandPython.py, which is now solid.

llvm-svn: 284795

7 years agoRevert 9 changes from r284793, they still fail on some bots
Reid Kleckner [Thu, 20 Oct 2016 23:30:39 +0000 (23:30 +0000)]
Revert 9 changes from r284793, they still fail on some bots

llvm-svn: 284794

7 years agoRemove 24 instances of 'REQUIRES: shell'
Reid Kleckner [Thu, 20 Oct 2016 23:11:45 +0000 (23:11 +0000)]
Remove 24 instances of 'REQUIRES: shell'

Tests fall into one of the following categories:

- The requirement was unnecessary

- Additional quoting was required for backslashes in paths (see "sed -e
  's/\\/\\\\/g'") in the sanitizer tests.

- OpenMP used 'REQUIRES: shell' as a proxy for the test failing on
  Windows. Those tests fail there reliably, so use XFAIL instead.

I tried not to remove shell requirements that were added to suppress
flaky test failures, but if I screwed up, we can add it back as needed.

llvm-svn: 284793

7 years agoAdd an API to remove an action from the Process PreResumeActions.
Jim Ingham [Thu, 20 Oct 2016 22:50:00 +0000 (22:50 +0000)]
Add an API to remove an action from the Process PreResumeActions.

llvm-svn: 284792

7 years agoRemove an unnecessary and incorrect check for num locations of a breakpoint
Jim Ingham [Thu, 20 Oct 2016 22:49:06 +0000 (22:49 +0000)]
Remove an unnecessary and incorrect check for num locations of a breakpoint
by grubbing the break list output.  If you pass a number of locations into
the run_break_* functions, they will check that this is right for you.

llvm-svn: 284791

7 years agoAttempt to fix buildbots.
Rui Ueyama [Thu, 20 Oct 2016 22:29:22 +0000 (22:29 +0000)]
Attempt to fix buildbots.

llvm-svn: 284790

7 years agoFix cross-endianness RuntimeDyld relocation for ARM
Keno Fischer [Thu, 20 Oct 2016 22:15:56 +0000 (22:15 +0000)]
Fix cross-endianness RuntimeDyld relocation for ARM

rL284780 fixed the PREL31 relocation and added a test for it. Being
the first such test for ARM relocations, it exposed incorrect endianness
assumptions (causing buildbot failures on big-endian hosts). Fix that by
using the same helpers used for the x86 case.

llvm-svn: 284789

7 years agoframe.script became script.frame a while ago; fix up the docs
Enrico Granata [Thu, 20 Oct 2016 22:10:07 +0000 (22:10 +0000)]
frame.script became script.frame a while ago; fix up the docs

llvm-svn: 284788

7 years agoThis debugging message has been left in the code for years, until one day it randomly...
Enrico Granata [Thu, 20 Oct 2016 22:05:21 +0000 (22:05 +0000)]
This debugging message has been left in the code for years, until one day it randomly hit on some corrupted memory

It is misleading to users in its current form, and only interesting to me - remove it

rdar://28812568

llvm-svn: 284787

7 years agoMove code from InputFile to ELFCreator to decouple the two files.
Rui Ueyama [Thu, 20 Oct 2016 21:57:06 +0000 (21:57 +0000)]
Move code from InputFile to ELFCreator to decouple the two files.

Now that only one non-member function is exported from ELFCreator.h.
All the details are handled internally in ELFCreator.cpp file.

llvm-svn: 284786

7 years agoRe-commit r284753, reverted in r284778, with a fix for PR30749.
Richard Smith [Thu, 20 Oct 2016 21:53:09 +0000 (21:53 +0000)]
Re-commit r284753, reverted in r284778, with a fix for PR30749.

Original commit message:

[c++1z] Teach composite pointer type computation how to compute the composite
pointer type of two function pointers with different noexcept specifications.
While I'm here, also teach it how to merge dynamic exception specifications.

llvm-svn: 284785

7 years ago[SCEV] Add a threshold to restrict number of mul operands to be inlined into SCEV
Li Huang [Thu, 20 Oct 2016 21:38:39 +0000 (21:38 +0000)]
[SCEV] Add a threshold to restrict number of mul operands to be inlined into SCEV

This is to avoid inlining too many multiplication operands into a SCEV, which could
take exponential time in the worst case.

Reviewers: Sanjoy Das, Mehdi Amini, Michael Zolotukhin

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

llvm-svn: 284784

7 years ago[clang] Remove FileEntry copy-constructor
Alexander Shaposhnikov [Thu, 20 Oct 2016 21:20:35 +0000 (21:20 +0000)]
[clang] Remove FileEntry copy-constructor

Code cleanup: address FIXME in the file
include/clang/Basic/FileManager.h and remove
copy-constructor of the class FileEntry.

Test plan: make check-clang

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

llvm-svn: 284782

7 years agoRevert "Disable swiftcall test on windows: More brutal way to appease windows bots"
Reid Kleckner [Thu, 20 Oct 2016 21:17:28 +0000 (21:17 +0000)]
Revert "Disable swiftcall test on windows: More brutal way to appease windows bots"

This reverts commit r284174. The tests pass for me locally. It must have
been a 2015 only crash.

Fixes PR30699

llvm-svn: 284781

7 years agoFix PREL31 relocation on ARM
Keno Fischer [Thu, 20 Oct 2016 21:15:29 +0000 (21:15 +0000)]
Fix PREL31 relocation on ARM

Summary:
This is a 31bits relative relocation instead of a 32bits absolute relocation.

Reviewers: t.p.northover, peter.smith, rengolin

Subscribers: aemerson, llvm-commits, samparker

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

llvm-svn: 284780

7 years ago[X86] Enable interleaved memory access by default
Michael Kuperstein [Thu, 20 Oct 2016 21:04:31 +0000 (21:04 +0000)]
[X86] Enable interleaved memory access by default

This lets the loop vectorizer generate interleaved memory accesses on x86.

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

llvm-svn: 284779

7 years agoRevert r284753 "[c++1z] Teach composite pointer type computation how to compute the...
Hans Wennborg [Thu, 20 Oct 2016 20:54:32 +0000 (20:54 +0000)]
Revert r284753 "[c++1z] Teach composite pointer type computation how to compute the composite"

It caused PR30749.

llvm-svn: 284778

7 years agoFix off-by-one error in PPCaching.cpp token annotation assertion
Reid Kleckner [Thu, 20 Oct 2016 20:53:20 +0000 (20:53 +0000)]
Fix off-by-one error in PPCaching.cpp token annotation assertion

This assert is intended to defend against backtracking into the middle
of a sequence of tokens that is being replaced with an annotation, but
it's OK if we backtrack to the exact position of the start of the
annotation sequence. Use a <= comparison instead of <.

Fixes PR25946

llvm-svn: 284777

7 years agollvm-dwarfdump is now used in a test, so add a depedency on the tool.
Rui Ueyama [Thu, 20 Oct 2016 20:50:00 +0000 (20:50 +0000)]
llvm-dwarfdump is now used in a test, so add a depedency on the tool.

llvm-svn: 284776

7 years ago[Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC
Michal Gorny [Thu, 20 Oct 2016 20:45:40 +0000 (20:45 +0000)]
[Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC

Refactor the DetectDistro() function to take a single vfs::FileSystem
reference only, instead of Driver and llvm::Triple::ArchType.
The ArchType parameter was not used anyway, and Driver was only used to
obtain the VFS.

Aside to making the API simpler and more transparent, it makes it
easier to add unit tests for the function in the future -- since
the tests would need only to provide an appropriate VFS.

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

llvm-svn: 284774

7 years agoadding new symbols to llvm-symbolizer symbol test
Mike Aizatsky [Thu, 20 Oct 2016 20:33:54 +0000 (20:33 +0000)]
adding new symbols to llvm-symbolizer symbol test

llvm-svn: 284773

7 years ago[MSSA] Avoid unnecessary use walks when calling getClobberingMemoryAccess
Daniel Berlin [Thu, 20 Oct 2016 20:13:45 +0000 (20:13 +0000)]
[MSSA] Avoid unnecessary use walks when calling getClobberingMemoryAccess

Summary:
This allows us to mark when uses have been optimized.
This lets us avoid rewalking (IE when people call getClobberingAccess on everything), and also
enables us to later relax the requirement of use optimization during updates with less cost.

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

llvm-svn: 284771

7 years ago[Driver] Parse Debian version as integer when possible. NFC
Michal Gorny [Thu, 20 Oct 2016 20:13:35 +0000 (20:13 +0000)]
[Driver] Parse Debian version as integer when possible. NFC

Replace the string matching for /etc/debian_version with split
integer/string matching algorithm. When the file contains 'major.minor'
version number, parse the major version as integer and use a switch
clause to match it. Otherwise, attempt 'codename/sid' matching using
a StringSwitch.

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

llvm-svn: 284770

7 years agoAnother additional error check for invalid Mach-O files for the
Kevin Enderby [Thu, 20 Oct 2016 20:10:30 +0000 (20:10 +0000)]
Another additional error check for invalid Mach-O files for the
load commands that use the MachO::twolevel_hints_command type
which includes only the LC_TWOLEVEL_HINTS load command.

This is not used in llvm libObject code or in llvm tool code.  But
does appear in one of the binary test files.  While this load command is
obsolete it is easier to add code for it in libObject than edit or change
the binary test case.

llvm-svn: 284769

7 years agoAdd a space to work around a Windows CPython / MSys quoting bug
Reid Kleckner [Thu, 20 Oct 2016 20:02:24 +0000 (20:02 +0000)]
Add a space to work around a Windows CPython / MSys quoting bug

Summary:
The rules for quoting the command line that a subprocess receives are
user space conventions implemented by the C runtime. Python's quoting
rules are implemented here:
https://github.com/python/cpython/blob/c30098c8c6014f3340a369a31df9c74bdbacc269/Lib/subprocess.py#L725

The result is that the final command line C string computed by Python is
'echo \"'. Mingw doesn't appear to interpret that backslash as escaping
the quote because it is not already inside a quoted region. As a result,
our echo command prints a single backslash instead of a quote.

The whole issue can be sidestepped by adding a space a forcing Python to
put the argument to echo in double quotes.

Reviewers: inglorion, ruiu

Subscribers: llvm-commits

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

llvm-svn: 284768

7 years ago[CodeGen] Devirtualize calls to methods marked final in a derived class
Vedant Kumar [Thu, 20 Oct 2016 18:44:14 +0000 (18:44 +0000)]
[CodeGen] Devirtualize calls to methods marked final in a derived class

If we see a virtual method call to Base::foo() but can infer that the
object is an instance of Derived, and that 'foo' is marked 'final' in
Derived, we can devirtualize the call to Derived::foo().

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

llvm-svn: 284766

7 years ago[AMDGPU] Handle R_AMDGPU_ABS64 relocation
Konstantin Zhuravlyov [Thu, 20 Oct 2016 18:34:58 +0000 (18:34 +0000)]
[AMDGPU] Handle R_AMDGPU_ABS64 relocation

This is needed for the following case (OpenCL example):
  __global int Var = 0;
  __global int* Ptr[] = {&Var};
  ...

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

llvm-svn: 284764

7 years agoFix case of file include path.
Zachary Turner [Thu, 20 Oct 2016 18:34:37 +0000 (18:34 +0000)]
Fix case of file include path.

llvm-svn: 284763

7 years ago[CodeView] Refactor serialization to use StreamInterface.
Zachary Turner [Thu, 20 Oct 2016 18:31:19 +0000 (18:31 +0000)]
[CodeView] Refactor serialization to use StreamInterface.

This was all using ArrayRef<>s before which presents a problem
when you want to serialize to or deserialize from an actual
PDB stream.  An ArrayRef<> is really just a special case of
what can be handled with StreamInterface though (e.g. by using
a ByteStream), so changing this to use StreamInterface allows
us to plug in a PDB stream and get all the record serialization
and deserialization for free on a MappedBlockStream.

Subsequent patches will try to remove TypeTableBuilder and
TypeRecordBuilder in favor of class that operate on
Streams as well, which should allow us to completely merge
the reading and writing codepaths for both types and symbols.

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

llvm-svn: 284762

7 years ago[c++1z] Fix assertion failure when using the wrong number of bindings for a
Richard Smith [Thu, 20 Oct 2016 18:29:25 +0000 (18:29 +0000)]
[c++1z] Fix assertion failure when using the wrong number of bindings for a
struct with unnamed bitfields.

llvm-svn: 284761

7 years ago[AMDGPU] Make note record name a static const member of target streamer
Konstantin Zhuravlyov [Thu, 20 Oct 2016 18:22:36 +0000 (18:22 +0000)]
[AMDGPU] Make note record name a static const member of target streamer

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

llvm-svn: 284760

7 years ago[AMDGPU] Emit constant address space data in .rodata section and use relocations...
Konstantin Zhuravlyov [Thu, 20 Oct 2016 18:12:38 +0000 (18:12 +0000)]
[AMDGPU] Emit constant address space data in .rodata section and use relocations instead of fixups (amdhsa only)

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

llvm-svn: 284759

7 years agoRemove unused #include.
Rui Ueyama [Thu, 20 Oct 2016 18:07:11 +0000 (18:07 +0000)]
Remove unused #include.

llvm-svn: 284758

7 years agoUsing branch probability to guide critical edge splitting.
Dehao Chen [Thu, 20 Oct 2016 18:06:52 +0000 (18:06 +0000)]
Using branch probability to guide critical edge splitting.

Summary:
The original heuristic to break critical edge during machine sink is relatively conservertive: when there is only one instruction sinkable to the critical edge, it is likely that the machine sink pass will not break the critical edge. This leads to many speculative instructions executed at runtime. However, with profile info, we could model the splitting benefits: if the critical edge has 50% taken rate, it would always be beneficial to split the critical edge to avoid the speculated runtime instructions. This patch uses profile to guide critical edge splitting in machine sink pass.

The performance impact on speccpu2006 on Intel sandybridge machines:

spec/2006/fp/C++/444.namd                  25.3  +0.26%
spec/2006/fp/C++/447.dealII               45.96  -0.10%
spec/2006/fp/C++/450.soplex               41.97  +1.49%
spec/2006/fp/C++/453.povray               36.83  -0.96%
spec/2006/fp/C/433.milc                   23.81  +0.32%
spec/2006/fp/C/470.lbm                    41.17  +0.34%
spec/2006/fp/C/482.sphinx3                48.13  +0.69%
spec/2006/int/C++/471.omnetpp             22.45  +3.25%
spec/2006/int/C++/473.astar               21.35  -2.06%
spec/2006/int/C++/483.xalancbmk           36.02  -2.39%
spec/2006/int/C/400.perlbench              33.7  -0.17%
spec/2006/int/C/401.bzip2                  22.9  +0.52%
spec/2006/int/C/403.gcc                   32.42  -0.54%
spec/2006/int/C/429.mcf                   39.59  +0.19%
spec/2006/int/C/445.gobmk                 26.98  -0.00%
spec/2006/int/C/456.hmmer                 24.52  -0.18%
spec/2006/int/C/458.sjeng                 28.26  +0.02%
spec/2006/int/C/462.libquantum            55.44  +3.74%
spec/2006/int/C/464.h264ref               46.67  -0.39%

geometric mean                                   +0.20%

Manually checked 473 and 471 to verify the diff is in the noise range.

Reviewers: rengolin, davidxl

Subscribers: llvm-commits

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

llvm-svn: 284757

7 years agoRe-landing a cleaned up implementation of r284550
Chris Bieneman [Thu, 20 Oct 2016 18:01:19 +0000 (18:01 +0000)]
Re-landing a cleaned up implementation of r284550

This time it should actually work. The previous implementaiton was not
getting the linker or compiler flag set correctly in all the right
situations. By moving the check down and basing it of whether or not CXX
is set I we can have the logic to add the flags exist only once for the
linker and once for the compiler instead of duplicating it.

llvm-svn: 284756

7 years ago[CostModel][X86] Fixed AVX1/AVX512 sdiv/udiv uniformconst costs for 256/512 bit integ...
Simon Pilgrim [Thu, 20 Oct 2016 18:00:35 +0000 (18:00 +0000)]
[CostModel][X86] Fixed AVX1/AVX512 sdiv/udiv uniformconst costs for 256/512 bit integer vectors

We weren't checking for uniform const costs before the general cost, resulting in very high estimates.

llvm-svn: 284755

7 years agoAdd more doxygen comments to emmintrin.h's intrinsics.
Ekaterina Romanova [Thu, 20 Oct 2016 17:59:15 +0000 (17:59 +0000)]
Add more doxygen comments to emmintrin.h's intrinsics.

With this patch, 75% of the intrinsics in this file will be documented now. The patches for the rest of the intrisics in this file will be send out later.

The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream. This patch was internally reviewed by Yunzhong Gao.

llvm-svn: 284754

7 years ago[c++1z] Teach composite pointer type computation how to compute the composite
Richard Smith [Thu, 20 Oct 2016 17:57:33 +0000 (17:57 +0000)]
[c++1z] Teach composite pointer type computation how to compute the composite
pointer type of two function pointers with different noexcept specifications.
While I'm here, also teach it how to merge dynamic exception specifications.

llvm-svn: 284753

7 years agoFix *_EXTEND_VECTOR_INREG legalization
Pirama Arumuga Nainar [Thu, 20 Oct 2016 17:56:36 +0000 (17:56 +0000)]
Fix *_EXTEND_VECTOR_INREG legalization

Summary:
While promoting *_EXTEND_VECTOR_INREG nodes whose inputs are already
promoted, perform the appropriate sign extension for the promoted node
before doing the *_EXTEND_VECTOR_INREG operation.  If not, the undefined
high-order bits of the promoted operand may (a) be garbage inc ase of
zext) or (b) contribute the wrong sign-bit (in case of sext)

Updated the promote-vec3.ll test after this change.  The diff shows
explicit zeroing in case of zext and intermediate sign extension in case
of sext.

Reviewers: RKSimon

Subscribers: llvm-commits, srhines

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

llvm-svn: 284752

7 years ago[ELF][MIPS] Use getMipsLocalEntriesNum() everywhere we need number of `local` GOT...
Simon Atanasyan [Thu, 20 Oct 2016 17:53:59 +0000 (17:53 +0000)]
[ELF][MIPS] Use getMipsLocalEntriesNum() everywhere we need number of `local` GOT entries. NFC

llvm-svn: 284751

7 years ago[ELF][MIPS] Separate calculation of MIPS GOT index and offset of the corresponding...
Simon Atanasyan [Thu, 20 Oct 2016 17:53:55 +0000 (17:53 +0000)]
[ELF][MIPS] Separate calculation of MIPS GOT index and offset of the corresponding part of the GOT. NFC

MIPS GOT consists of some parts: local, global, TLS entries. This change
separates calculation of MIPS GOT index and offset of the corresponding
part of the GOT. That makes code a bit clear and allow to extend number
of parts in the future.

llvm-svn: 284750

7 years ago[clang-cl] Fix test that shouldn't be running on non-x86
Renato Golin [Thu, 20 Oct 2016 17:41:08 +0000 (17:41 +0000)]
[clang-cl] Fix test that shouldn't be running on non-x86

The clang-cl test required x86-registered-target but it defaulted to the
host's triple and AArch64 still doesn't support COFF, so the test failed.

The triple was "aarch64-pc-windows-msvc18.0.0" with ObjectFormat equals
llvm::Triple::COFF, failing assertion:

Assertion `(TT.isOSBinFormatELF() || TT.isOSBinFormatMachO()) &&
          "Only expect Darwin and ELF targets"

in AArch64MCTargetDesc.cpp:78.

Making the test only run on Windows hosts obviously fixes the problem.

llvm-svn: 284749

7 years ago[CostModel][X86] Added tests for sdiv/udiv costs for uniform const and uniform const...
Simon Pilgrim [Thu, 20 Oct 2016 17:16:38 +0000 (17:16 +0000)]
[CostModel][X86] Added tests for sdiv/udiv costs for uniform const and uniform const power-of-2

Shows poor costings in AVX1/AVX512BW for certain vector types

llvm-svn: 284748

7 years agoFixed memory leak mistakenly introduced by https://reviews.llvm.org/D23115
Andrey Churbanov [Thu, 20 Oct 2016 17:14:17 +0000 (17:14 +0000)]
Fixed memory leak mistakenly introduced by https://reviews.llvm.org/D23115

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

llvm-svn: 284747

7 years ago[Target] remove TargetRecip class; 2nd try
Sanjay Patel [Thu, 20 Oct 2016 16:55:45 +0000 (16:55 +0000)]
[Target] remove TargetRecip class; 2nd try

This is a retry of r284495 which was reverted at r284513 due to use-after-scope bugs
caused by faulty usage of StringRef.

This version also renames a pair of functions:
getRecipEstimateDivEnabled()
getRecipEstimateSqrtEnabled()
as suggested by Eric Christopher.

original commit msg:

[Target] remove TargetRecip class; move reciprocal estimate isel functionality to TargetLowering

This is a follow-up to https://reviews.llvm.org/D24816 - where we changed reciprocal estimates to be function attributes
rather than TargetOptions.

This patch is intended to be a structural, but not functional change. By moving all of the
TargetRecip functionality into TargetLowering, we can remove all of the reciprocal estimate
state, shield the callers from the string format implementation, and simplify/localize the
logic needed for a target to enable this.

If a function has a "reciprocal-estimates" attribute, those settings may override the target's
default reciprocal preferences for whatever operation and data type we're trying to optimize.
If there's no attribute string or specific setting for the op/type pair, just use the target
default settings.

As noted earlier, a better solution would be to move the reciprocal estimate settings to IR
instructions and SDNodes rather than function attributes, but that's a multi-step job that
requires infrastructure improvements. I intend to work on that, but it's not clear how long
it will take to get all the pieces in place.

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

llvm-svn: 284746

7 years agoPut the move ctor for PassManager back for now, it breaks some builds.
Benjamin Kramer [Thu, 20 Oct 2016 16:50:07 +0000 (16:50 +0000)]
Put the move ctor for PassManager back for now, it breaks some builds.

For some reason using the default move ctor creates undefined references
to it.

llvm-svn: 284745

7 years ago[CostModel][X86] Fixed AVX1/AVX512 sdiv/udiv general costs for 256/512 bit integer...
Simon Pilgrim [Thu, 20 Oct 2016 16:39:11 +0000 (16:39 +0000)]
[CostModel][X86] Fixed AVX1/AVX512 sdiv/udiv general costs for 256/512 bit integer vectors

We weren't accounting for legal types on every subtarget, meaning that many of the costs were using defaults.

We still don't correctly cost (or test) the 512-bit sdiv/udiv by uniform const cases, nor the power-of-2 cases.

llvm-svn: 284744

7 years ago[AMDGPU] add fcopysign(f64, f32) pattern
Valery Pykhtin [Thu, 20 Oct 2016 16:17:54 +0000 (16:17 +0000)]
[AMDGPU] add fcopysign(f64, f32) pattern

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

llvm-svn: 284743

7 years ago[clang-tidy] Add check 'readability-redundant-member-init'
Malcolm Parsons [Thu, 20 Oct 2016 16:08:03 +0000 (16:08 +0000)]
[clang-tidy] Add check 'readability-redundant-member-init'

Summary: The check emits a warning if a member-initializer calls the member's default constructor with no arguments.

Reviewers: sbenza, alexfh, aaron.ballman

Subscribers: modocache, mgorny, Eugene.Zelenko, etienneb, Prazek, hokein, cfe-commits, beanz

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

llvm-svn: 284742

7 years agoMinidump plugin: redesign the x86_64 register context
Dimitar Vlahovski [Thu, 20 Oct 2016 16:01:36 +0000 (16:01 +0000)]
Minidump plugin: redesign the x86_64 register context

Summary:
I misunderstood the format of the register context layout.
I thought it was a dynamically changing structure, and that it's size
depended on context_flags.
It turned out that it always has the same fixed layout and size,
and the context_flags says which fields of the
struct have valid values.
This required a minor redesign of the register context class.

The layout inconsistency, however, was not a "problem" before (e.g. the plugin was working)
because there also was a bug with checking context_flags - the code was
parsing the entire struct regardless of context_flags.
This bug is also fixed in this commit.

Reviewers: labath, zturner

Subscribers: lldb-commits, amccarth

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

llvm-svn: 284741

7 years agoFix SectionPiece size when compiling with MSVC
Hans Wennborg [Thu, 20 Oct 2016 15:59:08 +0000 (15:59 +0000)]
Fix SectionPiece size when compiling with MSVC

Builds were failing with:

  InputSection.h(139): error C2338: SectionPiece is too big

because MSVC does record layout differently, probably not packing the
'OutputOff' and 'Live' bitfields because their types are of different
size. Using size_t for 'Live' seems to fix it.

llvm-svn: 284740

7 years agoRemove a use of llvm::AlignOf that I missed.
Benjamin Kramer [Thu, 20 Oct 2016 15:55:41 +0000 (15:55 +0000)]
Remove a use of llvm::AlignOf that I missed.

llvm-svn: 284739

7 years ago[Support] Put back the MSVC hack for AlignedCharArray.
Benjamin Kramer [Thu, 20 Oct 2016 15:53:04 +0000 (15:53 +0000)]
[Support] Put back the MSVC hack for AlignedCharArray.

MSVC 2015 still errors when passing an alignas'd object by value as an
argument.

llvm-svn: 284738

7 years agoUse auto in for loop
Malcolm Parsons [Thu, 20 Oct 2016 15:40:34 +0000 (15:40 +0000)]
Use auto in for loop

llvm-svn: 284737

7 years ago[Support] Remove llvm::alignOf now that all uses are gone.
Benjamin Kramer [Thu, 20 Oct 2016 15:36:38 +0000 (15:36 +0000)]
[Support] Remove llvm::alignOf now that all uses are gone.

Also clean up the legacy hacks for AlignedCharArray. I'm keeping
LLVM_ALIGNAS alive for a bit longer because GCC 4.8.0 (which we still
support apparently) shipped a buggy alignas(). All other supported
compilers have a working alignas.

llvm-svn: 284736

7 years ago[clang-tidy] Simplify modernize-use-default
Malcolm Parsons [Thu, 20 Oct 2016 15:31:34 +0000 (15:31 +0000)]
[clang-tidy] Simplify modernize-use-default

Summary:
clang-tidy now cleans up after replacements, so leave colon and comma
removal to that.

Reviewers: angelgarcia, alexfh, aaron.ballman, djasper, ioeric

Subscribers: djasper, cfe-commits

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

llvm-svn: 284735

7 years agoRetire llvm::alignOf in favor of C++11 alignof.
Benjamin Kramer [Thu, 20 Oct 2016 15:30:02 +0000 (15:30 +0000)]
Retire llvm::alignOf in favor of C++11 alignof.

No functionality change intended.

llvm-svn: 284734

7 years agoRetire llvm::alignOf in favor of C++11 alignof.
Benjamin Kramer [Thu, 20 Oct 2016 15:02:18 +0000 (15:02 +0000)]
Retire llvm::alignOf in favor of C++11 alignof.

No functionality change intended.

llvm-svn: 284733

7 years ago[Format] Cleanup after replacing constructor body with = default
Malcolm Parsons [Thu, 20 Oct 2016 14:58:45 +0000 (14:58 +0000)]
[Format] Cleanup after replacing constructor body with = default

Summary:
Remove colon and commas after replacing constructor body with = default.
Fix annotation of TT_CtorInitializerColon when preceded by a comment.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 284732

7 years agoAdding a missing constexpr test for reverse_iterator operator[].
Marshall Clow [Thu, 20 Oct 2016 14:57:34 +0000 (14:57 +0000)]
Adding a missing constexpr test for reverse_iterator operator[].

llvm-svn: 284731

7 years agoRetire llvm::alignOf in favor of C++11 alignof.
Benjamin Kramer [Thu, 20 Oct 2016 14:27:22 +0000 (14:27 +0000)]
Retire llvm::alignOf in favor of C++11 alignof.

No functionality change intended.

llvm-svn: 284730

7 years agoClean up alignment hacks now that MSVC 2013 and GCC 4.7 are gone.
Benjamin Kramer [Thu, 20 Oct 2016 13:52:26 +0000 (13:52 +0000)]
Clean up alignment hacks now that MSVC 2013 and GCC 4.7 are gone.

llvm-svn: 284729

7 years ago[OpenMP] Fix issue with directives used in a macro.
Samuel Antao [Thu, 20 Oct 2016 13:20:17 +0000 (13:20 +0000)]
[OpenMP] Fix issue with directives used in a macro.

Summary:
If directives are used in a macro, clang complains with:
```
src/projects/openmp/runtime/src/kmp_runtime.c:7486:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive]
#if KMP_USE_MONITOR
```

This patch fixes two occurrences of the issue in `kmp_runtime.cpp`.

Reviewers: tlwilmar, jlpeyton, AndreyChurbanov, Hahnfeld

Subscribers: Hahnfeld, openmp-commits

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

llvm-svn: 284728

7 years ago[clang-tidy] Fix an assertion failure in cppcoreguidelines-pro-type-member-init.
Haojian Wu [Thu, 20 Oct 2016 13:15:40 +0000 (13:15 +0000)]
[clang-tidy] Fix an assertion failure in cppcoreguidelines-pro-type-member-init.

Summary:
The matcher for matching "class with default constructor" still match
some classes without default constructor, which trigger an assert at
Line 307. This patch makes the matcher more strict.

Reviewers: aaron.ballman

Subscribers: nemanjai, cfe-commits

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

llvm-svn: 284727

7 years ago[GVN] Use defaulted members. No functional change.
Benjamin Kramer [Thu, 20 Oct 2016 13:09:12 +0000 (13:09 +0000)]
[GVN] Use defaulted members. No functional change.

llvm-svn: 284726

7 years agoRe-generate the python and cpp reference documentation
Tamas Berghammer [Thu, 20 Oct 2016 13:04:32 +0000 (13:04 +0000)]
Re-generate the python and cpp reference documentation

They haven't been updated since July 2013 so they missed a lot of new
function added to the SB API since.

Bug: llvm.org/pr30603
llvm-svn: 284725

7 years ago[mips][mcjit] Add the majority of N32 support.
Simon Dardis [Thu, 20 Oct 2016 13:02:23 +0000 (13:02 +0000)]
[mips][mcjit] Add the majority of N32 support.

The missing piece is relocation composition for %hi(%neg(%gp_rel(x))) and
similar.

Patch by: Daniel Sanders

llvm-svn: 284724

7 years ago[CostModel][X86] Added tests for sdiv/udiv costs for scalar and 128/256/512 bit integ...
Simon Pilgrim [Thu, 20 Oct 2016 12:34:00 +0000 (12:34 +0000)]
[CostModel][X86] Added tests for sdiv/udiv costs for scalar and 128/256/512 bit integer vectors

Shows current bug in AVX1/AVX512BW costs for 256 bit vector types

llvm-svn: 284723

7 years ago[lsan] [aarch64] Fix printing of pointers in make check tests
Strahinja Petrovic [Thu, 20 Oct 2016 12:25:57 +0000 (12:25 +0000)]
[lsan] [aarch64] Fix printing of pointers in make check tests

This patch replaces fprintf with print_address function
in LSAN tests. This is necessary because of different
printing of pointers in fprintf and sanitizer's print
function. Differential Revision: https://reviews.llvm.org/D25270.

llvm-svn: 284722

7 years agoDo a sweep over move ctors and remove those that are identical to the default.
Benjamin Kramer [Thu, 20 Oct 2016 12:20:28 +0000 (12:20 +0000)]
Do a sweep over move ctors and remove those that are identical to the default.

All of these existed because MSVC 2013 was unable to synthesize default
move ctors. We recently dropped support for it so all that error-prone
boilerplate can go.

No functionality change intended.

llvm-svn: 284721

7 years agoReapply "Add Chrono.h - std::chrono support header"
Pavel Labath [Thu, 20 Oct 2016 12:05:50 +0000 (12:05 +0000)]
Reapply "Add Chrono.h - std::chrono support header"

This is a resubmission of r284590. The mingw build should be fixed now. The
problem was we were matching time_t with _localtime_64s, which was incorrect on
_USE_32BIT_TIME_T systems. Instead I use localtime_s, which should always
evaluate to the correct function.

llvm-svn: 284720

7 years ago[Clang-tidy]: Fix modernize-avoid-bind erroneous scope resolution.
Haojian Wu [Thu, 20 Oct 2016 11:32:47 +0000 (11:32 +0000)]
[Clang-tidy]: Fix modernize-avoid-bind erroneous scope resolution.

Hello, i would like to suggest a fix for one of the checks in clang-tidy and i should hope this one is the correct mailing list.
The check is modernize-avoid-bind.

Consider the following:

  void bar(int x, int y);

  namespace N {
    void bar(int x, int y);
  }

  void foo(){
    auto Test = std::bind(N::bar,1,1);
  }

clang-tidy’s modernize-avoid-bind check suggests writing:

  void foo(){
    auto Test =[] {return bar(1,1);};
  }

instead of:

  void foo(){
    auto Test = [] {return N::bar(1,1);};
  }

So clang-tidy has proposed an incorrect Fix.

Patch by IdrissRio!

Reviewers: alexfh, hokein, aaron.ballman

Subscriber: cfe-commits
llvm-svn: 284719

7 years ago[cmake] Avoid warnings in feature tests. NFC.
Michael Kruse [Thu, 20 Oct 2016 11:16:19 +0000 (11:16 +0000)]
[cmake] Avoid warnings in feature tests. NFC.

Apply the __attribute__((unused)) before the function to unambiguously apply to
the function declaration.

Add more casts-to-void to mark return values unused as intended.

Contributed-by: Andy Gibbs <andyg1001@hotmail.co.uk>
llvm-svn: 284718

7 years ago[DAGCombiner] Add general constant vector support to (srl (shl x, c), c) -> (and...
Simon Pilgrim [Thu, 20 Oct 2016 11:10:21 +0000 (11:10 +0000)]
[DAGCombiner] Add general constant vector support to (srl (shl x, c), c) -> (and x, cst2)

We already supported scalar constant / splatted constant vector - now accepts any (non opaque) constant scalar / vector

llvm-svn: 284717

7 years agoCompact SectionPiece.
Rafael Espindola [Thu, 20 Oct 2016 10:55:58 +0000 (10:55 +0000)]
Compact SectionPiece.

We allocate a lot of these when linking debug info. This speeds up the
link of debug programs by 1% to 2%.

llvm-svn: 284716

7 years agoWdocumentation fix
Simon Pilgrim [Thu, 20 Oct 2016 10:53:38 +0000 (10:53 +0000)]
Wdocumentation fix

llvm-svn: 284715

7 years agoFix spelling mistake in comment.
Simon Pilgrim [Thu, 20 Oct 2016 10:42:14 +0000 (10:42 +0000)]
Fix spelling mistake in comment.

llvm-svn: 284714

7 years agoFix MSVC bool -> uint64_t promotion warning
Simon Pilgrim [Thu, 20 Oct 2016 10:37:58 +0000 (10:37 +0000)]
Fix MSVC bool -> uint64_t promotion warning

llvm-svn: 284713

7 years ago[ELF] Add REQUIRES: arm to test to fix buildbot without ARM backend.
Peter Smith [Thu, 20 Oct 2016 10:16:13 +0000 (10:16 +0000)]
[ELF] Add REQUIRES: arm to test to fix buildbot without ARM backend.

llvm-svn: 284711

7 years ago[ELF] Allow relative exceptions relocations in shared libraries
Peter Smith [Thu, 20 Oct 2016 09:59:26 +0000 (09:59 +0000)]
[ELF] Allow relative exceptions relocations in shared libraries

The R_ARM_PREL31 and R_ARM_NONE relocations should not be faulted in
shared libraries. In the case of R_ARM_NONE, we have moved the TLS
relaxation hint instruction to R_TLSDESC_CALL so that R_HINT can be used
without side-effects. In the case of R_ARM_PREL31 we permit it to be used
against PLT entries as the personality routines are imported when used in
shared libraries.

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

llvm-svn: 284710

7 years agoDon't include PHDRs if linker script doesn't want them
Eugene Leviant [Thu, 20 Oct 2016 09:39:09 +0000 (09:39 +0000)]
Don't include PHDRs if linker script doesn't want them

This script below shouldn't include file and program headers
to PT_LOAD segment, because it doesn't have PHDRS and FILEHDR
attributes:

PHDRS { all PT_LOAD; }
SECTIONS { /* list of sections here */ }

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

llvm-svn: 284709

7 years ago[ELF] - Partial support of --gdb-index command line option (Part 1).
George Rimar [Thu, 20 Oct 2016 09:19:48 +0000 (09:19 +0000)]
[ELF] - Partial support of --gdb-index command line option (Part 1).

In this patch partial gdb_index section is created.
For costructing the .gdb_index section 6 steps should be performed (details are in
SplitDebugInfo.cpp file header), this patch do first 3:

Creates proper section header.
Fills list of compilation units.
Types CU list area is not supposed to be supported, so it is ignored and therefore
can be treated as implemented either.

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

llvm-svn: 284708

7 years ago[Go bindings] Update for r284678 API changes.
Benjamin Kramer [Thu, 20 Oct 2016 09:14:39 +0000 (09:14 +0000)]
[Go bindings] Update for r284678 API changes.

Alignment moved from createBasicType to createAutoVariable.

llvm-svn: 284707

7 years agoFix ARM/AArch64 Step-Over watchpoint issue remove provision for duplicate watchpoints
Omair Javaid [Thu, 20 Oct 2016 09:07:26 +0000 (09:07 +0000)]
Fix ARM/AArch64 Step-Over watchpoint issue remove provision for duplicate watchpoints

This patch fixes ARM/AArch64 watchpoint bug which was taking inferior out of control while stepping over watchpoints.
Also adds a test case that tests above problem.

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

llvm-svn: 284706

7 years ago[ELF] - Applied clang format. NFC.
George Rimar [Thu, 20 Oct 2016 08:36:42 +0000 (08:36 +0000)]
[ELF] - Applied clang format. NFC.

llvm-svn: 284705

7 years ago[SystemZ] Post-RA scheduler implementation
Jonas Paulsson [Thu, 20 Oct 2016 08:27:16 +0000 (08:27 +0000)]
[SystemZ] Post-RA scheduler implementation

Post-RA sched strategy and scheduling instruction annotations for z196, zEC12
and z13.

This scheduler optimizes decoder grouping and balances processor resources
(including side steering the FPd unit instructions).

The SystemZHazardRecognizer keeps track of the scheduling state, which can
be dumped with -debug-only=misched.

Reviers: Ulrich Weigand, Andrew Trick.
https://reviews.llvm.org/D17260

llvm-svn: 284704

7 years ago[ELF] - Testcase checking that we do not crash on invalid sh_info in SHT_GROUP sectio...
George Rimar [Thu, 20 Oct 2016 08:22:54 +0000 (08:22 +0000)]
[ELF] - Testcase checking that we do not crash on invalid sh_info in SHT_GROUP sections. NFC.

Fix was landed as r284702 "[Object/ELF] - Check index argument in getSymbol()."

Patch contains LLD testcase only.

llvm-svn: 284703