platform/upstream/llvm.git
7 years ago[AMDGPU] Fix multiple vreg definitions in si-lower-control-flow
Stanislav Mekhanoshin [Tue, 22 Nov 2016 01:42:34 +0000 (01:42 +0000)]
[AMDGPU] Fix multiple vreg definitions in si-lower-control-flow

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

llvm-svn: 287608

7 years agoRemove redundant assignment.
Rui Ueyama [Tue, 22 Nov 2016 01:36:19 +0000 (01:36 +0000)]
Remove redundant assignment.

llvm-svn: 287607

7 years agoConvert BuildId a derived class of SyntheticSection.
Rui Ueyama [Tue, 22 Nov 2016 01:31:32 +0000 (01:31 +0000)]
Convert BuildId a derived class of SyntheticSection.

Some synthetic sections are not derived calsses of SyntehticSection.
They are derived directly from InputSection. For consistencly, we should
use SyntheticSection.

llvm-svn: 287606

7 years agoRemove a parameter from getOutputLoc and rename for readability. NFC.
Rui Ueyama [Tue, 22 Nov 2016 01:10:34 +0000 (01:10 +0000)]
Remove a parameter from getOutputLoc and rename for readability. NFC.

llvm-svn: 287605

7 years agoAnalysis: gep inbounds (gep inbounds (...)) is inbounds.
Peter Collingbourne [Tue, 22 Nov 2016 01:03:40 +0000 (01:03 +0000)]
Analysis: gep inbounds (gep inbounds (...)) is inbounds.

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

llvm-svn: 287604

7 years agoMerge BuildId subclasses.
Rui Ueyama [Tue, 22 Nov 2016 00:54:15 +0000 (00:54 +0000)]
Merge BuildId subclasses.

We had five different BuildId subclasses for five different types
of build-ids. They can simply be merged to a single class.

llvm-svn: 287603

7 years agoFix -Asserts build, and add some more test cases.
Peter Collingbourne [Tue, 22 Nov 2016 00:43:30 +0000 (00:43 +0000)]
Fix -Asserts build, and add some more test cases.

llvm-svn: 287602

7 years agoSema, CodeGen: Ensure that an implicit copy ctor is available more often under the...
Peter Collingbourne [Tue, 22 Nov 2016 00:21:43 +0000 (00:21 +0000)]
Sema, CodeGen: Ensure that an implicit copy ctor is available more often under the Microsoft C++ ABI.

This is needed because whether the constructor is deleted can control whether
we pass structs by value directly.

To fix this properly we probably want a more direct way for CodeGen to ask
whether the constructor was deleted.

Fixes PR31049.

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

llvm-svn: 287600

7 years agoIndicate in AST dump whether special member functions are defaulted and trivial.
Richard Smith [Mon, 21 Nov 2016 23:43:54 +0000 (23:43 +0000)]
Indicate in AST dump whether special member functions are defaulted and trivial.

llvm-svn: 287599

7 years agoFix a bug caught by adding LLVM_NODISCARD to StringRef.
Zachary Turner [Mon, 21 Nov 2016 23:18:13 +0000 (23:18 +0000)]
Fix a bug caught by adding LLVM_NODISCARD to StringRef.

llvm-svn: 287598

7 years agoAdd the new Args / entry-access API.
Zachary Turner [Mon, 21 Nov 2016 23:18:07 +0000 (23:18 +0000)]
Add the new Args / entry-access API.

The long-term goal here is to get rid of the functions
GetArgumentAtIndex() and GetQuoteCharAtIndex(), instead
replacing them with operator based access and range-based for
enumeration.  There are a lot of callsites, though, so the
changes will be done incrementally, starting with this one.

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

llvm-svn: 287597

7 years agoRemove LLVM_NODISCARD in one more place.
Zachary Turner [Mon, 21 Nov 2016 23:17:15 +0000 (23:17 +0000)]
Remove LLVM_NODISCARD in one more place.

llvm-svn: 287596

7 years agoRemove useless newlines.
Rui Ueyama [Mon, 21 Nov 2016 23:17:09 +0000 (23:17 +0000)]
Remove useless newlines.

llvm-svn: 287595

7 years agoRemove LLVM_NODISCARD from two more StringRef members.
Zachary Turner [Mon, 21 Nov 2016 23:02:28 +0000 (23:02 +0000)]
Remove LLVM_NODISCARD from two more StringRef members.

This should be everything.

llvm-svn: 287594

7 years agoDAG: Ignore call site attributes when emitting target intrinsic
Matt Arsenault [Mon, 21 Nov 2016 22:56:42 +0000 (22:56 +0000)]
DAG: Ignore call site attributes when emitting target intrinsic

A target intrinsic may be defined as possibly reading memory,
but the call site may have additional knowledge that it doesn't read
memory. The intrinsic lowering will expect the pessimistic
assumption of the intrinsic definition, so the chain should
still be used.

llvm-svn: 287593

7 years ago[AArch64LoadStoreOptimizer] Don't treat write to XZR/WZR as a clobber.
Geoff Berry [Mon, 21 Nov 2016 22:51:10 +0000 (22:51 +0000)]
[AArch64LoadStoreOptimizer] Don't treat write to XZR/WZR as a clobber.

Summary:
When searching for load/store instructions to pair/merge don't treat
writes to WZR/XZR as clobbers since they don't change the value read
from WZR/XZR (which is always 0).

Reviewers: mcrosier, junbuml, jmolloy, t.p.northover

Subscribers: aemerson, llvm-commits, rengolin

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

llvm-svn: 287592

7 years ago[CodeGenPrepare] Don't sink non-cheap addrspacecasts.
Justin Lebar [Mon, 21 Nov 2016 22:49:15 +0000 (22:49 +0000)]
[CodeGenPrepare] Don't sink non-cheap addrspacecasts.

Summary:
Previously, CGP would unconditionally sink addrspacecast instructions,
even going so far as to sink them into a loop.

Now we check that the cast is "cheap", as defined by TLI.

We introduce a new "is-cheap" function to TLI rather than using
isNopAddrSpaceCast because some GPU platforms want the ability to ask
for non-nop casts to be sunk.

Reviewers: arsenm, tra

Subscribers: jholewinski, wdng, llvm-commits

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

llvm-svn: 287591

7 years ago[CodeGenPrepare] Rewrite a loop in terms of llvm::none_of. NFC.
Justin Lebar [Mon, 21 Nov 2016 22:49:11 +0000 (22:49 +0000)]
[CodeGenPrepare] Rewrite a loop in terms of llvm::none_of.  NFC.

Reviewers: arsenm

Subscribers: wdng, llvm-commits

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

llvm-svn: 287590

7 years agoRemove LLVM_NODISCARD from getAsInteger().
Zachary Turner [Mon, 21 Nov 2016 22:47:23 +0000 (22:47 +0000)]
Remove LLVM_NODISCARD from getAsInteger().

llvm-svn: 287589

7 years ago[LoopReroll] Make root-finding more aggressive.
Eli Friedman [Mon, 21 Nov 2016 22:35:34 +0000 (22:35 +0000)]
[LoopReroll] Make root-finding more aggressive.

Allow using an instruction other than a mul or phi as the base for
root-finding. For example, the included testcase includes a loop
which requires using a getelementptr as the base for root-finding.

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

llvm-svn: 287588

7 years agoFix attribute list syntax.
Zachary Turner [Mon, 21 Nov 2016 22:29:38 +0000 (22:29 +0000)]
Fix attribute list syntax.

llvm-svn: 287587

7 years agoRemove LLVM_NODISCARD from StringRef.
Zachary Turner [Mon, 21 Nov 2016 22:19:25 +0000 (22:19 +0000)]
Remove LLVM_NODISCARD from StringRef.

This is a bit too aggressive of a warning, as it is forces
ANY function which returns a StringRef to have its return
value checked.  While useful on classes like llvm::Error which
are designed to require checking, this is not the case for
StringRef, and it is perfectly reasonable to have a function
return a StringRef for which the return value is not checked.

Move LLVM_NODISCARD to each of the individual member functions
where it makes sense instead.

llvm-svn: 287586

7 years ago[InstCombine] canonicalize min/max constant to select's false value
Sanjay Patel [Mon, 21 Nov 2016 22:04:14 +0000 (22:04 +0000)]
[InstCombine] canonicalize min/max constant to select's false value

This is a first step towards canonicalization and improved folding/codegen
for integer min/max as discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2016-November/106868.html

Here, we're just matching the simplest min/max patterns and adjusting the
icmp predicate while swapping the select operands.

I've included FIXME tests in test/Transforms/InstCombine/select_meta.ll
so it's easier to see how this might be extended (corresponds to the TODO
comment in the code). That's also why I'm using matchSelectPattern()
rather than a simpler check; once the backend is patched, we can just
remove some of the restrictions to allow the obfuscated min/max patterns
in the FIXME tests to be matched.

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

llvm-svn: 287585

7 years agoLSR debug fix.
Evgeny Stupachenko [Mon, 21 Nov 2016 21:55:03 +0000 (21:55 +0000)]
LSR debug fix.

Summary:
Dump instruction instead of address.
Reviewers: hfinkel

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

From: Evgeny Stupachenko <evstupac@gmail.com>
llvm-svn: 287584

7 years agoreassociate-deadinst.ll: avoid accidental match on path
Hubert Tong [Mon, 21 Nov 2016 21:53:01 +0000 (21:53 +0000)]
reassociate-deadinst.ll: avoid accidental match on path

Pipe from stdin to avoid accidentally matching on the path.

llvm-svn: 287583

7 years agofix formatting; NFC
Sanjay Patel [Mon, 21 Nov 2016 21:48:36 +0000 (21:48 +0000)]
fix formatting; NFC

llvm-svn: 287582

7 years ago[asan] Specialize the initialization-bug.cc testcase for Darwin (it needs a deploymen...
Kuba Mracek [Mon, 21 Nov 2016 21:48:25 +0000 (21:48 +0000)]
[asan] Specialize the initialization-bug.cc testcase for Darwin (it needs a deployment target of 10.11+)

The ODR detection in initialization-bug.cc now works on Darwin (due to the recently enabled "live globals" on-by-default), but only if the deployment target is 10.11 or higher. Let's adjust the testcases.

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

llvm-svn: 287581

7 years agoAdd a test for vcall on a null ptr.
Ivan Krasin [Mon, 21 Nov 2016 21:23:56 +0000 (21:23 +0000)]
Add a test for vcall on a null ptr.

Summary:
Turns out that in the case of -fsanitize=null and a virtual call,
the type check was generated *after* reading from vtable, which
causes a non-interpretable segfault. The check has been moved up
in https://reviews.llvm.org/D26559 and this CL adds a test for this case.

Reviewers: pcc

Subscribers: cfe-commits, kubabrecka

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

llvm-svn: 287578

7 years ago[asan] Un-XFAIL Windows global dead stripping test cases
Reid Kleckner [Mon, 21 Nov 2016 20:40:56 +0000 (20:40 +0000)]
[asan] Un-XFAIL Windows global dead stripping test cases

Test update for r287576

llvm-svn: 287577

7 years ago[asan] Make ASan compatible with linker dead stripping on Windows
Reid Kleckner [Mon, 21 Nov 2016 20:40:37 +0000 (20:40 +0000)]
[asan] Make ASan compatible with linker dead stripping on Windows

Summary:
This is similar to what was done for Darwin in rL264645 /
http://reviews.llvm.org/D16737, but it uses COFF COMDATs to achive the
same result instead of relying on new custom linker features.

As on MachO, this creates one metadata global per instrumented global.
The metadata global is placed in the custom .ASAN$GL section, which the
ASan runtime will iterate over during initialization. There are no other
references to the metadata, so normal linker dead stripping would
discard it. However, the metadata is put in a COMDAT group with the
instrumented global, so that it will be discarded if and only if the
instrumented global is discarded.

I didn't update the ASan ABI version check since this doesn't affect
non-Windows platforms, and the WinASan ABI isn't really stable yet.

Implementing this for ELF will require extending LLVM IR and MC a bit so
that we can use non-COMDAT section groups.

Reviewers: pcc, kcc, mehdi_amini, kubabrecka

Subscribers: llvm-commits

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

llvm-svn: 287576

7 years ago[MemorySSA] Fix unit tests broken by D26704
Mandeep Singh Grang [Mon, 21 Nov 2016 20:39:08 +0000 (20:39 +0000)]
[MemorySSA] Fix unit tests broken by D26704

Summary:
D26704 fixed the non-determinism in codegen by sorting basic blocks before
iteration so as to have a defined iteration order. As a result we need to fix
the names (numbers) of the temporaries in the following unit tests:
  test/Transforms/Util/MemorySSA/multi-edges.ll
  test/Transforms/Util/MemorySSA/multiple-backedges-hal.ll

Reviewers: dberlin, david2050, mgrang

Subscribers: llvm-commits

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

llvm-svn: 287575

7 years ago[mips] Add tests for half precision floating point support.
Simon Dardis [Mon, 21 Nov 2016 20:34:10 +0000 (20:34 +0000)]
[mips] Add tests for half precision floating point support.

These should have been part of r287349.

llvm-svn: 287574

7 years ago[mips] seq macro support
Simon Dardis [Mon, 21 Nov 2016 20:30:41 +0000 (20:30 +0000)]
[mips] seq macro support

This patch adds the seq macro.

This partially resolves PR/30381.

Thanks to Sean Bruno for reporting the issue!

Reviewers: zoran.jovanovic, vkalintiris, seanbruno

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

llvm-svn: 287573

7 years agoUpdate comment for r287566
Hongbin Zheng [Mon, 21 Nov 2016 20:27:55 +0000 (20:27 +0000)]
Update comment for r287566

llvm-svn: 287572

7 years agoCheck proper live range in extendPHIRanges
Krzysztof Parzyszek [Mon, 21 Nov 2016 20:24:12 +0000 (20:24 +0000)]
Check proper live range in extendPHIRanges

The function extendPHIRanges checks the main range of the original live
interval, even when dealing with a subrange. This could also lead to an
assert when the subrange is not live at the extension point, but the
main range is. To avoid this, check the corresponding subrange of the
original live range, instead of always checking the main range.

Review (as a part of a bigger set of changes):
https://reviews.llvm.org/D26359

llvm-svn: 287571

7 years ago[TLI] Fix breakage introduced by D21739.
Marcin Koscielnicki [Mon, 21 Nov 2016 20:20:39 +0000 (20:20 +0000)]
[TLI] Fix breakage introduced by D21739.

The initialize function has an early return for AMDGPU targets.  If taken,
the ShouldExtI32* initialization code will not be executed, resulting in
invalid values in the corresponding fields.  Fix this by moving the code
to the top of the function.

llvm-svn: 287570

7 years agoUse the correct page size.
Rafael Espindola [Mon, 21 Nov 2016 20:20:04 +0000 (20:20 +0000)]
Use the correct page size.

Config->MaxPageSize is what we use for the segment alignment, so that
is the one that we have to use for placing the header.

llvm-svn: 287569

7 years agoFix format
Hongbin Zheng [Mon, 21 Nov 2016 20:17:00 +0000 (20:17 +0000)]
Fix format

llvm-svn: 287568

7 years ago[AsmPrinter] Enable codeview for windows-itanium
Shoaib Meenai [Mon, 21 Nov 2016 20:13:32 +0000 (20:13 +0000)]
[AsmPrinter] Enable codeview for windows-itanium

Enable codeview emission for windows-itanium targets. Co-opt an existing
test (which is derived from a C source file and should therefore be
identical across the Itanium and MS ABIs).

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

llvm-svn: 287567

7 years agoSplit ScopInfo::addScopStmt into two versions. NFC
Hongbin Zheng [Mon, 21 Nov 2016 20:09:40 +0000 (20:09 +0000)]
Split ScopInfo::addScopStmt into two versions. NFC

One for adding statement for region, another one for BB

llvm-svn: 287566

7 years agoFix address computation for headers.
Rafael Espindola [Mon, 21 Nov 2016 19:59:33 +0000 (19:59 +0000)]
Fix address computation for headers.

If the linker script has SECTIONS, the address computation is now
always done in LinkerScript::assignAddresses, like for any other
section.

Before fixHeaders would do a tentative computation that
assignAddresses would sometimes override.

This patch also splits the cases where assignAddresses needs to add
the headers to the first PT_LOAD and the address computation. The net
effect is that we no longer create an empty page for no reason in the
included test case, which matches bfd behavior.

llvm-svn: 287565

7 years agoMove a function definition to SyntheticSections.cpp.
Rui Ueyama [Mon, 21 Nov 2016 19:46:04 +0000 (19:46 +0000)]
Move a function definition to SyntheticSections.cpp.

This should have been moved along with r287554.

llvm-svn: 287564

7 years ago[MemorySSA] Fix for non-determinism in codegen
Mandeep Singh Grang [Mon, 21 Nov 2016 19:33:02 +0000 (19:33 +0000)]
[MemorySSA] Fix for non-determinism in codegen

This patch fixes the non-determinism caused due to iterating SmallPtrSet's
which was uncovered due to the experimental "reverse iteration order " patch:
https://reviews.llvm.org/D26718

The following unit tests failed because of the undefined order of iteration.
LLVM :: Transforms/Util/MemorySSA/cyclicphi.ll
LLVM :: Transforms/Util/MemorySSA/many-dom-backedge.ll
LLVM :: Transforms/Util/MemorySSA/many-doms.ll
LLVM :: Transforms/Util/MemorySSA/phi-translation.ll

Reviewers: dberlin, mgrang

Subscribers: dberlin, llvm-commits, david2050

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

llvm-svn: 287563

7 years agoMinor change
Hongbin Zheng [Mon, 21 Nov 2016 19:26:10 +0000 (19:26 +0000)]
Minor change

llvm-svn: 287562

7 years ago[VectorLegalizer] Remove EVT::getSizeInBits code duplications. NFCI.
Simon Pilgrim [Mon, 21 Nov 2016 18:24:44 +0000 (18:24 +0000)]
[VectorLegalizer] Remove EVT::getSizeInBits code duplications. NFCI.

We were calling SVT.getSizeInBits() several times in a row - just call it once and reuse the result.

llvm-svn: 287556

7 years agoDo plumbing work for CodeView debug info.
Rui Ueyama [Mon, 21 Nov 2016 17:22:35 +0000 (17:22 +0000)]
Do plumbing work for CodeView debug info.

Previously, we discarded .debug$ sections. This patch adds them to
files so that PDB.cpp can access them.

This patch also adds a debug option, /dumppdb, to dump debug info
fed to createPDB so that we can verify that valid data has been passed.

llvm-svn: 287555

7 years ago[ELF] Convert Version*** sections to input sections
Eugene Leviant [Mon, 21 Nov 2016 16:59:33 +0000 (16:59 +0000)]
[ELF] Convert Version*** sections to input sections

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

llvm-svn: 287554

7 years ago[CodeGenPrep] Skip merging empty case blocks
Jun Bum Lim [Mon, 21 Nov 2016 16:47:28 +0000 (16:47 +0000)]
[CodeGenPrep] Skip merging empty case blocks

Summary: Merging an empty case block into the header block of switch could cause
ISel to add COPY instructions in the header of switch, instead of the case
block, if the case block is used as an incoming block of a PHI. This could
potentially increase dynamic instructions, especially when the switch is in a
loop. I added a test case which was reduced from the benchmark I was targetting.

Reviewers: t.p.northover, mcrosier, manmanren, wmi, davidxl

Subscribers: qcolombet, danielcdh, hfinkel, mcrosier, llvm-commits

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

llvm-svn: 287553

7 years agoSet task->td_dephash to NULL after free
Jonathan Peyton [Mon, 21 Nov 2016 16:24:59 +0000 (16:24 +0000)]
Set task->td_dephash to NULL after free

llvm-svn: 287552

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