platform/upstream/llvm.git
7 years ago[X86] Don't zero the upper bits of the k-register before extracting a single bit...
Craig Topper [Thu, 14 Dec 2017 18:35:25 +0000 (18:35 +0000)]
[X86] Don't zero the upper bits of the k-register before extracting a single bit from a vXi1.

This doesn't match the semantics of the extract_vector_elt operation. Nothing downstream knows the bits were zeroed so they still get masked or sign extended after the extrat anyway.

llvm-svn: 320723

7 years ago[Hexagon] Remove vectors of i64 from valid HVX types
Krzysztof Parzyszek [Thu, 14 Dec 2017 18:35:24 +0000 (18:35 +0000)]
[Hexagon] Remove vectors of i64 from valid HVX types

HVX does not support operations on 64-bit integers.

llvm-svn: 320722

7 years agoIn an ARC lambda-to-block conversion thunk, reclaim the return value of
John McCall [Thu, 14 Dec 2017 18:21:14 +0000 (18:21 +0000)]
In an ARC lambda-to-block conversion thunk, reclaim the return value of
the lambda so that we don't over-release it.

Patch by Dan Zimmerman!

llvm-svn: 320721

7 years agoFix error due to missing includes.
Zachary Turner [Thu, 14 Dec 2017 18:20:23 +0000 (18:20 +0000)]
Fix error due to missing includes.

While I'm pushing cleanup changes, this also fixes a few warnings
related to extraneous semicolons.

llvm-svn: 320720

7 years ago[COFF] Teach LLD to use the COFF .debug$H section.
Zachary Turner [Thu, 14 Dec 2017 18:07:04 +0000 (18:07 +0000)]
[COFF] Teach LLD to use the COFF .debug$H section.

This adds the /DEBUG:GHASH option to LLD which will look for
the existence of .debug$H sections in linker inputs and use them
to accelerate type merging.  The clang-cl side has already been
added, so this completes the work necessary to begin experimenting
with this feature.

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

llvm-svn: 320719

7 years ago[ARM] Fix isRenamable flag setting on expanded VSTMDIA opcode.
Geoff Berry [Thu, 14 Dec 2017 18:06:25 +0000 (18:06 +0000)]
[ARM] Fix isRenamable flag setting on expanded VSTMDIA opcode.

Fixes expensive-check ARM buildbot failure.

llvm-svn: 320718

7 years ago[OPENMP] Add codegen for target data constructs with `nowait` clause.
Alexey Bataev [Thu, 14 Dec 2017 17:00:17 +0000 (17:00 +0000)]
[OPENMP] Add codegen for target data constructs with `nowait` clause.

Added codegen for the `nowait` clause in target data constructs.

llvm-svn: 320717

7 years ago[X86][AVX][AVX2]: Adding full coverage of MC encoding for the AVX, AVX2 isa set....
Gadi Haber [Thu, 14 Dec 2017 16:46:47 +0000 (16:46 +0000)]
[X86][AVX][AVX2]: Adding full coverage of MC encoding for the AVX, AVX2 isa set.<NFC>

NFC.
Adding MC regressions tests to cover the AVX and AVX2 ISA sets.
This patch is part of a larger task to cover MC encoding of all X86 ISA Sets.
See revision: https://reviews.llvm.org/D39952

Reviewers: zvi, RKSimon, aymanmus, m_zuckerman
Differential Revison: https://reviews.llvm.org/D40287

Change-Id: I304687a2b7abb473f79de99c31fc55c97b2662da
llvm-svn: 320716

7 years ago[mips] Update some tests before posting a patch, NFC.
Simon Dardis [Thu, 14 Dec 2017 16:42:04 +0000 (16:42 +0000)]
[mips] Update some tests before posting a patch, NFC.

llvm-svn: 320715

7 years ago[ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style
Ben Hamilton [Thu, 14 Dec 2017 16:17:38 +0000 (16:17 +0000)]
[ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style

Summary:
If we write the following code, it goes over 100 columns, so we need to wrap it:

```
- (VeryLongReturnTypeName)veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
                              longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;
```

Currently, clang-format with the google style aligns the method parameter names on the first column:

```
- (VeryLongReturnTypeName)
veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
    longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;
```

We'd like clang-format in the google style to align these to column 4 for Objective-C:

```
- (VeryLongReturnTypeName)
    veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
            longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;
```

Test Plan: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: krasimir, djasper, klimek

Reviewed By: djasper

Subscribers: cfe-commits, thakis

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

llvm-svn: 320714

7 years agoAdd support for NOLINT and NOLINTNEXTLINE comments mentioning specific check names.
Aaron Ballman [Thu, 14 Dec 2017 16:13:57 +0000 (16:13 +0000)]
Add support for NOLINT and NOLINTNEXTLINE comments mentioning specific check names.

Supports a comma-separated list of check names to be disabled on the given line. Also supports * as a wildcard to disable all lint diagnostic messages on that line.

Patch by Anton (xgsa).

llvm-svn: 320713

7 years agoRevert CodeGen: Fix assertion in machine inst sheduler due to llvm.dbg.value
Yaxun Liu [Thu, 14 Dec 2017 16:12:04 +0000 (16:12 +0000)]
Revert CodeGen: Fix assertion in machine inst sheduler due to llvm.dbg.value

This commit might have caused regression on ppc64. Revert it to verify that.

llvm-svn: 320712

7 years agoRe-commit: [TableGen] AsmMatcher: Fix bug with reported diagnostic for operand.
Sander de Smalen [Thu, 14 Dec 2017 16:09:48 +0000 (16:09 +0000)]
Re-commit: [TableGen] AsmMatcher: Fix bug with reported diagnostic for operand.

Summary:
The generated diagnostic by the AsmMatcher isn't always applicable to the AsmOperand.

This is because the code will only update the diagnostic if it is more
specific than the previous diagnostic. However, when having validated
operands and 'moved on' to a next operand (for some instruction/alias for
which all previous operands are valid), if the diagnostic is InvalidOperand,
than that should be set as the diagnostic, not the more specific message
about a previous operand for some other instruction/alias candidate.

(Re-committed with an extra whitespace in SVEInstrFormats.td to trigger rebuild
of AArch64GenAsmMatcher.inc, since the llvm-clang-x86_64-expensive-checks-win
builder does not seem to rebuild AArch64GenAsmMatcher.inc with the
newly built TableGen due to a missing dependency somewhere (see:
http://lists.llvm.org/pipermail/llvm-dev/2017-December/119555.html))

Reviewers: craig.topper, olista01, rengolin, stoklund

Reviewed By: olista01

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 320711

7 years ago[LLVMgold] Use platform dependent extension in tests
Eugene Leviant [Thu, 14 Dec 2017 15:59:05 +0000 (15:59 +0000)]
[LLVMgold] Use platform dependent extension in tests

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

llvm-svn: 320710

7 years agoWhen attempting to complete an incomplete array bound type in an expression,
Richard Smith [Thu, 14 Dec 2017 15:40:16 +0000 (15:40 +0000)]
When attempting to complete an incomplete array bound type in an expression,
update the type from the definition even if we didn't instantiate a definition.

We may have instantiated the definition in an earlier stage of semantic
analysis, after creating the DeclRefExpr but before we reach a point where a
complete expression type is required.

llvm-svn: 320709

7 years ago[clangd] Changed tracing interfaces
Ilya Biryukov [Thu, 14 Dec 2017 15:33:38 +0000 (15:33 +0000)]
[clangd] Changed tracing interfaces

Summary:
EventTracer interface now contains two methods:
- spanEvent for events that have duration,
- instant for events that are instant.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, luckygeck, cfe-commits

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

llvm-svn: 320708

7 years ago[c++20] P0515R3: Parsing support and basic AST construction for operator <=>.
Richard Smith [Thu, 14 Dec 2017 15:16:18 +0000 (15:16 +0000)]
[c++20] P0515R3: Parsing support and basic AST construction for operator <=>.

Adding the new enumerator forced a bunch more changes into this patch than I
would have liked. The -Wtautological-compare warning was extended to properly
check the new comparison operator, clang-format needed updating because it uses
precedence levels as weights for determining where to break lines (and several
operators increased their precedence levels with this change), thread-safety
analysis needed changes to build its own IL properly for the new operator.

All "real" semantic checking for this operator has been deferred to a future
patch. For now, we use the relational comparison rules and arbitrarily give
the builtin form of the operator a return type of 'void'.

llvm-svn: 320707

7 years ago[clangd] Implemented tracing using Context
Ilya Biryukov [Thu, 14 Dec 2017 15:04:59 +0000 (15:04 +0000)]
[clangd] Implemented tracing using Context

Reviewers: sammccall, ioeric, hokein

Reviewed By: sammccall

Subscribers: klimek, luckygeck, cfe-commits

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

llvm-svn: 320706

7 years agoObjectFile: remove ReadSectionData/MemoryMapSectionData mutual recursion
Pavel Labath [Thu, 14 Dec 2017 14:56:45 +0000 (14:56 +0000)]
ObjectFile: remove ReadSectionData/MemoryMapSectionData mutual recursion

Summary:
These two functions were calling each other, while handling different
branches of the if(IsInMemory()). This had a reason at some point in the
past, but right now it's just confusing.

I resolve this by removing the MemoryMapSectionData function and
inlining the !IsInMemory branch into ReadSectionData. There isn't
anything mmap-related in this function anyway, as the decision whether
to mmap is handled at a higher level.

This is a preparatory step to make ObjectFileELF be able to decompress
compressed sections (I want to make sure that all calls reading section
data are routed through a single piece of code).

Reviewers: clayborg

Subscribers: emaste, JDevlieghere, lldb-commits

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

llvm-svn: 320705

7 years agoRemove stderr message from GDBRemoteCommunicationServerLLGS
Pavel Labath [Thu, 14 Dec 2017 14:56:29 +0000 (14:56 +0000)]
Remove stderr message from GDBRemoteCommunicationServerLLGS

A similar error message is printed again in lldb-gdbserver.cpp, so the
user will see the message twice. Also, this is generic library code, we
shouldn't really be using stderr here.

llvm-svn: 320704

7 years ago[mips] Add partial support for R6 in the long branch pass
Simon Dardis [Thu, 14 Dec 2017 14:55:25 +0000 (14:55 +0000)]
[mips] Add partial support for R6 in the long branch pass

MIPSR6 introduced several new jump instructions and deprecated
the use of the 'j' instruction. For microMIPS32R6, 'j' was removed
entirely and it only has non delay slot jumps.

This patch adds support for MIPSR6 by using some R6 instructions--
'bc' instead of 'j', 'jic $reg, 0' instead of 'jalr $zero, $reg'--
and modifies the sequences not to use delay slots for R6.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: dschuff, arichardson, llvm-commits

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

llvm-svn: 320703

7 years agoRenamed test file to use proper naming convention
Ilya Biryukov [Thu, 14 Dec 2017 14:51:17 +0000 (14:51 +0000)]
Renamed test file to use proper naming convention

Also changed the order of CHECK statements.
CHEKC-NOT must come before CHECK in skipped-function-bodies.cpp

llvm-svn: 320702

7 years ago[clangd] Add a FileSymbols container that manages symbols from multiple files.
Eric Liu [Thu, 14 Dec 2017 14:50:58 +0000 (14:50 +0000)]
[clangd] Add a FileSymbols container that manages symbols from multiple files.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits

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

llvm-svn: 320701

7 years ago[ScalarEvolution] Fix base condition in isNormalAddRecPHI.
Bjorn Pettersson [Thu, 14 Dec 2017 14:47:52 +0000 (14:47 +0000)]
[ScalarEvolution] Fix base condition in isNormalAddRecPHI.

Summary:
The function is meant to recurse until it comes upon the
phi it's looking for. However, with the current condition,
it will recurse until it finds anything _but_ the phi.

The function will even fail for simple cases like:
  %i = phi i32 [ %inc, %loop ], ...
  ...
  %inc = add i32 %i, 1

because the base condition will not happen when the phi
is recursed to, and the recursion will end with a 'false'
result since the previous instruction is a phi.

Reviewers: sanjoy, atrick

Reviewed By: sanjoy

Subscribers: Ka-Ka, bjope, llvm-commits

Committing on behalf of: Bevin Hansson (bevinh)

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

llvm-svn: 320700

7 years ago[InlineCost] Tracking Values through PHI Nodes
Haicheng Wu [Thu, 14 Dec 2017 14:36:18 +0000 (14:36 +0000)]
[InlineCost] Tracking Values through PHI Nodes

This patch fix this FIXME in visitPHI()

FIXME: We should potentially be tracking values through phi nodes,
especially when they collapse to a single value due to deleted CFG edges
during inlining.

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

llvm-svn: 320699

7 years agoRevert "[DAGCombine] Move AND nodes to multiple load leaves"
Benjamin Kramer [Thu, 14 Dec 2017 14:03:07 +0000 (14:03 +0000)]
Revert "[DAGCombine] Move AND nodes to multiple load leaves"

This reverts commit r320679. Causes miscompiles.

llvm-svn: 320698

7 years agoWarn if we find a Unicode homoglyph for a symbol in an identifier.
Richard Smith [Thu, 14 Dec 2017 13:15:08 +0000 (13:15 +0000)]
Warn if we find a Unicode homoglyph for a symbol in an identifier.

Specifically, warn if:
 * we find a character that the language standard says we must treat as an
   identifier, and
 * that character is not reasonably an identifier character (it's a punctuation
   character or similar), and
 * it renders identically to a valid non-identifier character in common
   fixed-width fonts.

Some tools "helpfully" substitute the surprising characters for the expected
characters, and replacing semicolons with Greek question marks is a common
"prank".

llvm-svn: 320697

7 years ago[Frontend] Treat function with skipped body as definition
Ilya Biryukov [Thu, 14 Dec 2017 13:00:33 +0000 (13:00 +0000)]
[Frontend] Treat function with skipped body as definition

Summary:
This fixes an invalid warning about missing definition of a function when
parsing with SkipFunctionBodies=true

Reviewers: bkramer, sepavloff

Reviewed By: sepavloff

Subscribers: klimek, cfe-commits

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

llvm-svn: 320696

7 years ago[clangd] Fix a potential use-after-move bug.
Eric Liu [Thu, 14 Dec 2017 12:31:04 +0000 (12:31 +0000)]
[clangd] Fix a potential use-after-move bug.

llvm-svn: 320695

7 years ago[clangd] Construct SymbolSlab from YAML format.
Haojian Wu [Thu, 14 Dec 2017 12:17:14 +0000 (12:17 +0000)]
[clangd] Construct SymbolSlab from YAML format.

Summary: This will be used together with D40548 for the global index source (experimental).

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits, ioeric

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

llvm-svn: 320694

7 years agoAny Target Asm comments should start from MachineInstr::TAsmComments value.
Andrew V. Tischenko [Thu, 14 Dec 2017 12:07:11 +0000 (12:07 +0000)]
Any Target Asm comments should start from MachineInstr::TAsmComments value.

llvm-svn: 320693

7 years agoInserting several lit tests to reflect current behaviour
Omer Paparo Bivas [Thu, 14 Dec 2017 12:00:04 +0000 (12:00 +0000)]
Inserting several lit tests to reflect current behaviour

Change-Id: I1b8188dc3c6c7c0f455715364ece7d35ef485f2f
llvm-svn: 320692

7 years ago[AVX512] Adding support for load truncate store of I1
Michael Zuckerman [Thu, 14 Dec 2017 11:55:50 +0000 (11:55 +0000)]
[AVX512] Adding support for load truncate store of I1

store operation on a truncated memory (load) of vXi1 is poorly supported by LLVM and most of the time end with an assertion.
This patch fixes this issue.

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

Change-Id: Ida5523dd09c1ad384acc0a27e9e59273d28cbdc9
llvm-svn: 320691

7 years ago[X86] Add FMA4 schedule tests
Simon Pilgrim [Thu, 14 Dec 2017 11:40:54 +0000 (11:40 +0000)]
[X86] Add FMA4 schedule tests

llvm-svn: 320690

7 years ago[X86] Add FMA3 schedule tests
Simon Pilgrim [Thu, 14 Dec 2017 11:30:01 +0000 (11:30 +0000)]
[X86] Add FMA3 schedule tests

Rewrote to use inline asm for full coverage

llvm-svn: 320689

7 years ago[clangd] Symbol index interfaces and an in-memory index implementation.
Eric Liu [Thu, 14 Dec 2017 11:25:49 +0000 (11:25 +0000)]
[clangd] Symbol index interfaces and an in-memory index implementation.

Summary:
o Index interfaces to support using different index sources (e.g. AST index, global index) for code completion, cross-reference finding etc. This patch focuses on code completion.

The following changes in the original patch has been split out.
o Implement an AST-based index.
o Add an option to replace sema code completion for qualified-id with index-based completion.
o Implement an initial naive code completion index which matches symbols that have the query string as substring.

Reviewers: malaperle, sammccall

Reviewed By: sammccall

Subscribers: hokein, klimek, malaperle, mgorny, ilya-biryukov, cfe-commits

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

llvm-svn: 320688

7 years ago[PM][InstCombine] fixing omission of AliasAnalysis in new-pass-manager's version...
Fedor Sergeev [Thu, 14 Dec 2017 10:36:31 +0000 (10:36 +0000)]
[PM][InstCombine] fixing omission of AliasAnalysis in new-pass-manager's version of InstCombine

Summary:
Passing AliasAnalysis results instead of nullptr appears to work just fine.
A couple new-pass-manager tests updated to align with new order of analyses.

Reviewers: chandlerc, spatel, craig.topper

Reviewed By: chandlerc

Subscribers: mehdi_amini, eraman, llvm-commits

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

llvm-svn: 320687

7 years agoRemove redundant includes from lib/Target/AArch64.
Fedor Sergeev [Thu, 14 Dec 2017 10:36:20 +0000 (10:36 +0000)]
Remove redundant includes from lib/Target/AArch64.

llvm-svn: 320686

7 years ago[CodeGen] Print MCSymbol operands as <mcsymbol sym> in both MIR and debug output
Francis Visoiu Mistrih [Thu, 14 Dec 2017 10:03:23 +0000 (10:03 +0000)]
[CodeGen] Print MCSymbol operands as <mcsymbol sym> in both MIR and debug output

Work towards the unification of MIR and debug output by printing
`<mcsymbol sym>` instead of `<MCSym=sym>`.

Only debug syntax is affected.

llvm-svn: 320685

7 years ago[CodeGen] Move printing MO_Metadata operands to MachineOperand::print
Francis Visoiu Mistrih [Thu, 14 Dec 2017 10:03:18 +0000 (10:03 +0000)]
[CodeGen] Move printing MO_Metadata operands to MachineOperand::print

Work towards the unification of MIR and debug output by refactoring the
interfaces.

llvm-svn: 320684

7 years ago[CodeGen] Print live-out register lists as liveout(...) in both MIR and debug output
Francis Visoiu Mistrih [Thu, 14 Dec 2017 10:03:14 +0000 (10:03 +0000)]
[CodeGen] Print live-out register lists as liveout(...) in both MIR and debug output

Work towards the unification of MIR and debug output by printing
`liveout(...)` instead of `<regliveout>`.

Only debug syntax is affected.

llvm-svn: 320683

7 years ago[CodeGen] Print global addresses as @foo in both MIR and debug output
Francis Visoiu Mistrih [Thu, 14 Dec 2017 10:03:09 +0000 (10:03 +0000)]
[CodeGen] Print global addresses as @foo in both MIR and debug output

Work towards the unification of MIR and debug output by printing
`@foo` instead of `<ga:@foo>`.

Also print target flags in the MIR format since most of them are used on
global address operands.

Only debug syntax is affected.

llvm-svn: 320682

7 years ago[CodeGen] Print external symbols as $symbol in both MIR and debug output
Francis Visoiu Mistrih [Thu, 14 Dec 2017 10:02:58 +0000 (10:02 +0000)]
[CodeGen] Print external symbols as $symbol in both MIR and debug output

Work towards the unification of MIR and debug output by printing
`$symbol` instead of `<es:symbol>`.

Only debug syntax is affected.

llvm-svn: 320681

7 years ago[Verifier] Check that GEP indexes has correct types
Igor Laevsky [Thu, 14 Dec 2017 09:33:58 +0000 (09:33 +0000)]
[Verifier] Check that GEP indexes has correct types

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

llvm-svn: 320680

7 years ago[DAGCombine] Move AND nodes to multiple load leaves
Sam Parker [Thu, 14 Dec 2017 09:31:01 +0000 (09:31 +0000)]
[DAGCombine] Move AND nodes to multiple load leaves

Recommitting rL319773, which was reverted due to a recursive issue
causing timeouts. This happened because I failed to check whether
the discovered loads could be narrowed further. In the case of a tree
with one or more narrow loads, that could not be further narrowed, as
well as a node that would need masking, an AND could be introduced
which could then be visited and recombined again with the same load.
This could again create the masking load, with would be combined
again... We now check that the load can be narrowed so that this
process stops.

Original commit message:
Search from AND nodes to find whether they can be propagated back to
loads, so that the AND and load can be combined into a narrow load.
We search through OR, XOR and other AND nodes and all bar one of the
leaves are required to be loads or constants. The exception node then
needs to be masked off meaning that the 'and' isn't removed, but the
loads(s) are narrowed still.

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

llvm-svn: 320679

7 years ago[clangd] Fix the unitttest build error on buildbot.
Haojian Wu [Thu, 14 Dec 2017 09:20:21 +0000 (09:20 +0000)]
[clangd] Fix the unitttest build error on buildbot.

llvm-svn: 320678

7 years ago[COFF] Error out if 20 bit thumb branches are out of range
Martin Storsjo [Thu, 14 Dec 2017 08:56:36 +0000 (08:56 +0000)]
[COFF] Error out if 20 bit thumb branches are out of range

This is similar to what was added in SVN r277838 for 24 bit
branch instructions.

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

llvm-svn: 320677

7 years ago[COFF] Sort .pdata for arm64
Martin Storsjo [Thu, 14 Dec 2017 08:56:29 +0000 (08:56 +0000)]
[COFF] Sort .pdata for arm64

This works for linking the output from the MSVC compiler.
The pdata entries for arm64 seem to be 8 bytes in the same
(or at least similar) form to arm.

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

llvm-svn: 320676

7 years ago[X86] Make ANY_EXTEND from vXi1 Custom for more types.
Craig Topper [Thu, 14 Dec 2017 08:26:00 +0000 (08:26 +0000)]
[X86] Make ANY_EXTEND from vXi1 Custom for more types.

We should be able to support ANY_EXTEND for any types we support ZERO_EXTEND for.

llvm-svn: 320675

7 years ago[SelectionDAG][X86] Improve legalization of v32i1 CONCAT_VECTORS of v16i1 for AVX512F.
Craig Topper [Thu, 14 Dec 2017 08:25:58 +0000 (08:25 +0000)]
[SelectionDAG][X86] Improve legalization of v32i1 CONCAT_VECTORS of v16i1 for AVX512F.

A v32i1 CONCAT_VECTORS of v16i1 uses promotion to v32i8 to legalize the v32i1. This results in a bunch of extract_vector_elts and a build_vector that ultimately gets scalarized.

This patch checks to see if v16i8 is legal and inserts a any_extend to that so that we can concat v16i8 to v32i8 and avoid creating the extracts.

llvm-svn: 320674

7 years ago[X86] Remove redundant setOperationAction calls.
Craig Topper [Thu, 14 Dec 2017 08:25:53 +0000 (08:25 +0000)]
[X86] Remove redundant setOperationAction calls.

These calls already exist earlier under AVX2 feature.

llvm-svn: 320673

7 years ago[LV] Support efficient vectorization of an induction with redundant casts
Dorit Nuzman [Thu, 14 Dec 2017 07:56:31 +0000 (07:56 +0000)]
[LV] Support efficient vectorization of an induction with redundant casts

D30041 extended SCEVPredicateRewriter to improve handling of Phi nodes whose
update chain involves casts; PSCEV can now build an AddRecurrence for some
forms of such phi nodes, under the proper runtime overflow test. This means
that we can identify such phi nodes as an induction, and the loop-vectorizer
can now vectorize such inductions, however inefficiently. The vectorizer
doesn't know that it can ignore the casts, and so it vectorizes them.

This patch records the casts in the InductionDescriptor, so that they could
be marked to be ignored for cost calculation (we use VecValuesToIgnore for
that) and ignored for vectorization/widening/scalarization (i.e. treated as
TriviallyDead).

In addition to marking all these casts to be ignored, we also need to make
sure that each cast is mapped to the right vector value in the vector loop body
(be it a widened, vectorized, or scalarized induction). So whenever an
induction phi is mapped to a vector value (during vectorization/widening/
scalarization), we also map the respective cast instruction (if exists) to that
vector value. (If the phi-update sequence of an induction involves more than one
cast, then the above mapping to vector value is relevant only for the last cast
of the sequence as we allow only the "last cast" to be used outside the
induction update chain itself).

This is the last step in addressing PR30654.

llvm-svn: 320672

7 years agoFix a build bot failure.
Igor Kudrin [Thu, 14 Dec 2017 07:28:11 +0000 (07:28 +0000)]
Fix a build bot failure.

llvm-svn: 320671

7 years ago[X86][AES]: Adding full coverage of MC encoding for the AES and AVXAES isa sets....
Gadi Haber [Thu, 14 Dec 2017 07:26:08 +0000 (07:26 +0000)]
[X86][AES]: Adding full coverage of MC encoding for the AES and AVXAES isa sets.<NFC>

NFC.
Adding MC regressions tests to cover the AES and AVXAES ISA sets both 32 and 64 bit.
This patch is part of a larger task to cover MC encoding of all X86 ISA Sets.
started in revision: https://reviews.llvm.org/D39952

Reviewers: zvi, craig.topper, m_zuckerman, RKSimon
Differential Revision: https://reviews.llvm.org/D41154

Change-Id: I2564f9797628d0c070c4766f837f399337fb87d2
llvm-svn: 320670

7 years ago[SelectionDAG] When legalizing the result type of CONCAT_VECTORS, take into account...
Craig Topper [Thu, 14 Dec 2017 06:49:07 +0000 (06:49 +0000)]
[SelectionDAG] When legalizing the result type of CONCAT_VECTORS, take into account whether the input type also needs to be promoted.

If so go ahead and get the promoted input vector to extract from. Previously, we would create a bunch of any_extends of extract_vector_elts with illegal input type that needs to be promoted. The legalization of those extract_vector_elts would then potentially introduce a truncate. So now we have a bunch of any_extends of truncates. By legalizing both parts together we avoid creating these extra nodes.

The test changes seem to be because we were previously combining the build_vector with the any_extend before the any_extend got combined with the truncate.

llvm-svn: 320669

7 years ago[ELF] Prevent crash in writing an .ARM.exidx sentinel entry.
Igor Kudrin [Thu, 14 Dec 2017 06:23:50 +0000 (06:23 +0000)]
[ELF] Prevent crash in writing an .ARM.exidx sentinel entry.

We might crash in 'ARMExidxSentinelSection::writeTo()' because it expected
the sentinel entry to be put in the same 'InputSectionDescription' as
the last real entry. This assumption fails if the last output section command
for .ARM.exidx is anything but an input section description, because in this
case 'OutputSection::addSection()' creates a new 'InputSectionDescription'.

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

llvm-svn: 320668

7 years agoFix crash on invalid.
Rafael Espindola [Thu, 14 Dec 2017 05:01:49 +0000 (05:01 +0000)]
Fix crash on invalid.

We would fail an assert if a shared library had a local symbol after
sh_info.

llvm-svn: 320667

7 years agoMC/AsmPrinter: Reduce code duplication.
Matthias Braun [Thu, 14 Dec 2017 03:59:24 +0000 (03:59 +0000)]
MC/AsmPrinter: Reduce code duplication.

Factor out duplicated code emitting mach-o version-min specifiers.

This should be NFC but happens to fix a bug where the code in
MCMachoStreamer didn't take the version skew between darwin and macos
versions into account.

llvm-svn: 320666

7 years ago[scudo] Disabling the interface test on armhf
Kostya Kortchinsky [Thu, 14 Dec 2017 02:54:11 +0000 (02:54 +0000)]
[scudo] Disabling the interface test on armhf

Summary:
I will investigate the breakage tomorrow, disable on armhf to turn the bots
green over the night.

http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/2952/steps/ninja%20check%202/logs/FAIL%3A%20Scudo-armhf%3A%3A%20interface.cpp

This is post https://reviews.llvm.org/D41128.

Reviewers: alekseyshl

Subscribers: aemerson, kristof.beyls, llvm-commits, #sanitizers

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

llvm-svn: 320665

7 years ago[XRay][compiler-rt] Coalesce calls to mprotect to reduce patching overhead
Dean Michael Berris [Thu, 14 Dec 2017 02:51:20 +0000 (02:51 +0000)]
[XRay][compiler-rt] Coalesce calls to mprotect to reduce patching overhead

Summary:
Before this change, XRay would conservatively patch sections of the code
one sled at a time. Upon testing/profiling, this turns out to take an
inordinate amount of time and cycles. For an instrumented clang binary,
the cycles spent both in the patching/unpatching routine constituted 4%
of the cycles -- this didn't count the time spent in the kernel while
performing the mprotect calls in quick succession.

With this change, we're coalescing the number of calls to mprotect from
being linear to the number of instrumentation points, to now being a
lower constant when patching all the sleds through `__xray_patch()` or
`__xray_unpatch()`. In the case of calling `__xray_patch_function()` or
`__xray_unpatch_function()` we're now doing an mprotect call once for
all the sleds for that function (reduction of at least 2x calls to
mprotect).

Reviewers: kpw, eizan

Subscribers: llvm-commits

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

llvm-svn: 320664

7 years agoSet of corrections for MSan/NetBSD
Kamil Rytarowski [Thu, 14 Dec 2017 01:20:16 +0000 (01:20 +0000)]
Set of corrections for MSan/NetBSD

Summary:
Changes:

 - Don't attempt to intercept GLIBC specific functions like __strtol_internal.
   This is required to stop intercepting it as we leak dlerror(3) for dlsym(3)
   that cannot manage to find a symbol.
 - Correct interception of fstatat(2).
 - Don't run a test for fgetgrent_r() that is missing on NetBSD.
 - Correct link_map location (offset) in Obj_Entry on x86_64 and i386.
 - Stop intercepting getpshared-like functions in pthread(3). This is feature
   is not enabled by default on NetBSD as it's unfinished.
 - Switch intercepting from UTMP to UTMPX functions.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, eugenis, kcc

Reviewed By: vitalybuka

Subscribers: llvm-commits, srhines, kubamracek, #sanitizers

Tags: #sanitizers

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

llvm-svn: 320663

7 years ago[WebAssembly] Update YAML expected output after llvm change
Sam Clegg [Thu, 14 Dec 2017 00:34:25 +0000 (00:34 +0000)]
[WebAssembly] Update YAML expected output after llvm change

See: https://reviews.llvm.org/D41202

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

llvm-svn: 320662

7 years agoMC: Add support for mach-o build_version
Matthias Braun [Thu, 14 Dec 2017 00:12:46 +0000 (00:12 +0000)]
MC: Add support for mach-o build_version

LC_BUILD_VERSION is a new load command superseding the previously used
LC_XXX_MIN_VERSION commands. This adds an assembler directive along with
encoding/streaming support.

llvm-svn: 320661

7 years ago[asan] Use linker initialization for the allocator
Kuba Mracek [Thu, 14 Dec 2017 00:07:15 +0000 (00:07 +0000)]
[asan] Use linker initialization for the allocator

This saves ~2 MB of dirty memory footprint. Can be a big deal on mobile devices especially when running multiple processes with ASan.

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

llvm-svn: 320660

7 years ago[sanitizer] Use MADV_FREE on Darwin/BSD to release pages to the OS
Kuba Mracek [Thu, 14 Dec 2017 00:04:30 +0000 (00:04 +0000)]
[sanitizer] Use MADV_FREE on Darwin/BSD to release pages to the OS

MADV_DONTNEED on Linux actually mark the pages as free to be overwritten with zeroes, but on Darwin and BSD, it's just an advisory flag (the OS cannot discard the content). We should use MADV_FREE on Darwin and BSD.

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

llvm-svn: 320659

7 years ago[CMake] Pass LLVM_HAVE_LINK_VERSION_SCRIPT to external projects
Petr Hosek [Wed, 13 Dec 2017 23:49:51 +0000 (23:49 +0000)]
[CMake] Pass LLVM_HAVE_LINK_VERSION_SCRIPT to external projects

Some external projects depend on this LLVM CMake variable.

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

llvm-svn: 320658

7 years ago[cmake] Add support for case-sensitive Windows SDKs
Shoaib Meenai [Wed, 13 Dec 2017 23:38:12 +0000 (23:38 +0000)]
[cmake] Add support for case-sensitive Windows SDKs

When the Windows SDK is hosted on a case-sensitive filesystem (e.g. when
compiling on Linux and not using ciopfs), we can automatically generate
a VFS overlay for headers and symlinks for libraries.

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

llvm-svn: 320657

7 years ago[cmake] Support host architectures other than x64
Shoaib Meenai [Wed, 13 Dec 2017 23:12:38 +0000 (23:12 +0000)]
[cmake] Support host architectures other than x64

Allow building for other architectures when cross-compiling for Windows.

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

llvm-svn: 320656

7 years agoRecommit r320461 "[X86] Use regular expressions more aggressively to reduce the numbe...
Craig Topper [Wed, 13 Dec 2017 23:11:30 +0000 (23:11 +0000)]
Recommit r320461 "[X86] Use regular expressions more aggressively to reduce the number of scheduler entries needed for FMA3 instructions."

I've hopefully sidestepped the MSVC issue that caused it to be reverted. We no longer include the Sched enum from X86GenInstrInfo.inc on the X86 target. So hopefully MSVC's preprocessor will skip over it and nothing will notice the 11000 character enum name.

Original commit message:

When the scheduler tables are generated by tablegen, the instructions are divided up into groups based on their default scheduling information and how they are referenced by groups for each processor. For any set of instructions that are matched by a specific InstRW line, that group of instructions is guaranteed to not be in a group with any other instructions. So in general, the more InstRW class definitions are created, the more groups we end up with in the generated files. Particularly if a lot of the InstRW lines only match to single instructions, which is true of a large number of the Intel scheduler models.

This change alone reduces the number of instructions groups from ~6000 to ~5500. And there's lots more we could do.

llvm-svn: 320655

7 years agoMove Repl to SectionBase.
Rafael Espindola [Wed, 13 Dec 2017 22:59:23 +0000 (22:59 +0000)]
Move Repl to SectionBase.

It is currently in InputSectionBase. Only InputSections are used in
ICF, so Repl should be move to InputSection to clear the class
hierarchy or, like this patch does, to SectionBase for convenience.

The convenience of having it on the base class is that we can just
access the replacement without having to first check if it is an
InputSection. It is a bit less code and a bit faster as some of this
code is very hot.

I got up to 1.77% improvement in clang-gdb-index and no regressions
according to lnt.

llvm-svn: 320654

7 years ago[EarlyCSE] recognize swapped variants of abs/nabs as equivalent
Sanjay Patel [Wed, 13 Dec 2017 22:57:35 +0000 (22:57 +0000)]
[EarlyCSE] recognize swapped variants of abs/nabs as equivalent

Extends https://reviews.llvm.org/rL320640

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

llvm-svn: 320653

7 years agoInline a small function.
Rui Ueyama [Wed, 13 Dec 2017 22:53:59 +0000 (22:53 +0000)]
Inline a small function.

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

llvm-svn: 320652

7 years ago[X86] Add missing MULX32 schedule test
Simon Pilgrim [Wed, 13 Dec 2017 22:43:55 +0000 (22:43 +0000)]
[X86] Add missing MULX32 schedule test

llvm-svn: 320651

7 years agoCodeGen: Fix assertion in machine inst sheduler due to llvm.dbg.value
Yaxun Liu [Wed, 13 Dec 2017 22:38:09 +0000 (22:38 +0000)]
CodeGen: Fix assertion in machine inst sheduler due to llvm.dbg.value

Two issues were found about machine inst scheduler when compiling ProRender
with -g for amdgcn target:

GCNScheduleDAGMILive::schedule tries to update LiveIntervals for DBG_VALUE, which it
should not since DBG_VALUE is not mapped in LiveIntervals.

when DBG_VALUE is the last instruction of MBB, ScheduleDAGInstrs::buildSchedGraph and
ScheduleDAGMILive::scheduleMI does not move RPTracker properly, which causes assertion.

This patch fixes that.

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

llvm-svn: 320650

7 years ago[CodeView] Teach clang to emit the .debug$H COFF section.
Zachary Turner [Wed, 13 Dec 2017 22:33:58 +0000 (22:33 +0000)]
[CodeView] Teach clang to emit the .debug$H COFF section.

Currently this is an LLVM extension to the COFF spec which is
experimental and intended to speed up linking.  For now it is
behind a hidden cl::opt flag, but in the future we can move it
to a "real" cc1 flag and have the driver pass it through whenever
it is appropriate.

The patch to actually make use of this section in lld will come
in a followup.

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

llvm-svn: 320649

7 years agoRecover some overzealously removed includes.
Michael Zolotukhin [Wed, 13 Dec 2017 22:21:02 +0000 (22:21 +0000)]
Recover some overzealously removed includes.

llvm-svn: 320648

7 years ago[EarlyCSE] add tests for swapped abs/nabs; NFC
Sanjay Patel [Wed, 13 Dec 2017 22:19:40 +0000 (22:19 +0000)]
[EarlyCSE] add tests for swapped abs/nabs; NFC

llvm-svn: 320647

7 years agoSpeculative build fix for llvm-pdbdump on Linux after Michael's #include removals
Hans Wennborg [Wed, 13 Dec 2017 22:12:58 +0000 (22:12 +0000)]
Speculative build fix for llvm-pdbdump on Linux after Michael's #include removals

llvm-svn: 320646

7 years agoSpeculative build fix for lld on Linux after Michael's #include removals
Hans Wennborg [Wed, 13 Dec 2017 22:12:57 +0000 (22:12 +0000)]
Speculative build fix for lld on Linux after Michael's #include removals

llvm-svn: 320645

7 years ago[X86] Add CLWB schedule test
Simon Pilgrim [Wed, 13 Dec 2017 22:09:09 +0000 (22:09 +0000)]
[X86] Add CLWB schedule test

llvm-svn: 320644

7 years ago[libFuzzer] Add dummy call of LLVMFuzzerTestOneInput to afl_driver.
Matt Morehouse [Wed, 13 Dec 2017 22:02:44 +0000 (22:02 +0000)]
[libFuzzer] Add dummy call of LLVMFuzzerTestOneInput to afl_driver.

Summary:
Add dummy call of LLVMFuzzerTestOneInput to afl_driver before it starts
executing on actual inputs. Do this so that first time initialization
performed by LLVMFuzzerTestOneInput is not considered code covered by
a particular input.

Patch By: metzman

Reviewers: kcc, morehouse

Reviewed By: kcc

Subscribers: llvm-commits, Sanitizers

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

llvm-svn: 320643

7 years ago[WebAssembly] Use bitfield types in wasm YAML representation
Sam Clegg [Wed, 13 Dec 2017 22:02:25 +0000 (22:02 +0000)]
[WebAssembly] Use bitfield types in wasm YAML representation

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

llvm-svn: 320642

7 years agoReverting [JumpThreading] Preservation of DT and LVI across the pass
Brian M. Rzycki [Wed, 13 Dec 2017 22:01:17 +0000 (22:01 +0000)]
Reverting [JumpThreading] Preservation of DT and LVI across the pass

Stage 2 bootstrap failed:
http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/14434

llvm-svn: 320641

7 years ago[EarlyCSE] recognize commuted and swapped variants of min/max as equivalent (PR35642)
Sanjay Patel [Wed, 13 Dec 2017 21:58:15 +0000 (21:58 +0000)]
[EarlyCSE] recognize commuted and swapped variants of min/max as equivalent (PR35642)

As shown in:
https://bugs.llvm.org/show_bug.cgi?id=35642
...we can have different forms of min/max, so we should recognize those here in EarlyCSE
similar to how we already handle binops and compares that can commute.

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

llvm-svn: 320640

7 years ago[WebAssembly] Add linking metatdata test coverage for wasm2yaml
Sam Clegg [Wed, 13 Dec 2017 21:53:40 +0000 (21:53 +0000)]
[WebAssembly] Add linking metatdata test coverage for wasm2yaml

Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish

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

llvm-svn: 320639

7 years agoIRGen: When performing CFI checks, load vtable pointer from vbase when necessary.
Peter Collingbourne [Wed, 13 Dec 2017 21:53:04 +0000 (21:53 +0000)]
IRGen: When performing CFI checks, load vtable pointer from vbase when necessary.

Under the Microsoft ABI, it is possible for an object not to have
a virtual table pointer of its own if all of its virtual functions
were introduced by virtual bases. In that case, we need to load the
vtable pointer from one of the virtual bases and perform the type
check using its type.

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

llvm-svn: 320638

7 years ago[X86] Move ADX schedule tests out of schedule-x86_64.ll
Simon Pilgrim [Wed, 13 Dec 2017 21:49:09 +0000 (21:49 +0000)]
[X86] Move ADX schedule tests out of schedule-x86_64.ll

llvm-svn: 320637

7 years agoRemove redundant includes from lib/Target/X86.
Michael Zolotukhin [Wed, 13 Dec 2017 21:31:19 +0000 (21:31 +0000)]
Remove redundant includes from lib/Target/X86.

llvm-svn: 320636

7 years agoRemove redundant includes from lib/Target/ARM.
Michael Zolotukhin [Wed, 13 Dec 2017 21:31:17 +0000 (21:31 +0000)]
Remove redundant includes from lib/Target/ARM.

llvm-svn: 320635

7 years agoRemove redundant includes from lib/Target/AArch64.
Michael Zolotukhin [Wed, 13 Dec 2017 21:31:16 +0000 (21:31 +0000)]
Remove redundant includes from lib/Target/AArch64.

llvm-svn: 320634

7 years agoRemove redundant includes from lib/Target/*.cpp.
Michael Zolotukhin [Wed, 13 Dec 2017 21:31:14 +0000 (21:31 +0000)]
Remove redundant includes from lib/Target/*.cpp.

llvm-svn: 320633

7 years agoRemove redundant includes from utils/TableGen.
Michael Zolotukhin [Wed, 13 Dec 2017 21:31:13 +0000 (21:31 +0000)]
Remove redundant includes from utils/TableGen.

llvm-svn: 320632

7 years agoRemove redundant includes from tools.
Michael Zolotukhin [Wed, 13 Dec 2017 21:31:10 +0000 (21:31 +0000)]
Remove redundant includes from tools.

llvm-svn: 320631

7 years agoRemove redundant includes from unittests.
Michael Zolotukhin [Wed, 13 Dec 2017 21:31:05 +0000 (21:31 +0000)]
Remove redundant includes from unittests.

llvm-svn: 320630

7 years agoRemove redundant includes from various places.
Michael Zolotukhin [Wed, 13 Dec 2017 21:31:03 +0000 (21:31 +0000)]
Remove redundant includes from various places.

llvm-svn: 320629

7 years agoRemove redundant includes from lib/Transforms.
Michael Zolotukhin [Wed, 13 Dec 2017 21:31:01 +0000 (21:31 +0000)]
Remove redundant includes from lib/Transforms.

llvm-svn: 320628

7 years agoRemove redundant includes from lib/Support.
Michael Zolotukhin [Wed, 13 Dec 2017 21:30:58 +0000 (21:30 +0000)]
Remove redundant includes from lib/Support.

llvm-svn: 320627

7 years agoRemove redundant includes from lib/ProfileData.
Michael Zolotukhin [Wed, 13 Dec 2017 21:30:57 +0000 (21:30 +0000)]
Remove redundant includes from lib/ProfileData.

llvm-svn: 320626

7 years agoRemove redundant includes from lib/Object.
Michael Zolotukhin [Wed, 13 Dec 2017 21:30:55 +0000 (21:30 +0000)]
Remove redundant includes from lib/Object.

llvm-svn: 320625

7 years agoRemove redundant includes from lib/MC.
Michael Zolotukhin [Wed, 13 Dec 2017 21:30:54 +0000 (21:30 +0000)]
Remove redundant includes from lib/MC.

llvm-svn: 320624