platform/upstream/llvm.git
7 years agoFix for D25504 - segfault because of double free()-ing in shutdown code.
Jonathan Peyton [Mon, 21 Nov 2016 16:18:57 +0000 (16:18 +0000)]
Fix for D25504 - segfault because of double free()-ing in shutdown code.

Paul Osmialowski pointed out a double free bug in shutdown code.  This patch
Moves the freeing of the implicit task to above the freeing of all fast memory
to prevent the double-free issue.

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

llvm-svn: 287551

7 years agoclang-tidy: improve my test for readability-redundant-declaration
Daniel Marjamaki [Mon, 21 Nov 2016 16:08:17 +0000 (16:08 +0000)]
clang-tidy: improve my test for readability-redundant-declaration

llvm-svn: 287550

7 years ago[ELF] Convert EhFrameHeader to input section
Eugene Leviant [Mon, 21 Nov 2016 15:52:10 +0000 (15:52 +0000)]
[ELF] Convert EhFrameHeader to input section

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

llvm-svn: 287549

7 years agosmall fixup which enables the issuing of the aforementioned instruction (w/o operands...
Coby Tayree [Mon, 21 Nov 2016 15:50:56 +0000 (15:50 +0000)]
small fixup which enables the issuing of the aforementioned instruction (w/o operands), on MS/Intel syntax.

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

llvm-svn: 287548

7 years ago[ELF] Better error reporting for linker scripts
Eugene Leviant [Mon, 21 Nov 2016 15:49:56 +0000 (15:49 +0000)]
[ELF] Better error reporting for linker scripts

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

llvm-svn: 287547

7 years agoclang-tidy: Attempt to fix build bot failure with mismatching size_t platform type.
Daniel Marjamaki [Mon, 21 Nov 2016 15:46:40 +0000 (15:46 +0000)]
clang-tidy: Attempt to fix build bot failure with mismatching size_t platform type.

llvm-svn: 287546

7 years agoFix known zero bits for addrspacecast.
Yaxun Liu [Mon, 21 Nov 2016 15:42:31 +0000 (15:42 +0000)]
Fix known zero bits for addrspacecast.

Currently LLVM assumes that a pointer addrspacecasted to a different addr space is equivalent to trunc or zext bitwise, which is not true. For example, in amdgcn target, when a null pointer is addrspacecasted from addr space 4 to 0, its value is changed from i64 0 to i32 -1.

This patch teaches LLVM not to assume known bits of addrspacecast instruction to its operand.

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

llvm-svn: 287545

7 years ago[include-fixer plugin] Make the plugin emit proper fixits in case multiple errors...
Benjamin Kramer [Mon, 21 Nov 2016 15:28:50 +0000 (15:28 +0000)]
[include-fixer plugin] Make the plugin emit proper fixits in case multiple errors are found.

The standalone tool only fixes the first one and we managed to bake that
assumption into the code :(

Also fix a crash when no header is found at all.

llvm-svn: 287544

7 years ago[X86][SSE] Add SSE reciprocal estimate tests
Simon Pilgrim [Mon, 21 Nov 2016 15:28:21 +0000 (15:28 +0000)]
[X86][SSE] Add SSE reciprocal estimate tests

llvm-svn: 287543

7 years agoFix remote-linux regression due to stringRef changes
Omair Javaid [Mon, 21 Nov 2016 15:18:58 +0000 (15:18 +0000)]
Fix remote-linux regression due to stringRef changes

This is to fix a regression in remote-linux lldb-server connections.

We were wrongly passing a copy of uri and expecting a stringRef back.

llvm-svn: 287542

7 years ago[SelectionDAG] Add ComputeNumSignBits support for CONCAT_VECTORS opcode
Simon Pilgrim [Mon, 21 Nov 2016 14:36:19 +0000 (14:36 +0000)]
[SelectionDAG] Add ComputeNumSignBits support for CONCAT_VECTORS opcode

llvm-svn: 287541

7 years agoreadability-redundant-declaration: Fix crash
Daniel Marjamaki [Mon, 21 Nov 2016 14:29:53 +0000 (14:29 +0000)]
readability-redundant-declaration: Fix crash

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

llvm-svn: 287540

7 years ago[llvm-cov] Avoid 0% when reporting something that's 0/0
Alex Lorenz [Mon, 21 Nov 2016 14:00:04 +0000 (14:00 +0000)]
[llvm-cov] Avoid 0% when reporting something that's 0/0

This commit makes llvm-cov avoid showing 0% (0/0) coverage for things
like file function coverage, etc. in reports and HTML output. This can happen
for files like headers that have macros but no functions. This commit makes
llvm-cov report - (0/0) instead.

rdar://29246480

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

llvm-svn: 287539

7 years ago[ELF] Attempt to fix Windows buidbot
Eugene Leviant [Mon, 21 Nov 2016 13:57:50 +0000 (13:57 +0000)]
[ELF] Attempt to fix Windows buidbot

llvm-svn: 287538

7 years agoChange the way how we print out line numbers.
Rui Ueyama [Mon, 21 Nov 2016 13:49:57 +0000 (13:49 +0000)]
Change the way how we print out line numbers.

LLD's error messages contain line numbers, function names or section names.
Currently they are formatter as follows.

  foo.c (32): symbol 'foo' not found
  foo.c (function bar): symbol 'foo' not found
  foo.c (.text+0x1234): symbol 'foo' not found

This patch changes them so that they are consistent with Clang's output.

  foo.c:32: symbol 'foo' not found
  foo.c:(function bar): symbol 'foo' not found
  foo.c:(.text+0x1234): symbol 'foo' not found

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

llvm-svn: 287537

7 years agoAdjust arm64-irtranslator.ll test to changes from r287368
Benjamin Kramer [Mon, 21 Nov 2016 13:15:38 +0000 (13:15 +0000)]
Adjust arm64-irtranslator.ll test to changes from r287368

The test is currently broken, and this CL should fix it.

Patch by Adrian Kuegel!

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

llvm-svn: 287536

7 years ago[X86][SSE] Allow PACKSS to be used to truncate any type of all/none sign bits input
Simon Pilgrim [Mon, 21 Nov 2016 12:05:49 +0000 (12:05 +0000)]
[X86][SSE] Allow PACKSS to be used to truncate any type of all/none sign bits input

At the moment we only use truncateVectorCompareWithPACKSS with direct vector comparison results (just one example of a known all/none signbits input).

This change relaxes the direct matching of a SETCC opcode by moving the logic up into SelectionDAG::ComputeNumSignBits and accepting any input with a known splatted signbit.

llvm-svn: 287535

7 years ago[InstrProfiling] Mark __llvm_profile_instrument_target last parameter as i32 zeroext...
Marcin Koscielnicki [Mon, 21 Nov 2016 11:57:19 +0000 (11:57 +0000)]
[InstrProfiling] Mark __llvm_profile_instrument_target last parameter as i32 zeroext if appropriate.

On some architectures (s390x, ppc64, sparc64, mips), C-level int is passed
as i32 signext instead of plain i32.  Likewise, unsigned int may be passed
as i32, i32 signext, or i32 zeroext depending on the platform.  Mark
__llvm_profile_instrument_target properly (its last parameter is unsigned
int).

This (together with the clang change) makes compiler-rt profile testsuite pass
on s390x.

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

llvm-svn: 287534

7 years ago[TLI] Add functions determining if int parameters/returns should be zeroext/signext.
Marcin Koscielnicki [Mon, 21 Nov 2016 11:57:11 +0000 (11:57 +0000)]
[TLI] Add functions determining if int parameters/returns should be zeroext/signext.

On some architectures (s390x, ppc64, sparc64, mips), C-level int is passed
as i32 signext instead of plain i32.  Likewise, unsigned int may be passed
as i32, i32 signext, or i32 zeroext depending on the platform.  Add this
information to TargetLibraryInfo, to be used whenever some LLVM pass
inserts a compiler-rt call to a function involving int parameters
or returns.

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

llvm-svn: 287533

7 years agoFixing a small typo (A->U).
Michael Zuckerman [Mon, 21 Nov 2016 11:52:11 +0000 (11:52 +0000)]
Fixing a small typo (A->U).
This seem to fixes PR30992.

-         HasAVX512 ? X86::VMOVAPSZ128rm_NOVLX
+         HasAVX512 ? X86::VMOVUPSZ128rm_NOVLX

llvm-svn: 287532

7 years agoRevert r287435 because of OS X test failures
Eric Fiselier [Mon, 21 Nov 2016 11:26:10 +0000 (11:26 +0000)]
Revert r287435 because of OS X test failures

llvm-svn: 287531

7 years ago[ObjC] Prevent infinite loops when iterating over redeclaration
Alex Lorenz [Mon, 21 Nov 2016 11:16:30 +0000 (11:16 +0000)]
[ObjC] Prevent infinite loops when iterating over redeclaration
of a method that was declared in an invalid interface

This commit fixes an infinite loop that occurs when clang tries to iterate over
redeclaration of a method that was declared in an invalid @interface. The
existing validity checks don't catch this as that @interface is a duplicate of
a previously declared valid @interface declaration, so we have to verify that
the found redeclaration is in a valid declaration context.

rdar://29220965

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

llvm-svn: 287530

7 years ago[Frontend] Add a predefined macro that describes the Objective-C bool type
Alex Lorenz [Mon, 21 Nov 2016 11:05:15 +0000 (11:05 +0000)]
[Frontend] Add a predefined macro that describes the Objective-C bool type

This commit adds a new predefined macro named __OBJC_BOOL_IS_BOOL that describes
the Objective-C boolean type: its value is zero if the Objective-C boolean uses
the signed character type, otherwise its value is one as the Objective-C boolean
uses the builtin boolean type.

rdar://21170440

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

llvm-svn: 287529

7 years ago[Sparc] Use target name instead of namespace as prefix for MCRegisterClasses array
Jacob Baungard Hansen [Mon, 21 Nov 2016 09:33:05 +0000 (09:33 +0000)]
[Sparc] Use target name instead of namespace as prefix for MCRegisterClasses array

Summary:
For Sparc the namespace (SP) is different from the target name (Sparc),
which causes the name of the array in this declaration to differ from
the name used in the definition.

Patch by Daniel Cederman.

Reviewers: jyknight

Subscribers: llvm-commits, jyknight

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

llvm-svn: 287528

7 years ago[ELF] Better error reporting for broken archives
Eugene Leviant [Mon, 21 Nov 2016 09:28:07 +0000 (09:28 +0000)]
[ELF] Better error reporting for broken archives

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

llvm-svn: 287527

7 years ago[ELF] Convert GdbIndexSection to input section
Eugene Leviant [Mon, 21 Nov 2016 09:24:43 +0000 (09:24 +0000)]
[ELF] Convert GdbIndexSection to input section

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

llvm-svn: 287526

7 years ago[ScopDetect] Use mayReadOrWriteMemory to shorten condition
Tobias Grosser [Mon, 21 Nov 2016 09:07:30 +0000 (09:07 +0000)]
[ScopDetect] Use mayReadOrWriteMemory to shorten condition

llvm-svn: 287525

7 years ago[ScopDetect] Remove unnecessary namespace qualifier
Tobias Grosser [Mon, 21 Nov 2016 09:04:45 +0000 (09:04 +0000)]
[ScopDetect] Remove unnecessary namespace qualifier

llvm-svn: 287524

7 years ago[AVX-512] Add EVEX form of VMOVZPQILo2PQIZrm to load folding tables to match SSE...
Craig Topper [Mon, 21 Nov 2016 07:51:31 +0000 (07:51 +0000)]
[AVX-512] Add EVEX form of VMOVZPQILo2PQIZrm to load folding tables to match SSE and AVX.

llvm-svn: 287523

7 years ago[bpf] attempt to fix big-endian bots
Alexei Starovoitov [Mon, 21 Nov 2016 07:26:23 +0000 (07:26 +0000)]
[bpf] attempt to fix big-endian bots

attempt to fix big-endian bots failing on new dwarfdump test

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 287522

7 years ago[bpf] fix dwarf elf relocs and line numbers
Alexei Starovoitov [Mon, 21 Nov 2016 06:21:23 +0000 (06:21 +0000)]
[bpf] fix dwarf elf relocs and line numbers

- teach RelocVisitor to recognize bpf relocations
- fix AsmInfo->PointerSize to make sure dwarf is emitted correctly
- add a test for the above

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 287521

7 years ago[TableGen][ISel] Do a better job of factoring ScopeMatchers created during creation...
Craig Topper [Mon, 21 Nov 2016 04:07:58 +0000 (04:07 +0000)]
[TableGen][ISel] Do a better job of factoring ScopeMatchers created during creation of SwitchTypeMatcher.

Previously we were factoring when the ScopeMatcher was initially created, but it might get more Matchers added to it later. Delay factoring until we have fully created/populated the ScopeMatchers.

This reduces X86 isel tables by 154 bytes.

llvm-svn: 287520

7 years ago[X86] Remove duplicate instructions for (v)movq and replace with patterns on other...
Craig Topper [Mon, 21 Nov 2016 04:07:56 +0000 (04:07 +0000)]
[X86] Remove duplicate instructions for (v)movq and replace with patterns on other instructions. NFC

llvm-svn: 287519

7 years ago[XRay] Support AArch64 in Clang
Dean Michael Berris [Mon, 21 Nov 2016 03:24:59 +0000 (03:24 +0000)]
[XRay] Support AArch64 in Clang

This patch adds XRay support in Clang for AArch64 target.
This patch is one of a series:

LLVM: https://reviews.llvm.org/D26412
compiler-rt: https://reviews.llvm.org/D26413

Author: rSerge

Reviewers: rengolin, dberris

Subscribers: aemerson, cfe-commits, iid_iunknown

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

llvm-svn: 287518

7 years ago[XRay] Support AArch64 in compiler-rt
Dean Michael Berris [Mon, 21 Nov 2016 03:20:43 +0000 (03:20 +0000)]
[XRay] Support AArch64 in compiler-rt

This patch adds XRay support in compiler-rt for AArch64 targets.
This patch is one of a series:

LLVM: https://reviews.llvm.org/D26412
Clang: https://reviews.llvm.org/D26415

Author: rSerge

Reviewers: rengolin, dberris

Subscribers: aemerson, mgorny, llvm-commits, iid_iunknown

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

llvm-svn: 287517

7 years ago[XRay][AArch64] Implemented a test for the compile-time sleds emitted, and fixed...
Dean Michael Berris [Mon, 21 Nov 2016 03:01:43 +0000 (03:01 +0000)]
[XRay][AArch64] Implemented a test for the compile-time sleds emitted, and fixed a bug in the jump instruction

This patch adds a test for the assembly code emitted with XRay
instrumentation. It also fixes a bug where the operand of a jump
instruction must be not the number of bytes to jump over, but rather the
number of 4-byte instructions.

Author: rSerge

Reviewers: dberris, rengolin

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

llvm-svn: 287516

7 years agoAdd comments.
Rui Ueyama [Mon, 21 Nov 2016 02:11:05 +0000 (02:11 +0000)]
Add comments.

This patch rearranges code a bit to make it easy to explain.

llvm-svn: 287515

7 years agoSimplify. NFC.
Rui Ueyama [Mon, 21 Nov 2016 02:10:12 +0000 (02:10 +0000)]
Simplify. NFC.

llvm-svn: 287514

7 years agoMark variadic lock guard tests as XFAIL with modules, since they have to define macro...
Eric Fiselier [Mon, 21 Nov 2016 01:10:52 +0000 (01:10 +0000)]
Mark variadic lock guard tests as XFAIL with modules, since they have to define macros to expose the new ABI

llvm-svn: 287513

7 years agoAdjust uses_alloc_types helpers for later changes
Eric Fiselier [Mon, 21 Nov 2016 00:41:32 +0000 (00:41 +0000)]
Adjust uses_alloc_types helpers for later changes

llvm-svn: 287512

7 years ago[GlobalSplit] Port to the new pass manager.
Davide Italiano [Mon, 21 Nov 2016 00:28:23 +0000 (00:28 +0000)]
[GlobalSplit] Port to the new pass manager.

llvm-svn: 287511

7 years agoSimplify. NFC.
Rui Ueyama [Sun, 20 Nov 2016 23:15:56 +0000 (23:15 +0000)]
Simplify. NFC.

llvm-svn: 287510

7 years agoUpdate comments.
Rui Ueyama [Sun, 20 Nov 2016 23:15:54 +0000 (23:15 +0000)]
Update comments.

llvm-svn: 287509

7 years agoAdd a flag to InputSectionBase for linker script.
Rui Ueyama [Sun, 20 Nov 2016 23:15:52 +0000 (23:15 +0000)]
Add a flag to InputSectionBase for linker script.

Previously, we set (uintptr_t)-1 to InputSectionBase::OutSec to record
that a section has already been set to be assigned to some output section
by linker scripts. Later, we restored nullptr to the pointer to use
the field for the original purpose. That overloading is not very easy to
understand.

This patch adds a bit flag for that purpose, so that we don't need
to piggyback the flag on an unrelated pointer.

llvm-svn: 287508

7 years agoELF core: Adding parsing of the floating-point and SSE registers on x86 32/64 bit...
Dimitar Vlahovski [Sun, 20 Nov 2016 21:24:49 +0000 (21:24 +0000)]
ELF core: Adding parsing of the floating-point and SSE registers on x86 32/64 bit elf core files

Summary:
The floating-point and SSE registers could be present in the elf-core
file in the note NT_FPREGSET for 64 bit ones, and in the note
NT_PRXFPREG for 32 bit ones.

The entire note is a binary blob matching the layout of the x87 save
area that gets generated by the FXSAVE instruction (see Intel developers
manual for more information).

This CL mainly modifies the RegisterRead function in
RegisterContextPOSIXCore_x86_64 for it to return the correct data both
for GPR and FPR/SSE registers, and return false (meaning "this register
is not available") for other registers.

I added a test to TestElfCore.py that tests reading FPR/SSE registers
both from a 32 and 64 bit elf-core file and I have inluded the source
which I used to generate the core files.

I tried to also add support for the AVX registers, because this info could
also be present in the elf-core file (note NT_X86_XSTATE - that is the result of
the newer XSAVE instruction). Parsing the contents from the file is
easy. The problem is that the ymm registers are split into two halves
and they are in different places in the note. For making this work one
would either make a "hacky" approach, because there won't be
any other way with the current state of the register contexts - they
assume that "this register is of size N and at offset M" and
don't have the notion of discontinuos registers.

Reviewers: labath

Subscribers: emaste, lldb-commits

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

llvm-svn: 287506

7 years ago[mips] Restrict tail call optimization
Simon Dardis [Sun, 20 Nov 2016 21:23:08 +0000 (21:23 +0000)]
[mips] Restrict tail call optimization

The tail call optimization was being used without proper consideration of
ABI requirements for saving and restoring the GP. This patch restricts tail
call optimization to functions within the same translation unit.

Reviewers: vkalintiris

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

llvm-svn: 287505

7 years ago[X86][SSE] Add some initial combine tests that could (should?) use PACKSS
Simon Pilgrim [Sun, 20 Nov 2016 21:12:49 +0000 (21:12 +0000)]
[X86][SSE] Add some initial combine tests that could (should?) use PACKSS

llvm-svn: 287504

7 years ago[AVX-512] Add tests for masked palignr/valignd/valignq shuffles, many of which show...
Craig Topper [Sun, 20 Nov 2016 19:50:32 +0000 (19:50 +0000)]
[AVX-512] Add tests for masked palignr/valignd/valignq shuffles, many of which show failures to fold the masking into the operation.

Many of these problems are because shuffle lowering widens element size and reduces element count when possible. This causes the shuffle to become separated from the select by a bitcast. Future patches will work to improve these cases by rewriting the shuffle back to a narrow element type if we think it can result in folding the mask.

llvm-svn: 287503

7 years agoThe 'vpmultishiftqb' instruction was implemented falsely, this patch amend it.
Coby Tayree [Sun, 20 Nov 2016 17:19:55 +0000 (17:19 +0000)]
The 'vpmultishiftqb' instruction was implemented falsely, this patch amend it.
More specifically - (MS dialect) broadcasting variants were implemented falsely.

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

llvm-svn: 287501

7 years agoSome instructions were missing, other implemented falsely. this patch aims at amendin...
Coby Tayree [Sun, 20 Nov 2016 17:09:56 +0000 (17:09 +0000)]
Some instructions were missing, other implemented falsely. this patch aims at amending those issues. full list:

vcvtps2pd
vcvtudq2pd
vcvtps2qq
vcvttps2qq
vcvtps2uqq
vcvttps2uqq

variants are:

[Dst]XMM(zero-masked/merge-masked/unmasked)
[Src]Mem64

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

llvm-svn: 287500

7 years ago[X86][AVX512] Combine unary + zero target shuffles to VPERMV3 with a zero vector...
Simon Pilgrim [Sun, 20 Nov 2016 16:11:36 +0000 (16:11 +0000)]
[X86][AVX512] Combine unary + zero target shuffles to VPERMV3 with a zero vector where possible

llvm-svn: 287497

7 years ago[X86][AVX512] Add support for VBMI VPERMV3 target shuffle combines
Simon Pilgrim [Sun, 20 Nov 2016 15:24:38 +0000 (15:24 +0000)]
[X86][AVX512] Add support for VBMI VPERMV3 target shuffle combines

llvm-svn: 287496

7 years ago[X86][AVX512] Add support for VBMI VPERMV target shuffle combines
Simon Pilgrim [Sun, 20 Nov 2016 15:05:45 +0000 (15:05 +0000)]
[X86][AVX512] Add support for VBMI VPERMV target shuffle combines

llvm-svn: 287495

7 years ago[X86][AVX512] Add some initial VBMI target shuffle combine tests
Simon Pilgrim [Sun, 20 Nov 2016 14:45:46 +0000 (14:45 +0000)]
[X86][AVX512] Add some initial VBMI target shuffle combine tests

llvm-svn: 287494

7 years ago[X86][AVX512VL] Removed duplicate operation action
Simon Pilgrim [Sun, 20 Nov 2016 14:19:29 +0000 (14:19 +0000)]
[X86][AVX512VL] Removed duplicate operation action

Basic AVX512F already declared uint_to_fp v4i32 as legal

llvm-svn: 287493

7 years agoStrip trailing whitespace
Simon Pilgrim [Sun, 20 Nov 2016 14:05:23 +0000 (14:05 +0000)]
Strip trailing whitespace

llvm-svn: 287492

7 years ago[X86][AVX512F] Add support for uint_to_fp v2i32 to v2f64 on AVX512F-only targets
Simon Pilgrim [Sun, 20 Nov 2016 14:03:23 +0000 (14:03 +0000)]
[X86][AVX512F] Add support for uint_to_fp v2i32 to v2f64 on AVX512F-only targets

Use 512-bit instructions (we already do something similar for uint_to_fp v4i32 to v4f64)

llvm-svn: 287491

7 years agoFix comment typos. NFC.
Simon Pilgrim [Sun, 20 Nov 2016 13:47:59 +0000 (13:47 +0000)]
Fix comment typos. NFC.

Identified by Pedro Giffuni in PR27636.

llvm-svn: 287490

7 years agoFix spelling mistakes in Tools/Tests comments. NFC.
Simon Pilgrim [Sun, 20 Nov 2016 13:31:13 +0000 (13:31 +0000)]
Fix spelling mistakes in Tools/Tests comments. NFC.

Identified by Pedro Giffuni in PR27636.

llvm-svn: 287489

7 years agoFix spelling mistakes in Transforms comments. NFC.
Simon Pilgrim [Sun, 20 Nov 2016 13:19:49 +0000 (13:19 +0000)]
Fix spelling mistakes in Transforms comments. NFC.

Identified by Pedro Giffuni in PR27636.

llvm-svn: 287488

7 years agoFix spelling mistakes in SelectionDAG comments. NFC.
Simon Pilgrim [Sun, 20 Nov 2016 13:14:57 +0000 (13:14 +0000)]
Fix spelling mistakes in SelectionDAG comments. NFC.

Identified by Pedro Giffuni in PR27636.

llvm-svn: 287487

7 years agoFix comment typos. NFC.
Simon Pilgrim [Sun, 20 Nov 2016 13:10:51 +0000 (13:10 +0000)]
Fix comment typos. NFC.

Identified by Pedro Giffuni in PR27636.

llvm-svn: 287486

7 years ago[X86] RegCall - Handling long double arguments
Oren Ben Simhon [Sun, 20 Nov 2016 11:06:07 +0000 (11:06 +0000)]
[X86] RegCall - Handling long double arguments

The change is part of RegCall calling convention support for LLVM.
Long double (f80) requires special treatment as the first f80 parameter is saved in FP0 (floating point stack).
This review present the change and the corresponding tests.

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

llvm-svn: 287485

7 years ago[X86][InlineAsm]Test commit.
Coby Tayree [Sun, 20 Nov 2016 09:31:11 +0000 (09:31 +0000)]
[X86][InlineAsm]Test commit.
Fixing a wrong comment on X86AsmParser.cpp::ParseZ: "true" --> "false"

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

llvm-svn: 287484

7 years agoAdd doxygen comments to immintrin.h's intrinsics.
Ekaterina Romanova [Sun, 20 Nov 2016 08:35:05 +0000 (08:35 +0000)]
Add doxygen comments to immintrin.h's intrinsics.

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

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

llvm-svn: 287483

7 years agoFix file name resolution in nested response files
Serge Pavlov [Sun, 20 Nov 2016 06:25:07 +0000 (06:25 +0000)]
Fix file name resolution in nested response files

If a response file in construct `@file` was specified by relative name,
constructs `@file` nested within it were resolved incorrectly if the
flag RelativeNames in call to ExpandResponseFile was set to true.
This feature is used in configuration files, tests for it are in
respective change (see D24933).

llvm-svn: 287482

7 years agoUse auto for obvious types.
Rui Ueyama [Sun, 20 Nov 2016 02:43:44 +0000 (02:43 +0000)]
Use auto for obvious types.

llvm-svn: 287481

7 years agoDo not expose ICF class from the file.
Rui Ueyama [Sun, 20 Nov 2016 02:39:59 +0000 (02:39 +0000)]
Do not expose ICF class from the file.

Also this patch uses file-scope functions instead of class member function.

Now that ICF class is not visible from outside, InputSection class
can no longer be "friend" of it. So I removed the friend relation
and just make it expose the features to public.

llvm-svn: 287480

7 years agoExceptionDemo: remove some undefined behaviour
Saleem Abdulrasool [Sun, 20 Nov 2016 02:36:38 +0000 (02:36 +0000)]
ExceptionDemo: remove some undefined behaviour

The casting based reading of the LSDA could attempt to read unsuitably aligned
data.  Avoid that case by explicitly using a memcpy.  A similar approach is used
in libc++abi to address the same UB.

llvm-svn: 287479

7 years agoExceptionDemo: prefer headers over redeclarations
Saleem Abdulrasool [Sun, 20 Nov 2016 02:36:36 +0000 (02:36 +0000)]
ExceptionDemo: prefer headers over redeclarations

Rather than redeclaring the interfaces for exceptions, prefer using the
`unwind.h` header.  This is vended by at least gcc and clang, and can also be
found by an external unwinding library (e.g. libunwind).  Doing this simplifies
the example to the exception handling itself.  Minor tweaks are the result of
_Unwind_Context_t not being defined, which is just a typedef for struct
_Unwind_Context *.  NFC.

llvm-svn: 287478

7 years ago[bpf] add BPF disassembler
Alexei Starovoitov [Sun, 20 Nov 2016 02:25:00 +0000 (02:25 +0000)]
[bpf] add BPF disassembler

add BPF disassembler, so tools like llvm-objdump can be used:
$ llvm-objdump -d -no-show-raw-insn ./sockex1_kern.o

./sockex1_kern.o: file format ELF64-BPF

Disassembly of section socket1:
bpf_prog1:
       0: r6 = r1
       8: r0 = *(u8 *)skb[23]
      10: *(u32 *)(r10 - 4) = r0
      18: r1 = *(u32 *)(r6 + 4)
      20: if r1 != 4 goto 8
      28: r2 = r10
      30: r2 += -4

ld_imm64 (the only 16-byte insn) and special ld_abs/ld_ind instructions
had to be treated in a special way. The decoders for the rest of the insns
are automatically generated.

Add tests to cover new functionality.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 287477

7 years agoAttempt to fix big-endian buildbots.
Rui Ueyama [Sun, 20 Nov 2016 01:41:28 +0000 (01:41 +0000)]
Attempt to fix big-endian buildbots.

llvm-svn: 287476

7 years agoStyle fix. NFC.
Rui Ueyama [Sun, 20 Nov 2016 01:15:56 +0000 (01:15 +0000)]
Style fix. NFC.

llvm-svn: 287475

7 years agoFix buildbot.
Rui Ueyama [Sun, 20 Nov 2016 01:13:22 +0000 (01:13 +0000)]
Fix buildbot.

llvm-svn: 287474

7 years agoSHA1: unroll loop in hashBlock.
Rui Ueyama [Sun, 20 Nov 2016 01:03:22 +0000 (01:03 +0000)]
SHA1: unroll loop in hashBlock.

This code is taken from public domain.
https://github.com/jsonn/src/blob/trunk/common/lib/libc/hash/sha1/sha1.c

I wrote a sha1 command and ran it on my Xeon E5-2680 v2 2.80GHz machine.
Here is a result. The new hash function is 37% faster than before.

 Performance counter stats for './llvm-sha1-old /ssd/build/bin/lld' (10 runs):

       6640.503687 task-clock (msec)         #    1.001 CPUs utilized            ( +-  0.03% )
                54 context-switches          #    0.008 K/sec                    ( +-  5.03% )
                 5 cpu-migrations            #    0.001 K/sec                    ( +- 31.73% )
           183,803 page-faults               #    0.028 M/sec                    ( +-  0.00% )
    18,527,954,113 cycles                    #    2.790 GHz                      ( +-  0.03% )
     4,993,237,485 stalled-cycles-frontend   #   26.95% frontend cycles idle     ( +-  0.11% )
   <not supported> stalled-cycles-backend
    50,217,149,423 instructions              #    2.71  insns per cycle
                                             #    0.10  stalled cycles per insn  ( +-  0.00% )
     6,094,322,337 branches                  #  917.750 M/sec                    ( +-  0.00% )
        11,778,239 branch-misses             #    0.19% of all branches          ( +-  0.01% )

       6.634017401 seconds time elapsed                                          ( +-  0.03% )

 Performance counter stats for './llvm-sha1-new /ssd/build/bin/lld' (10 runs):

       4167.062720 task-clock (msec)         #    1.001 CPUs utilized            ( +-  0.02% )
                52 context-switches          #    0.012 K/sec                    ( +- 16.45% )
                 7 cpu-migrations            #    0.002 K/sec                    ( +- 32.20% )
           183,804 page-faults               #    0.044 M/sec                    ( +-  0.00% )
    11,626,611,958 cycles                    #    2.790 GHz                      ( +-  0.02% )
     4,491,897,976 stalled-cycles-frontend   #   38.63% frontend cycles idle     ( +-  0.05% )
   <not supported> stalled-cycles-backend
    24,320,180,617 instructions              #    2.09  insns per cycle
                                             #    0.18  stalled cycles per insn  ( +-  0.00% )
     1,574,674,576 branches                  #  377.886 M/sec                    ( +-  0.00% )
        11,769,693 branch-misses             #    0.75% of all branches          ( +-  0.00% )

       4.163251552 seconds time elapsed                                          ( +-  0.02% )

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

llvm-svn: 287473

7 years agoDemangle: remove references to allocator for default allocator
Saleem Abdulrasool [Sun, 20 Nov 2016 00:20:27 +0000 (00:20 +0000)]
Demangle: remove references to allocator for default allocator

The demangler had stopped using a custom allocator but had not been updated to
remove the use of the explicit allocator passing.  This removes that as we do
not need to do anything special here anymore.  This just makes the code more
compact.  NFC.

llvm-svn: 287472

7 years agoDemangle: remove unnecessary typedef for std::vector
Saleem Abdulrasool [Sun, 20 Nov 2016 00:20:25 +0000 (00:20 +0000)]
Demangle: remove unnecessary typedef for std::vector

We could create a local typedef for std::vector called Vector.  Inline the use
of std::vector rather than use the typedef.  NFC.

llvm-svn: 287471

7 years agoDemangle: replace custom typedef for std::string with std::string
Saleem Abdulrasool [Sun, 20 Nov 2016 00:20:23 +0000 (00:20 +0000)]
Demangle: replace custom typedef for std::string with std::string

We created a local typedef for `std::basic_string<char, std::char_traits<char>>`
which is just `std::string`.  Remove the local typedef and propagate the type
information through the rest of the demangler.  NFC.

llvm-svn: 287470

7 years agoDemangle: use direct member initialization (NFC)
Saleem Abdulrasool [Sun, 20 Nov 2016 00:20:20 +0000 (00:20 +0000)]
Demangle: use direct member initialization (NFC)

Prefer direct member initialization over the explicit out-of-line initialization
for the construction of the local type.  NFC.

llvm-svn: 287469

7 years agoRemove a file that is too short to be an independent file.
Rui Ueyama [Sat, 19 Nov 2016 23:26:41 +0000 (23:26 +0000)]
Remove a file that is too short to be an independent file.

We have a .cpp and a .h for parseDynamicList(). This patch
moves the function to DriverUtil.cpp.

llvm-svn: 287468

7 years agoRemove unused #include.
Rui Ueyama [Sat, 19 Nov 2016 23:18:43 +0000 (23:18 +0000)]
Remove unused #include.

llvm-svn: 287467

7 years agoRefactor ICF.
Rui Ueyama [Sat, 19 Nov 2016 23:14:23 +0000 (23:14 +0000)]
Refactor ICF.

In order to use forEachGroup in the final loop in ICF::run,
I changed some function parameter types.

llvm-svn: 287466

7 years agobuiltins: Allow building windows arm functions for mingw
Martin Storsjo [Sat, 19 Nov 2016 21:22:38 +0000 (21:22 +0000)]
builtins: Allow building windows arm functions for mingw

When building with clang/LLVM in MSVC mode, the msvcrt libraries contain
these functions.

When building in a mingw environment, we need to provide them somehow,
e.g. via compiler-rt.

The aeabi divmod functions work in the same way as the corresponding
__rt_*div* functions for windows, but their parameters are swapped.
The functions for converting float to integer and vice versa are the
same as their aeabi equivalents, only with different function names.

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

llvm-svn: 287465

7 years ago[ARM|ASAN] Disabling more unstable ASAN tests
Renato Golin [Sat, 19 Nov 2016 21:19:19 +0000 (21:19 +0000)]
[ARM|ASAN] Disabling more unstable ASAN tests

We're seeying these errors with GCC and Clang on different systems, while
some other identical OSs on different boards fail. Like many other ASAN
tests, there seem to be no easy way to investigate this other than someone
familiar with the sanitizer code and the ARM libraries.

At least, for now, we'll silence the bots. I'll create a bugzilla entry.

llvm-svn: 287464

7 years ago[CMake] Fixing clang standalone build
Chris Bieneman [Sat, 19 Nov 2016 21:14:59 +0000 (21:14 +0000)]
[CMake] Fixing clang standalone build

I broke this in r287406 and r287407.

llvm-svn: 287463

7 years agoGive some helper classes/functions internal linkage. NFC.
Benjamin Kramer [Sat, 19 Nov 2016 20:44:26 +0000 (20:44 +0000)]
Give some helper classes/functions internal linkage. NFC.

llvm-svn: 287462

7 years ago[X86][SSE] Improve PSHUFB lowering from either input
Simon Pilgrim [Sat, 19 Nov 2016 20:41:48 +0000 (20:41 +0000)]
[X86][SSE] Improve PSHUFB lowering from either input

Canonicalization may leave the zeroable vector in the first input.

llvm-svn: 287461

7 years agoUse std::equal instead of hand-written loops.
Rui Ueyama [Sat, 19 Nov 2016 20:15:55 +0000 (20:15 +0000)]
Use std::equal instead of hand-written loops.

llvm-svn: 287460

7 years ago[X86][AVX512] Add VPERMV/VPERMV3 v64i8 byte shuffles on avx512vbmi targets
Simon Pilgrim [Sat, 19 Nov 2016 20:12:34 +0000 (20:12 +0000)]
[X86][AVX512] Add VPERMV/VPERMV3 v64i8 byte shuffles on avx512vbmi targets

llvm-svn: 287459

7 years agoRemove alignment from ctors/dtors lists in an attempt to placate LTO.
John McCall [Sat, 19 Nov 2016 20:12:25 +0000 (20:12 +0000)]
Remove alignment from ctors/dtors lists in an attempt to placate LTO.

llvm-svn: 287458

7 years agoRestore a comment that was accidentally changed.
Rui Ueyama [Sat, 19 Nov 2016 19:26:52 +0000 (19:26 +0000)]
Restore a comment that was accidentally changed.

llvm-svn: 287457

7 years agoUse Optional<std::string> instead of "" to represent a failure.
Rui Ueyama [Sat, 19 Nov 2016 19:23:58 +0000 (19:23 +0000)]
Use Optional<std::string> instead of "" to represent a failure.

llvm-svn: 287456

7 years agoMake buildSysrootedPath file-scoped.
Rui Ueyama [Sat, 19 Nov 2016 19:23:56 +0000 (19:23 +0000)]
Make buildSysrootedPath file-scoped.

This patch also changes its return type to simplify callers.

llvm-svn: 287455

7 years agoSimplify "missing argument" error message.
Rui Ueyama [Sat, 19 Nov 2016 18:49:38 +0000 (18:49 +0000)]
Simplify "missing argument" error message.

We do not have an option taking more than one arguments,
so we can just say "missing argument" instead of "missing argument(s)".

llvm-svn: 287454

7 years ago[ThinLTO] Fix crash when importing an opaque type
Mehdi Amini [Sat, 19 Nov 2016 18:44:16 +0000 (18:44 +0000)]
[ThinLTO] Fix crash when importing an opaque type

It seems that because ThinLTO does not import the full module,
some invariant of the type mapper are broken.

In Monolithic LTO, we import every globals: when calling
IRLinker::copyFunctionProto() on @foo(), we end-up calling
TypeMapTy::get(FTy) on the type of @foo(), which will map
%0 and record the destination as opaque.

ThinLTO skips this because @foo is not imported and goes directly
to the next stage.

Next we call computeTypeMapping() that map the types for each
globals, and ends up checking for type isomorphism, and may add
type mapping. However it doesn't record if there was an opaque
destination type that was resolved.

Instead of lazily "discovering" opaque type in the destination
module on the go, we change the TypeFinder to eagerly record all
types and not only the named ones.

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

llvm-svn: 287453

7 years agoSplit getFdeEncoding.
Rui Ueyama [Sat, 19 Nov 2016 18:44:09 +0000 (18:44 +0000)]
Split getFdeEncoding.

llvm-svn: 287452

7 years agoFix typo in error message.
Rui Ueyama [Sat, 19 Nov 2016 18:34:55 +0000 (18:34 +0000)]
Fix typo in error message.

llvm-svn: 287451

7 years ago[ThinLTO] Implement -pass-remarks-output in ThinLTOCodeGenerator
Mehdi Amini [Sat, 19 Nov 2016 18:20:05 +0000 (18:20 +0000)]
[ThinLTO] Implement -pass-remarks-output in ThinLTOCodeGenerator

Summary:
This will also be added to the LTO API, right now this will
bring ThinLTO on par with Monolithic LTO on Darwin.

Reviewers: anemet

Subscribers: tejohnson, llvm-commits

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

llvm-svn: 287450

7 years agoChange setDiagnosticsOutputFile to take a unique_ptr from a raw pointer (NFC)
Mehdi Amini [Sat, 19 Nov 2016 18:19:41 +0000 (18:19 +0000)]
Change setDiagnosticsOutputFile to take a unique_ptr from a raw pointer (NFC)

Summary:
This makes it explicit that ownership is taken. Also replace all `new`
with make_unique<> at call sites.

Reviewers: anemet

Subscribers: llvm-commits

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

llvm-svn: 287449

7 years ago[ELF] - Exit on --version call.
George Rimar [Sat, 19 Nov 2016 18:14:24 +0000 (18:14 +0000)]
[ELF] - Exit on --version call.

GNU linkers disagree here.
Though both -version and -v are mentioned
in help to print the version information, GNU ld just normally exits,
while gold can continue linking. We are compatible with ld.bfd here.

This fixes PR31057.

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

llvm-svn: 287448