platform/upstream/llvm.git
6 years ago[CodeGen] Use the zero initializer instead of storing an all zero representation.
Matt Davis [Fri, 9 Feb 2018 22:10:09 +0000 (22:10 +0000)]
[CodeGen] Use the zero initializer instead of storing an all zero representation.

Summary:
This change avoids the overhead of storing, and later crawling,
an initializer list of all zeros for arrays. When LLVM
visits this (llvm/IR/Constants.cpp) ConstantArray::getImpl()
it will scan the list looking for an array of all zero.

We can avoid the store, and short-cut the scan, by detecting
all zeros when clang builds-up the initialization representation.

This was brought to my attention when investigating PR36030

Reviewers: majnemer, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 324776

6 years agoMake LLDB's clang module cache path customizable
Adrian Prantl [Fri, 9 Feb 2018 22:08:26 +0000 (22:08 +0000)]
Make LLDB's clang module cache path customizable

This patch makes LLDB's clang module cache path customizable via
settings set target.clang-modules-cache-path <path> and uses it in the
LLDB testsuite to reuse the same location inside the build directory
for LLDB and clang.

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

llvm-svn: 324775

6 years ago[AMDGPUPromoteAlloca] Replace deprecated memory intrinsic APIs (NFCI)
Daniel Neilson [Fri, 9 Feb 2018 21:56:15 +0000 (21:56 +0000)]
[AMDGPUPromoteAlloca] Replace deprecated memory intrinsic APIs (NFCI)

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
AMDGPUPromoteAlloca pass to cease using:
1) The old getAlignment() API of MemoryIntrinsic in favour of getting source & dest specific
alignments through the new API.
2) The old IRBuilder createMemCpy/createMemMove single-alignment APIs in favour of the new
API that allows setting source and destination alignments independently.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, r323891, rL324148, rL324273, rL324278,
rL324384, rL324395, rL324402, rL324626, rL324642, rL324653, rL324654, rL324773 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 324774

6 years ago[AArch64FastISel] Replace deprecated calls to MemoryIntrinsic::getAlignment() (NFCI)
Daniel Neilson [Fri, 9 Feb 2018 21:49:29 +0000 (21:49 +0000)]
[AArch64FastISel] Replace deprecated calls to MemoryIntrinsic::getAlignment() (NFCI)

Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes
AArch64FastISel to cease using the old getAlignment() API of MemoryIntrinsic in favour of getting
source & dest specific alignments through the new API.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, r323891, rL324148, rL324273, rL324278,
rL324384, rL324395, rL324402, rL324626, rL324642, rL324653, rL324654 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

llvm-svn: 324773

6 years ago[X86][MC] Fix assembling rip-relative addressing + immediate displacements
Francis Visoiu Mistrih [Fri, 9 Feb 2018 21:47:07 +0000 (21:47 +0000)]
[X86][MC] Fix assembling rip-relative addressing + immediate displacements

In the rare case where the input contains rip-relative addressing with
immediate displacements, *and* the instruction ends with an immediate,
we encode the instruction in the wrong way:

movl $12345678, 0x400(%rdi) // all good, no rip-relative addr
movl %eax, 0x400(%rip) // all good, no immediate at the end of the instruction
movl $12345678, 0x400(%rip) // fails, encodes address as 0x3fc(%rip)

Offset is a label:

movl $12345678, foo(%rip)

we want to account for the size of the immediate (in this case,
$12345678, 4 bytes).

Offset is an immediate:

movl $12345678, 0x400(%rip)

we should not account for the size of the immediate, assuming the
immediate offset is what the user wanted.

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

llvm-svn: 324772

6 years ago[CodeGen] Add lifetime markers to the list of meta-instructions.
Matt Davis [Fri, 9 Feb 2018 21:34:34 +0000 (21:34 +0000)]
[CodeGen] Add lifetime markers to the list of meta-instructions.

Summary:
Since the lifetime markers are metadata instructions, they should probably be treated as such by the isMetaInstruction predicate.
There was no issue that provoked this change, I just ran across it while investigating another issue.

Reviewers: aprantl, MatzeB

Reviewed By: aprantl

Subscribers: llvm-commits

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

llvm-svn: 324771

6 years ago[WebAssebmly] Report undefined symbols correctly in objdump
Sam Clegg [Fri, 9 Feb 2018 20:21:50 +0000 (20:21 +0000)]
[WebAssebmly] Report undefined symbols correctly in objdump

Peviously we were reporting undefined symbol as being defined
by the IMPORT sections.

This change reports undefined symbols in the same that other
formats do, and also removes the need to store the section
with each symbol (since it can be derived from the symbol
type).

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

llvm-svn: 324770

6 years ago[CodeGen] Print predecessors as MIR comments in -debug output
Francis Visoiu Mistrih [Fri, 9 Feb 2018 19:46:02 +0000 (19:46 +0000)]
[CodeGen] Print predecessors as MIR comments in -debug output

Make -debug MBB headers more copy-pastable into mir files.

llvm-svn: 324769

6 years ago[lldb-mi] This test now passes consistently, unXFAIL it.
Davide Italiano [Fri, 9 Feb 2018 19:35:07 +0000 (19:35 +0000)]
[lldb-mi] This test now passes consistently, unXFAIL it.

llvm-svn: 324768

6 years agollvm-objdump when printing the Objective-C meta data also prints the Swift ABI
Kevin Enderby [Fri, 9 Feb 2018 19:31:27 +0000 (19:31 +0000)]
llvm-objdump when printing the Objective-C meta data also prints the Swift ABI
from the value stored in swift_version bits in the flags field in the
objc_image_info struct.  ABI version 3 thru 6 were previously added but this
code was not updated to print the Swift version.

rdar://35624067

llvm-svn: 324767

6 years ago[AArch64] Adjust the cost model for Exynos M3
Evandro Menezes [Fri, 9 Feb 2018 19:26:11 +0000 (19:26 +0000)]
[AArch64] Adjust the cost model for Exynos M3

Fix the modeling of transfers between a generic register and a partial ASIMD
one.

llvm-svn: 324766

6 years agoRemove "CHECK: entry" in test case.
Akira Hatanaka [Fri, 9 Feb 2018 19:25:31 +0000 (19:25 +0000)]
Remove "CHECK: entry" in test case.

rdar://problem/37397814

llvm-svn: 324765

6 years ago[Utils] Salvage debug info from dead 'or' instructions
Vedant Kumar [Fri, 9 Feb 2018 19:19:55 +0000 (19:19 +0000)]
[Utils] Salvage debug info from dead 'or' instructions

Extend salvageDebugInfo to preserve the debug info from a dead 'or'
with a constant.

Patch by Ismail Badawi!

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

llvm-svn: 324764

6 years ago[Hexagon] Add code to select QTRUE and QFALSE
Krzysztof Parzyszek [Fri, 9 Feb 2018 19:10:46 +0000 (19:10 +0000)]
[Hexagon] Add code to select QTRUE and QFALSE

Fixes http://llvm.org/PR36320.

llvm-svn: 324763

6 years ago[analyzer] [tests] Fixing an error after non-atomic cherry-pick
George Karpenkov [Fri, 9 Feb 2018 18:48:31 +0000 (18:48 +0000)]
[analyzer] [tests] Fixing an error after non-atomic cherry-pick

llvm-svn: 324762

6 years agoIntroduce an API for LLDB to compute the default module cache path
Adrian Prantl [Fri, 9 Feb 2018 18:43:10 +0000 (18:43 +0000)]
Introduce an API for LLDB to compute the default module cache path

LLDB creates Clang modules and had an incomplete copy of the clang
Driver code that compute the -fmodule-cache-path. This patch makes the
clang driver code accessible to LLDB.

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

llvm-svn: 324761

6 years agoDeclare PostDominatorTree as a class
Matt Arsenault [Fri, 9 Feb 2018 18:41:42 +0000 (18:41 +0000)]
Declare PostDominatorTree as a class

Before it was declared at a struct, which differs from
DominatorTree. Make it a class so both can be declared
the same way without hitting the warning about mismatched
struct vs. class declarations.

llvm-svn: 324760

6 years ago[analyzer] [tests] [NFC] Remove a fragile tightly-coupled component emulating parser...
George Karpenkov [Fri, 9 Feb 2018 18:39:47 +0000 (18:39 +0000)]
[analyzer] [tests] [NFC] Remove a fragile tightly-coupled component emulating parser output

...when we can just use the real parser instead.

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

llvm-svn: 324759

6 years ago[tablegen] Fixed few !foreach evaluation issues.
Artem Belevich [Fri, 9 Feb 2018 18:37:55 +0000 (18:37 +0000)]
[tablegen] Fixed few !foreach evaluation issues.

* !foreach on lists didn't evaluate operands of the RHS operator.
  This made nested operators silently fail.
* A typo in the code could result in a wrong value substituted
  for an operation which produced a false '!foreach requires an operator' error.
* Keep recursion over the DAG within ForeachHelper. This simplifies
  things a bit as we no longer need to pass the Type around in order
  to prevent recursion.

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

llvm-svn: 324758

6 years ago[ThinLTO] Teach ThinLTO about auto hide symbols
Steven Wu [Fri, 9 Feb 2018 18:34:08 +0000 (18:34 +0000)]
[ThinLTO] Teach ThinLTO about auto hide symbols

Summary:
For symbols that has linkonce_odr linkage and unnamed_addr, it can be
auto hide by linker to avoid weak external symbols. Teach ThinLTO to
perform auto hide so it can safely promote linkonce_odr to weak symbols
without breaking this nice property.

Reviewers: tejohnson, mehdi_amini

Reviewed By: tejohnson

Subscribers: inglorion, eraman, rnk, pcc, llvm-commits

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

llvm-svn: 324757

6 years agoMake a lambda a static function to make the ICF main function shorter.
Rui Ueyama [Fri, 9 Feb 2018 18:00:46 +0000 (18:00 +0000)]
Make a lambda a static function to make the ICF main function shorter.

llvm-svn: 324756

6 years agoDo not print out removed ICF sections for -verbose.
Rui Ueyama [Fri, 9 Feb 2018 17:55:09 +0000 (17:55 +0000)]
Do not print out removed ICF sections for -verbose.

GNU gold doesn't print out ICF sections for -verbose. It only shows
them for -print-icf-sections. We printed out them for -verbose because
we didn't have -print-icf-sections. Now that we have the option, there's
no reason to print out for -verbose.

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

llvm-svn: 324755

6 years ago[x86] remove duplicate undef tests; NFC
Sanjay Patel [Fri, 9 Feb 2018 17:46:38 +0000 (17:46 +0000)]
[x86] remove duplicate undef tests; NFC

These are incomplete and were made redundant with the consolidation in:
https://reviews.llvm.org/rL324678

llvm-svn: 324754

6 years ago[InstCombine] Add vector xor tests
Simon Pilgrim [Fri, 9 Feb 2018 17:45:45 +0000 (17:45 +0000)]
[InstCombine] Add vector xor tests

This doesn't cover everything in InstCombiner.visitXor yet, but increases coverage for a lot of tests

llvm-svn: 324753

6 years agoMake --export-dynamic-symbol to pull out object files from archives.
Rui Ueyama [Fri, 9 Feb 2018 17:39:06 +0000 (17:39 +0000)]
Make --export-dynamic-symbol to pull out object files from archives.

This is for compatiblity with GNU gold. GNU gold tries to resolve
symbols specified by --export-dynamic-symbol. So, if a symbol specified
by --export-dynamic-symbol is in an archive file, lld's result is
currently different from gold's.

Interestingly, that behavior is different for --dynamic-list.
I added a new test to ensure that.

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

llvm-svn: 324752

6 years agoAMDGPU: Remove tied operand from si_else
Matt Arsenault [Fri, 9 Feb 2018 17:18:38 +0000 (17:18 +0000)]
AMDGPU: Remove tied operand from si_else

llvm-svn: 324751

6 years agoEmit smaller exception tables for non-SJLJ mode.
Rafael Espindola [Fri, 9 Feb 2018 17:13:37 +0000 (17:13 +0000)]
Emit smaller exception tables for non-SJLJ mode.

* Use uleb128 for code offsets in the LSDA call site table.
* Omit the TTBase offset if the type table is empty.

This change can reduce the size of the DWARF/Itanium LSDA by about half.

Patch by Ryan Prichard!

llvm-svn: 324750

6 years agoUse assembler expressions to lay out the EH LSDA.
Rafael Espindola [Fri, 9 Feb 2018 17:00:25 +0000 (17:00 +0000)]
Use assembler expressions to lay out the EH LSDA.

Rely on the assembler to finalize the layout of the DWARF/Itanium
exception-handling LSDA. Rather than calculate the exact size of each
thing in the LSDA, use assembler directives:

    To emit the offset to the TTBase label:

.uleb128 .Lttbase0-.Lttbaseref0
.Lttbaseref0:

    To emit the size of the call site table:

.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
... call site table entries ...
.Lcst_end0:

    To align the type info table:

... action table ...
.balign 4
.long _ZTIi
.long _ZTIl
.Lttbase0:

Using assembler directives simplifies the compiler and allows switching
the encoding of offsets in the call site table from udata4 to uleb128 for
a large code size savings. (This commit does not change the encoding.)

The combination of the uleb128 followed by a balign creates an unfortunate
dependency cycle that the assembler must sometimes resolve either by
padding an LEB or by inserting zero padding before the type table. See
PR35809 or GNU as bug 4029.

Patch by Ryan Prichard!

llvm-svn: 324749

6 years agoAMDGPU: Update for datalayout change
Matt Arsenault [Fri, 9 Feb 2018 16:58:41 +0000 (16:58 +0000)]
AMDGPU: Update for datalayout change

llvm-svn: 324748

6 years agoReapply "AMDGPU: Add 32-bit constant address space"
Matt Arsenault [Fri, 9 Feb 2018 16:57:57 +0000 (16:57 +0000)]
Reapply "AMDGPU: Add 32-bit constant address space"

This reverts r324494 and reapplies r324487.

llvm-svn: 324747

6 years agoAMDGPU: Fix layering issue
Matt Arsenault [Fri, 9 Feb 2018 16:57:48 +0000 (16:57 +0000)]
AMDGPU: Fix layering issue

Move utility function that depends on codegen.
Fixes build with r324487 reapplied.

llvm-svn: 324746

6 years ago[AArch64] Refactor stand alone methods (NFC)
Evandro Menezes [Fri, 9 Feb 2018 16:14:41 +0000 (16:14 +0000)]
[AArch64] Refactor stand alone methods (NFC)

Make stand alone methods in AArch64InstrInfo static.

llvm-svn: 324745

6 years agoRefactor how we decide which sections to sort.
Rafael Espindola [Fri, 9 Feb 2018 16:09:22 +0000 (16:09 +0000)]
Refactor how we decide which sections to sort.

This is a bit more verbose, but it has a few advantages.

The logic on what to do with special sections like .init_array is not
duplicated. Before we would need keep isKnownNonreorderableSection in
sync.

I think with this the call graph based sorting can be implemented by
"just" returning a new order from buildSectionOrder.

llvm-svn: 324744

6 years ago[Testsuite] Remove leak tests, it's not useful anymore.
Davide Italiano [Fri, 9 Feb 2018 16:06:39 +0000 (16:06 +0000)]
[Testsuite] Remove leak tests, it's not useful anymore.

This only worked on MacOS, which now ships a newer version of
python without this bug. As such, we don't leak the fd, and
this test is not needed anymore (as it also hardcoded the python
version in the check).

llvm-svn: 324743

6 years ago[clang-move] Don't dump macro symbols.
Haojian Wu [Fri, 9 Feb 2018 15:57:30 +0000 (15:57 +0000)]
[clang-move] Don't dump macro symbols.

Reviewers: ioeric

Subscribers: klimek, cfe-commits

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

llvm-svn: 324742

6 years agoclang-format: keep ObjC colon alignment with short object name
Francois Ferrand [Fri, 9 Feb 2018 15:41:56 +0000 (15:41 +0000)]
clang-format: keep ObjC colon alignment with short object name

Summary:
When the target object expression is short and the first selector name
is long, clang-format used to break the colon alignment:

  [I performSelectorOnMainThread:@selector(loadAccessories)
                       withObject:nil
                    waitUntilDone:false];

This happens because the colon is placed at `ContinuationIndent +
LongestObjCSelectorName`, so that any selector can be wrapped. This is
however not needed in case the longest selector is the firstone, and
not wrapped.

To overcome this, this patch does not include the first selector in
`LongestObjCSelectorName` computation (in TokenAnnotator), and lets
`ContinuationIndenter` decide how to account for the first selector
when wrapping. (Note this was already partly the case, see line 521
of ContinuationIndenter.cpp)

This way, the code gets properly aligned whenever possible without
breaking the continuation indent.

  [I performSelectorOnMainThread:@selector(loadAccessories)
                      withObject:nil
                   waitUntilDone:false];
  [I // force break
      performSelectorOnMainThread:@selector(loadAccessories)
                       withObject:nil
                    waitUntilDone:false];
  [I perform:@selector(loadAccessories)
      withSelectorOnMainThread:true
                 waitUntilDone:false];

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

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

llvm-svn: 324741

6 years agoPre-emptively fix test case for windows path separators
David Blaikie [Fri, 9 Feb 2018 15:39:04 +0000 (15:39 +0000)]
Pre-emptively fix test case for windows path separators

llvm-svn: 324740

6 years agoAdd IMPLEMENTATION NOTES describing lld's .a handling in the man page
Ed Maste [Fri, 9 Feb 2018 15:36:13 +0000 (15:36 +0000)]
Add IMPLEMENTATION NOTES describing lld's .a handling in the man page

This content is based on the description in NewLLD.rst.

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

llvm-svn: 324739

6 years agoRemove some unnecessary REQUIRES: shell from a couple of llvm-symbolizer tests
David Blaikie [Fri, 9 Feb 2018 15:33:39 +0000 (15:33 +0000)]
Remove some unnecessary REQUIRES: shell from a couple of llvm-symbolizer tests

llvm-svn: 324738

6 years ago[Hexagon] Express calling conventions via .td file instead of hand-coding
Krzysztof Parzyszek [Fri, 9 Feb 2018 15:30:02 +0000 (15:30 +0000)]
[Hexagon] Express calling conventions via .td file instead of hand-coding

Additionally, simplify the rest of the argument/parameter lowering code.

llvm-svn: 324737

6 years ago[clangd] Fix crash in tests in debug mode.
Ilya Biryukov [Fri, 9 Feb 2018 15:11:07 +0000 (15:11 +0000)]
[clangd] Fix crash in tests in debug mode.

Caused by the lack of checking of an Expected value in the previous
commit.

llvm-svn: 324736

6 years ago[clangd] Collect definitions when indexing.
Sam McCall [Fri, 9 Feb 2018 14:42:01 +0000 (14:42 +0000)]
[clangd] Collect definitions when indexing.

Within a TU:
 - as now, collect a declaration from the first occurrence of a symbol
   (taking clang's canonical declaration)
 - when we first see a definition occurrence, copy the symbol and add it
Across TUs/sources:
 - mergeSymbol in Merge.h is responsible for combining matching Symbols.
   This covers dynamic/static merges and cross-TU merges in the static index.
 - it prefers declarations from Symbols that have a definition.
 - GlobalSymbolBuilderMain is modified to use mergeSymbol as a reduce step.
Random cleanups (can be pulled out):
 - SymbolFromYAML -> SymbolsFromYAML, new singular SymbolFromYAML added
 - avoid uninit'd SymbolLocations. Add an idiomatic way to check "absent".
 - CanonicalDeclaration (as well as Definition) are mapped as optional in YAML.
 - added operator<< for Symbol & SymbolLocation, for debugging

Reviewers: ioeric, hokein

Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits

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

llvm-svn: 324735

6 years ago[DebugInfo] Don't insert DEBUG_VALUE after terminators
Stefan Maksimovic [Fri, 9 Feb 2018 14:03:26 +0000 (14:03 +0000)]
[DebugInfo] Don't insert DEBUG_VALUE after terminators

r314974 introduced insertion of DEBUG_VALUEs after
each redefinition of debug value register in the slot index range.

In case the instruction redefining the debug value register
was a terminator, machine verifier would complain since it
enforces the rule of no non-terminator instructions
following the first terminator.

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

llvm-svn: 324734

6 years ago[SelectionDAG] Provide adequate register class for RegisterSDNode
Stefan Maksimovic [Fri, 9 Feb 2018 13:55:25 +0000 (13:55 +0000)]
[SelectionDAG] Provide adequate register class for RegisterSDNode

When adding operands to machine instructions in case of
RegisterSDNodes, generate a COPY node in case the register class
does not match the one in the instruction definition.

Differental Revision: https://reviews.llvm.org/D35561

llvm-svn: 324733

6 years ago[clangd] Fix crash when CompilerInvocation can't be created.
Ilya Biryukov [Fri, 9 Feb 2018 13:51:57 +0000 (13:51 +0000)]
[clangd] Fix crash when CompilerInvocation can't be created.

Summary:
This can happen if the CompileCommand provided by compilation database
is malformed.

Reviewers: hokein, ioeric, sammccall

Reviewed By: sammccall

Subscribers: klimek, jkorous-apple, cfe-commits

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

llvm-svn: 324732

6 years ago[ELF] Print the .type assembly directive correctly for STT_NOTYPE
Oliver Stannard [Fri, 9 Feb 2018 13:34:39 +0000 (13:34 +0000)]
[ELF] Print the .type assembly directive correctly for STT_NOTYPE

The llvm assembly parser and gas both accept "@notype" in the .type
assembly directive, but we were printing it as "@no_type", which isn't
accepted by either assembler.

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

llvm-svn: 324731

6 years agoFix some warnings in SymbolFilePDB.cpp
Pavel Labath [Fri, 9 Feb 2018 11:37:01 +0000 (11:37 +0000)]
Fix some warnings in SymbolFilePDB.cpp

llvm-svn: 324730

6 years ago[mips] UnXFAIL gprestore.ll test.
Simon Dardis [Fri, 9 Feb 2018 10:46:16 +0000 (10:46 +0000)]
[mips] UnXFAIL gprestore.ll test.

Repurpose this previously XFAIL'd test to check that jalr uses $25
as per ABI requirements for PIC code.

llvm-svn: 324729

6 years ago[InstCombine] Add constant vector support for X udiv C, where C >= signbit
Simon Pilgrim [Fri, 9 Feb 2018 10:43:59 +0000 (10:43 +0000)]
[InstCombine] Add constant vector support for X udiv C, where C >= signbit

llvm-svn: 324728

6 years ago[TargetSchedule] Fix r324582.
Clement Courbet [Fri, 9 Feb 2018 10:28:46 +0000 (10:28 +0000)]
[TargetSchedule] Fix r324582.

Increment was using the wrong NumUnits (the one from the ProcResGroup
and not the subunit).

llvm-svn: 324727

6 years ago[clangd] Remove threading-related code from ClangdUnit.h
Ilya Biryukov [Fri, 9 Feb 2018 10:17:23 +0000 (10:17 +0000)]
[clangd] Remove threading-related code from ClangdUnit.h

Reviewers: sammccall, hokein, ioeric

Reviewed By: sammccall

Subscribers: klimek, jkorous-apple, cfe-commits

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

llvm-svn: 324725

6 years ago[CodeGen] Optimize AccelTable
Pavel Labath [Fri, 9 Feb 2018 10:06:56 +0000 (10:06 +0000)]
[CodeGen] Optimize AccelTable

Summary:
The class contained arrays of two structures (DataArray and HashData).
These structures were in 1:1 correspondence, and one of them contained
pointers to the other (and *both* contained a "Name" field). By merging
these two structures into one, we can save a bit of space without
negatively impacting much of anything.

Reviewers: JDevlieghere, aprantl

Subscribers: llvm-commits

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

llvm-svn: 324724

6 years agollgs-test: Parse and store register info recieved from lldb-server
Pavel Labath [Fri, 9 Feb 2018 09:40:03 +0000 (09:40 +0000)]
llgs-test: Parse and store register info recieved from lldb-server

Summary:
Right now the test client is not parsing register values correctly,
which is manifesting itself in one test failing on 32-bit architectures
(pr36013). This parses the information from the qRegisterInfo packets
and stores it in the client, which will enable fixing the parsing in a
follow up commit.

I am also adding a new templated SendMessage overload, which enables one
to send a message get a parsed response in a single call.

Reviewers: eugene, davide

Subscribers: lldb-commits

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

llvm-svn: 324722

6 years agoFif for an issue when Clang permits assignment to vector/extvector elements in a...
Andrew V. Tischenko [Fri, 9 Feb 2018 09:30:42 +0000 (09:30 +0000)]
Fif for an issue when Clang permits assignment to vector/extvector elements in a const method.

llvm-svn: 324721

6 years ago[AArch64] Return true in enableMultipleCopyHints().
Jonas Paulsson [Fri, 9 Feb 2018 09:22:20 +0000 (09:22 +0000)]
[AArch64]  Return true in enableMultipleCopyHints().

Enable multiple COPY hints to eliminate more COPYs during register allocation.

Note that this is something all targets should do, see
https://reviews.llvm.org/D38128.

Review: Martin Storsjö
llvm-svn: 324720

6 years agoRename and move utility function getLatchPredicateForGuard. NFC.
Serguei Katkov [Fri, 9 Feb 2018 07:59:07 +0000 (07:59 +0000)]
Rename and move utility function getLatchPredicateForGuard. NFC.

Rename getLatchPredicateForGuard to more common name
getFlippedStrictnessPredicate and move it to ICmpInst class.

llvm-svn: 324717

6 years ago[WebAssebmly] Remvoe trailing semicolon. NFC.
Sam Clegg [Fri, 9 Feb 2018 07:12:29 +0000 (07:12 +0000)]
[WebAssebmly] Remvoe trailing semicolon. NFC.

llvm-svn: 324716

6 years ago[WebAssembly] Remove redundant check global output index
Sam Clegg [Fri, 9 Feb 2018 07:09:12 +0000 (07:09 +0000)]
[WebAssembly] Remove redundant check global output index

llvm-svn: 324715

6 years agoAMDGPU/GCN: Bring processors in sync with AMDGPUUsage
Konstantin Zhuravlyov [Fri, 9 Feb 2018 07:02:28 +0000 (07:02 +0000)]
AMDGPU/GCN: Bring processors in sync with AMDGPUUsage

- Remove gfx800
- Remove gfx804
- Remove gfx901
- Remove gfx903

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

llvm-svn: 324714

6 years ago[bugpoint] Report non-existent opt binary
Vedant Kumar [Fri, 9 Feb 2018 06:09:15 +0000 (06:09 +0000)]
[bugpoint] Report non-existent opt binary

Bugpoint will keep going even if the opt binary it's given doesn't
exist. It should at least alert the user, so it's clear why reductions
are failing.

llvm-svn: 324713

6 years ago[AMDGPU] More descriptive names in the memory legalizer
Stanislav Mekhanoshin [Fri, 9 Feb 2018 06:05:33 +0000 (06:05 +0000)]
[AMDGPU] More descriptive names in the memory legalizer

NFC.

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

llvm-svn: 324712

6 years agoLTO: Include live bit in ThinLTO cache key.
Peter Collingbourne [Fri, 9 Feb 2018 05:58:55 +0000 (05:58 +0000)]
LTO: Include live bit in ThinLTO cache key.

As of r323633, this bit started controlling whether symbol definitions
appear in object files, and it also became sensitive to the prevailing
bit, so it needs to be included in the key.

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

llvm-svn: 324711

6 years ago[X86] Simplify some code in lowerV4X128VectorShuffle and lowerV2X128VectorShuffle
Craig Topper [Fri, 9 Feb 2018 05:54:36 +0000 (05:54 +0000)]
[X86] Simplify some code in lowerV4X128VectorShuffle and lowerV2X128VectorShuffle

Previously we extracted two subvectors and concatenate. But the concatenate will be lowered to two insert subvectors. Then DAG combine will merge once of the inserts and one of the extracts back into the original vector. We might as well just directly use one extract and one insert.

llvm-svn: 324710

6 years ago[X86] Teach shuffle lowering to recognize 128/256 bit insertions into a zero vector.
Craig Topper [Fri, 9 Feb 2018 05:54:34 +0000 (05:54 +0000)]
[X86] Teach shuffle lowering to recognize 128/256 bit insertions into a zero vector.

This regresses a couple cases in the shuffle combining test. But those cases use intrinsics that InstCombine knows how to turn into a generic shuffle earlier. This should give opportunities to fold this earlier in InstCombine or DAG combine.

llvm-svn: 324709

6 years ago[X86] Add 512-bit shuffle test cases for concatenating 128/256-bits with zeros in...
Craig Topper [Fri, 9 Feb 2018 05:54:31 +0000 (05:54 +0000)]
[X86] Add 512-bit shuffle test cases for concatenating 128/256-bits with zeros in the upper portion.

We should recognize this and just use a mov that will zero the upper bits.

llvm-svn: 324708

6 years ago[SymbolFilePDB] Add support for function symbols
Aaron Smith [Fri, 9 Feb 2018 05:31:28 +0000 (05:31 +0000)]
[SymbolFilePDB] Add support for function symbols

Summary:
This is combination of following changes,

- Resolve function symbols in PDB symbol file. `lldb-test symbols` will display information about function symbols.

- Implement SymbolFilePDB::FindFunctions methods. On lldb console, searching function symbol by name and by regular expression are both available.

- Create lldb type for PDBSymbolFunc.

- Add tests to check whether functions with the same name but from different sources can be resolved correctly.

Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: amccarth, labath, llvm-commits

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

llvm-svn: 324707

6 years ago[lit] Pass CLANG env var to testing configuration
Victor Leschuk [Fri, 9 Feb 2018 05:28:38 +0000 (05:28 +0000)]
[lit] Pass CLANG env var to testing configuration

Allow CLANG environment variable be copied into the testing configuration
and proper support testing with a custom path to the clang executable.

Signed-off-by: Vladimir Vereschaka <vvereschaka@accesssoftek.com>
llvm-svn: 324706

6 years ago[bugpoint] Simplify reducers which can fail verification, NFC
Vedant Kumar [Fri, 9 Feb 2018 05:09:50 +0000 (05:09 +0000)]
[bugpoint] Simplify reducers which can fail verification, NFC

More unique_ptr-ification, ranged for loops, etc.

llvm-svn: 324705

6 years ago[bugpoint] Delete a dead cl::opt (-child-output)
Vedant Kumar [Fri, 9 Feb 2018 05:09:49 +0000 (05:09 +0000)]
[bugpoint] Delete a dead cl::opt (-child-output)

This option isn't used anywhere, as far as I can tell.

llvm-svn: 324704

6 years ago[bugpoint] Avoid noisy errors by passing a valid opt to tests
Vedant Kumar [Fri, 9 Feb 2018 05:09:48 +0000 (05:09 +0000)]
[bugpoint] Avoid noisy errors by passing a valid opt to tests

If the tests don't use the in-tree opt, we're liable to see some silly
error messages due to the version mismatch (missing flags, etc).

llvm-svn: 324703

6 years agoDebugInfo/llvm-symbolizer: Test symbolizing Split DWARF without addresses in the...
David Blaikie [Fri, 9 Feb 2018 03:34:32 +0000 (03:34 +0000)]
DebugInfo/llvm-symbolizer: Test symbolizing Split DWARF without addresses in the skeleton CU

Identified in an llvm-dev discussion around
DWARFUnit::collectAddressRanges

llvm-svn: 324702

6 years agoAST: support ObjC lifetime qualifiers in MS ABI
Saleem Abdulrasool [Fri, 9 Feb 2018 03:23:54 +0000 (03:23 +0000)]
AST: support ObjC lifetime qualifiers in MS ABI

Adjust the ObjC protocol conformance workaround to be more extensible.
Use a synthetic type for the protocol (`struct Protocol`).  Embed this
within a reserved namespace to permit extending the extended pointer
type qualifiers similarly for ObjC lifetime qualifiers.

Introduce additional special handling for `__autoreleasing`, `__strong`,
and `__weak` Objective C lifetime qualifiers.  We decorate these by
creating an artificial template type `Autoreleasing`, `Strong`, or
`Weak` in the `__ObjC` namespace.  These are only considered in the
template type specialization and not the function parameter.

llvm-svn: 324701

6 years ago[ORC] Remove Layer handles from the layer concept.
Lang Hames [Fri, 9 Feb 2018 02:30:40 +0000 (02:30 +0000)]
[ORC] Remove Layer handles from the layer concept.

Handles were returned by addModule and used as keys for removeModule,
findSymbolIn, and emitAndFinalize. Their job is now subsumed by VModuleKeys,
which simplify resource management by providing a consistent handle across all
layers.

llvm-svn: 324700

6 years agoMake test changes added in r324584 more robust by using a regex instead of hard coded...
Douglas Yung [Fri, 9 Feb 2018 02:13:15 +0000 (02:13 +0000)]
Make test changes added in r324584 more robust by using a regex instead of hard coded MCInst numbers.

llvm-svn: 324699

6 years agoRemove redundant semicolon.
Rui Ueyama [Fri, 9 Feb 2018 01:43:59 +0000 (01:43 +0000)]
Remove redundant semicolon.

llvm-svn: 324698

6 years ago[CFG] Squash an unused variable introduced in r324668.
Artem Dergachev [Fri, 9 Feb 2018 01:43:26 +0000 (01:43 +0000)]
[CFG] Squash an unused variable introduced in r324668.

Found by -Werror buildbot.

llvm-svn: 324697

6 years ago[GISel]: Verify COPIES involving generic registers.
Aditya Nandakumar [Fri, 9 Feb 2018 01:27:23 +0000 (01:27 +0000)]
[GISel]: Verify COPIES involving generic registers.

Add verification for copies involving generic registers if they are
compatible - ie if it is a generic copy, then the types are the
same, and if a COPY b/w generic and target virtual register, then
the sizes should be the same. Only checks if there are no sub registers
involved for now.

https://reviews.llvm.org/D37775

llvm-svn: 324696

6 years ago[modules] Fix incorrect diagnostic mapping computation when a module changes
Richard Smith [Fri, 9 Feb 2018 01:15:13 +0000 (01:15 +0000)]
[modules] Fix incorrect diagnostic mapping computation when a module changes
diagnostic settings using _Pragma within a macro.

The AST writer had previously been assuming that all diagnostic state
transitions would occur within a FileID corresponding to a file. When a
diagnostic state change occured within a macro, it was unable to form a
location for that state change and would instead corrupt the diagnostic state
of the "root" node (and thus that of the main compilation).

Also introduce a "#pragma clang __debug diag_mapping" debugging utility
that I added to track this issue down.

llvm-svn: 324695

6 years ago[CodeGen] Unify the syntax of MBB liveins in MIR and -debug output
Francis Visoiu Mistrih [Fri, 9 Feb 2018 01:14:44 +0000 (01:14 +0000)]
[CodeGen] Unify the syntax of MBB liveins in MIR and -debug output

Instead of:

Live Ins: %r0 %r1

print:

liveins: %r0, %r1
llvm-svn: 324694

6 years ago[x86] Add test cases to demonstrate some dumb mask->gpr->mask transition sequences.
Craig Topper [Fri, 9 Feb 2018 01:14:17 +0000 (01:14 +0000)]
[x86] Add test cases to demonstrate some dumb mask->gpr->mask transition sequences.

llvm-svn: 324693

6 years agoRename confusing variable names in a test.
Rui Ueyama [Fri, 9 Feb 2018 01:03:22 +0000 (01:03 +0000)]
Rename confusing variable names in a test.

"%tar" looks like a tar archive, but it's actually an .a archive.

llvm-svn: 324692

6 years ago[hwasan] Fix kernel instrumentation of stack.
Evgeniy Stepanov [Fri, 9 Feb 2018 00:59:10 +0000 (00:59 +0000)]
[hwasan] Fix kernel instrumentation of stack.

Summary:
Kernel addresses have 0xFF in the most significant byte.
A tag can not be pushed there with OR (tag << 56);
use AND ((tag << 56) | 0x00FF..FF) instead.

Reviewers: kcc, andreyknvl

Subscribers: srhines, llvm-commits, hiraditya

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

llvm-svn: 324691

6 years ago[CodeGen] Don't compute BranchProbability for MBB::print
Francis Visoiu Mistrih [Fri, 9 Feb 2018 00:40:57 +0000 (00:40 +0000)]
[CodeGen] Don't compute BranchProbability for MBB::print

Avoid re-computing BP only to print successor probabilities in -debug
printing.

llvm-svn: 324690

6 years ago[WinEH] Put funclet bundles on inline asm calls
Reid Kleckner [Fri, 9 Feb 2018 00:16:41 +0000 (00:16 +0000)]
[WinEH] Put funclet bundles on inline asm calls

Summary:
Fixes PR36247, which is where WinEHPrepare replaces inline asm in
funclets with unreachable.

Make getBundlesForFunclet return by value to simplify some call sites.

Reviewers: smeenai, majnemer

Subscribers: eraman, cfe-commits

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

llvm-svn: 324689

6 years agoUse log to print out a verbose message.
Rui Ueyama [Fri, 9 Feb 2018 00:15:12 +0000 (00:15 +0000)]
Use log to print out a verbose message.

llvm-svn: 324688

6 years agoFix UBSan issue with PPC::isValidCPUName
Erich Keane [Fri, 9 Feb 2018 00:13:49 +0000 (00:13 +0000)]
Fix UBSan issue with PPC::isValidCPUName

Apparently storing the pointer to a StringLiteral as
a StringRef caused this section of code to issue a ubsan
warning.  This will hopefully fix that.

llvm-svn: 324687

6 years ago[CodeGen] Only print successors when the list is not empty
Francis Visoiu Mistrih [Fri, 9 Feb 2018 00:12:53 +0000 (00:12 +0000)]
[CodeGen] Only print successors when the list is not empty

Follow-up of r324685.

llvm-svn: 324686

6 years ago[CodeGen] Unify the syntax of MBB successors in MIR and -debug output
Francis Visoiu Mistrih [Fri, 9 Feb 2018 00:10:31 +0000 (00:10 +0000)]
[CodeGen] Unify the syntax of MBB successors in MIR and -debug output

Instead of:

Successors according to CFG: %bb.6(0x12492492 / 0x80000000 = 14.29%)

print:

successors: %bb.6(0x12492492); %bb.6(14.29%)
llvm-svn: 324685

6 years agoRemove Config->Verbose because we have errorHandler().Verbose.
Rui Ueyama [Thu, 8 Feb 2018 23:52:09 +0000 (23:52 +0000)]
Remove Config->Verbose because we have errorHandler().Verbose.

llvm-svn: 324684

6 years agoFix --print-icf-sections output.
Rui Ueyama [Thu, 8 Feb 2018 23:51:58 +0000 (23:51 +0000)]
Fix --print-icf-sections output.

Previously, multiple chunks of --print-icf-sections messages were interleaved
and didn't make sense. This is because forEachClass is multi-threaded.

llvm-svn: 324683

6 years agoAdd size to constexpr Arrays
Erich Keane [Thu, 8 Feb 2018 23:49:40 +0000 (23:49 +0000)]
Add size to constexpr Arrays

What seems to be a bug in older versions of MSVC, constexpr
member arrays with a redefinition (to force emission) require
their initial definition to have the size between the brackets.

llvm-svn: 324682

6 years ago[CodeGen] Move printing '\n' from MachineInstr::print to MachineBasicBlock::print
Francis Visoiu Mistrih [Thu, 8 Feb 2018 23:42:27 +0000 (23:42 +0000)]
[CodeGen] Move printing '\n' from MachineInstr::print to MachineBasicBlock::print

MBB.print wasn't printing it, but the MIRPrinter is printing it. The
goal is to unify that as much as possible.

llvm-svn: 324681

6 years ago[analyzer] MallocChecker: Fix one more bug category.
Artem Dergachev [Thu, 8 Feb 2018 23:28:29 +0000 (23:28 +0000)]
[analyzer] MallocChecker: Fix one more bug category.

Even though most of the inconsistencies in MallocChecker's bug categories were
fixed in r302016, one more was introduced in r301913 which was later missed.

Patch by Henry Wong!

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

llvm-svn: 324680

6 years ago[Lanai] Code model dictates section selection.
Jacques Pienaar [Thu, 8 Feb 2018 23:25:05 +0000 (23:25 +0000)]
[Lanai] Code model dictates section selection.

Always use the small section when the small code model is specified.

llvm-svn: 324679

6 years ago[x86] consolidate and add tests for undef binop folds; NFC
Sanjay Patel [Thu, 8 Feb 2018 23:21:44 +0000 (23:21 +0000)]
[x86] consolidate and add tests for undef binop folds; NFC

As was already shown in the div/rem tests and noted in PR36305,
the behavior is inconsistent, but it's not limited to div/rem only.

llvm-svn: 324678

6 years agoUse a stable topological sort in DwarfCompileUnit::createScopeChildrenDIE()
Adrian Prantl [Thu, 8 Feb 2018 23:21:15 +0000 (23:21 +0000)]
Use a stable topological sort in DwarfCompileUnit::createScopeChildrenDIE()

This addresses review feedback for D42940. The topological sort is
slightly more expensive but it can now also detect cycles in the
dependencies and actually works correctly.

rdar://problem/37217988

Differential Review: https://reviews.llvm.org/D43036

llvm-svn: 324677

6 years agoAdd Rest of Targets Support to ValidCPUList (enabling march notes)
Erich Keane [Thu, 8 Feb 2018 23:16:55 +0000 (23:16 +0000)]
Add Rest of Targets Support to ValidCPUList (enabling march notes)

A followup to: https://reviews.llvm.org/D42978

Most of the rest of the Targets were pretty rote, so this
patch knocks them all out at once.

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

llvm-svn: 324676

6 years agoAdd NVPTX Support to ValidCPUList (enabling march notes)
Erich Keane [Thu, 8 Feb 2018 23:16:00 +0000 (23:16 +0000)]
Add NVPTX Support to ValidCPUList (enabling march notes)

A followup to: https://reviews.llvm.org/D42978
This patch adds NVPTX support for
enabling the march notes.

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

llvm-svn: 324675

6 years agoAdd X86 Support to ValidCPUList (enabling march notes)
Erich Keane [Thu, 8 Feb 2018 23:15:02 +0000 (23:15 +0000)]
Add X86 Support to ValidCPUList (enabling march notes)

A followup to: https://reviews.llvm.org/D42978
This patch adds X86 and X86_64 support for
enabling the march notes.

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

llvm-svn: 324674

6 years agoMake march/target-cpu print a note with the list of valid values for ARM
Erich Keane [Thu, 8 Feb 2018 23:14:15 +0000 (23:14 +0000)]
Make march/target-cpu print a note with the list of valid values for ARM

When rejecting a march= or target-cpu command line parameter,
the message is quite lacking. This patch adds a note that prints
all possible values for the current target, if the target supports it.

This adds support for the ARM/AArch64 targets (more to come!).

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

llvm-svn: 324673