platform/upstream/llvm.git
6 years ago[Esan] Port cache frag to FreeBSD
David Carlier [Thu, 4 Oct 2018 20:58:18 +0000 (20:58 +0000)]
[Esan] Port cache frag to FreeBSD

Data involving struct accesses accounting work (plan to support only efficiency-cache-frag flag in the frontend side).

Reviewers: krytarowski, vitalybuka, jfb

Reviewed By : vitalybuka

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

llvm-svn: 343812

6 years ago[COFF] [X86] Don't use llvm_unreachable for unsupported relocation types
Martin Storsjo [Thu, 4 Oct 2018 20:43:38 +0000 (20:43 +0000)]
[COFF] [X86] Don't use llvm_unreachable for unsupported relocation types

This can happen if assembling a reference to _GLOBAL_OFFSET_TABLE_.

While it doesn't make sense to try to assemble that for COFF,
the fact that we previously used llvm_unreachable meant that the code
had undefined behaviour if something tried to assemble that.

The configure script of libgmp would try to assemble such a snippet
(which should signal a failure). If llvm is built without assertions,
the undefined behaviour meant a (near) infinite loop.

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

llvm-svn: 343811

6 years agoThe Python 3 part of the script was missed when adding OpenBSD support.
Brad Smith [Thu, 4 Oct 2018 20:34:58 +0000 (20:34 +0000)]
The Python 3 part of the script was missed when adding OpenBSD support.

llvm-svn: 343810

6 years agoUpdate Clang Windows getting started docs
Reid Kleckner [Thu, 4 Oct 2018 20:34:52 +0000 (20:34 +0000)]
Update Clang Windows getting started docs

Summary:
- Update the example VS project generation to use VS2017.
- Add docs for generating ninja build files, since they are popular.
- Remove reference to "make update" which no longer exists. Mention the
  monorepo instead.
- Try to explain gnuwin32/coreutils requirements better.
- Use https:// links where possible

Reviewers: zturner, STL_MSFT

Subscribers: jfb, cfe-commits

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

llvm-svn: 343809

6 years ago[AST] Revert mangling changes from r339428
Shoaib Meenai [Thu, 4 Oct 2018 19:50:14 +0000 (19:50 +0000)]
[AST] Revert mangling changes from r339428

As discussed in https://reviews.llvm.org/D50144, we want Obj-C classes
to have the same mangling as C++ structs, to support headers like the
following:

```
@class I;
struct I;

void f(I *);
```

since the header can be used from both C++ and Obj-C++ TUs, and we want
a consistent mangling across the two to prevent link errors. Itanium
mangles both the same way, and so should the MS ABI.

The main concern with having the same mangling for C++ structs and Obj-C
classes was that we want to treat them differently for the purposes of
exception handling, e.g. we don't want a C++ catch statement for a
struct to be able to catch an Obj-C class with the same name as the
struct. We can accomplish this by mangling Obj-C class names differently
in their RTTI, which I'll do in a follow-up patch.

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

llvm-svn: 343808

6 years ago[NestedNameSpecifier] Add missing stream-specific dump methods
Stephen Kelly [Thu, 4 Oct 2018 19:22:00 +0000 (19:22 +0000)]
[NestedNameSpecifier] Add missing stream-specific dump methods

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 343807

6 years ago[InstCombine] reduce code duplication in SimplifyDemandedVectorElts; NFCI
Sanjay Patel [Thu, 4 Oct 2018 19:12:07 +0000 (19:12 +0000)]
[InstCombine] reduce code duplication in SimplifyDemandedVectorElts; NFCI

llvm-svn: 343806

6 years agoGive same-named members unique timestamps on Darwin in llvm-ar.
James Y Knight [Thu, 4 Oct 2018 18:49:21 +0000 (18:49 +0000)]
Give same-named members unique timestamps on Darwin in llvm-ar.

This change ensures that the (membername,timestamp) tuple uniquely
identifies an entry in an archive for format=darwin, in deterministic
mode (which is the default).

That, then, enables lldb and dsymutil to locate the appropriate object
within the archive.

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

llvm-svn: 343805

6 years ago[globalisel][combine] Improve the truncate placement for the extending-loads combine
Daniel Sanders [Thu, 4 Oct 2018 18:44:58 +0000 (18:44 +0000)]
[globalisel][combine] Improve the truncate placement for the extending-loads combine

This brings the extending loads patch back to the original intent but minus the
PHI bug and with another small improvement to de-dupe truncates that are
inserted into the same block.

The truncates are sunk to their uses unless this would require inserting before a
phi in which case it sinks to the _beginning_ of the predecessor block for that
path (but no earlier than the def).

The reason for choosing the beginning of the predecessor is that it makes de-duping
multiple truncates in the same block simple, and optimized code is going to run a
scheduler at some point which will likely change the position anyway.

llvm-svn: 343804

6 years ago[x86] add test for SSE sqrtss register dep (PR22206)
Sanjay Patel [Thu, 4 Oct 2018 17:59:30 +0000 (17:59 +0000)]
[x86] add test for SSE sqrtss register dep (PR22206)

llvm-svn: 343803

6 years ago[clangd] Simplify Dex query tree logic and fix missing-posting-list bug
Sam McCall [Thu, 4 Oct 2018 17:18:55 +0000 (17:18 +0000)]
[clangd] Simplify Dex query tree logic and fix missing-posting-list bug

Summary:
The bug being fixed: when a posting list doesn't exist in the index, it
was previously just dropped from the query rather than being treated as
empty. Now that we have the FALSE iterator, we can use it instead.

The query tree logic previously had a bunch of special cases to detect whether
subtrees are empty. Now we just naively build the whole tree, and rely
on the query optimizations to drop the trivial parts.

Finally, there was a bug in trigram generation: the empty query would
generate a single trigram "$$$" instead of no trigrams.
This had no effect (there was no posting list, so the other bug
cancelled it out). But we now have to fix this bug too.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 343802

6 years ago[clangd] Dex: FALSE iterator, peephole optimizations, fix AND bug
Sam McCall [Thu, 4 Oct 2018 17:18:49 +0000 (17:18 +0000)]
[clangd] Dex: FALSE iterator, peephole optimizations, fix AND bug

Summary:
The FALSE iterator will be used in a followup patch to fix a logic bug in Dex
(currently, tokens that don't have posting lists in the index are simply dropped
from the query, changing semantics).

It can usually be optimized away, so added the following opmitizations:
 - simplify booleans inside AND/OR
 - replace effectively-empty AND/OR with booleans
 - flatten nested AND/ORs

While working on this, found a bug in the AND iterator: its constructor sync()
assumes that ReachedEnd is set if applicable, but the constructor never sets it.
This crashes if a non-first iterator is nonempty.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 343801

6 years ago[clangd] Add std::move for converting-return to satisfy older compilers
Sam McCall [Thu, 4 Oct 2018 17:15:41 +0000 (17:15 +0000)]
[clangd] Add std::move for converting-return to satisfy older compilers

llvm-svn: 343800

6 years agoAArch64: Fix XSeqPairs/WSeqPairs problems
Matthias Braun [Thu, 4 Oct 2018 17:02:53 +0000 (17:02 +0000)]
AArch64: Fix XSeqPairs/WSeqPairs problems

- Fix spill/reloads of XSeqPairs failing with vregs (only physregs
  worked correctly)
- Add missing spill/reload code for WSeqPairs class

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

llvm-svn: 343799

6 years ago[AMDGPU] Match signed dot4/8 pattern.
Farhana Aleen [Thu, 4 Oct 2018 16:57:37 +0000 (16:57 +0000)]
[AMDGPU] Match signed dot4/8 pattern.

Summary: This patch matches signed dot4 and dot8 pattern.

Author: FarhanaAleen

Reviewed By: msearles

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

llvm-svn: 343798

6 years ago[clang-tidy] fix failing unit tests
Jonas Toth [Thu, 4 Oct 2018 16:39:41 +0000 (16:39 +0000)]
[clang-tidy] fix failing unit tests

The removal from the FIX-IT notes through the check-clang-tidy
script was done incorrect. I did not detect beforehand but adjusted
the script and tests accordingly

llvm-svn: 343797

6 years ago[clangd] fix another ambigous constructor in DexTest
Jonas Toth [Thu, 4 Oct 2018 16:29:58 +0000 (16:29 +0000)]
[clangd] fix another ambigous constructor in DexTest

llvm-svn: 343796

6 years ago[llvm-mca][x86] Add PR36951 ReadAfterLd test case
Simon Pilgrim [Thu, 4 Oct 2018 16:26:56 +0000 (16:26 +0000)]
[llvm-mca][x86] Add PR36951 ReadAfterLd test case

llvm-svn: 343795

6 years ago[InstCombine] allow bitcast to/from FP for vector insert/extract transform
Sanjay Patel [Thu, 4 Oct 2018 16:25:05 +0000 (16:25 +0000)]
[InstCombine] allow bitcast to/from FP for vector insert/extract transform

This is a follow-up to rL343482 / D52439.
This was a pattern that initially caused the commit to be reverted because
the transform requires a bitcast as shown here.

llvm-svn: 343794

6 years ago[clangd] Fix ambiguous constructor in DexTest
Sam McCall [Thu, 4 Oct 2018 16:05:22 +0000 (16:05 +0000)]
[clangd] Fix ambiguous constructor in DexTest

llvm-svn: 343793

6 years ago[clang-tidy] NFC use CHECK-NOTES in tests for fuchsia-default-arguments
Jonas Toth [Thu, 4 Oct 2018 15:59:30 +0000 (15:59 +0000)]
[clang-tidy] NFC use CHECK-NOTES in tests for fuchsia-default-arguments

Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: alexfh

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 343792

6 years ago[clang-tidy] NFC use CHECK-NOTES in tests for performance-move-constructor-init
Jonas Toth [Thu, 4 Oct 2018 15:55:37 +0000 (15:55 +0000)]
[clang-tidy] NFC use CHECK-NOTES in tests for performance-move-constructor-init

Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: alexfh

Subscribers: lebedev.ri, xazax.hun, cfe-commits

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

llvm-svn: 343791

6 years ago[clang] Add the exclude_from_explicit_instantiation attribute
Louis Dionne [Thu, 4 Oct 2018 15:49:42 +0000 (15:49 +0000)]
[clang] Add the exclude_from_explicit_instantiation attribute

Summary:
This attribute allows excluding a member of a class template from being part
of an explicit template instantiation of that class template. This also makes
sure that code using such a member will not take for granted that an external
instantiation exists in another translation unit. The attribute was discussed
on cfe-dev at [1] and is primarily motivated by the removal of always_inline
in libc++ to control what's part of the ABI (see links in [1]).

[1]: http://lists.llvm.org/pipermail/cfe-dev/2018-August/059024.html

rdar://problem/43428125

Reviewers: rsmith

Subscribers: dexonsmith, cfe-commits

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

llvm-svn: 343790

6 years ago[clang-tidy] fix PR39167, bugprone-exception-escape hangs-up
Jonas Toth [Thu, 4 Oct 2018 15:49:25 +0000 (15:49 +0000)]
[clang-tidy] fix PR39167, bugprone-exception-escape hangs-up

Summary:
The check bugprone-exception-escape should not register
if -fno-exceptions is set for the compile options. Bailing out on non-cplusplus
and non-exceptions language options resolves the issue.

Reviewers: alexfh, aaron.ballman, baloghadamsoftware

Reviewed By: alexfh

Subscribers: lebedev.ri, xazax.hun, rnkovacs, cfe-commits

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

llvm-svn: 343789

6 years ago[clang-tidy] Added pointer types to clang-tidy readability-identifier-naming check.
Jonas Toth [Thu, 4 Oct 2018 15:47:57 +0000 (15:47 +0000)]
[clang-tidy] Added pointer types to clang-tidy readability-identifier-naming check.

Summary:

Option to check for different naming conventions on the following types:

  - GlobalConstantPointer
  - GlobalPointer
  - LocalConstantPointer
  - LocalPointer
  - PointerParameter
  - ConstantPointerParameter

When not specified, the conventions for the non pointer types will be applied (GlobalConstant, GlobalVariable, LocalConstant, ...).

Patch by ffigueras!

Reviewers: alexfh, kbobyrev

Reviewed By: alexfh

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 343788

6 years ago[llvm-mca] Move field 'AllowZeroMoveEliminationOnly' to class RegisterFile. NFC.
Andrea Di Biagio [Thu, 4 Oct 2018 15:20:56 +0000 (15:20 +0000)]
[llvm-mca] Move field 'AllowZeroMoveEliminationOnly' to class RegisterFile. NFC.

Flag 'AllowZeroMoveEliminationOnly' should have been a property of the PRF, and
not set at register granularity.

This change also restricts move elimination to writes that update a full
physical register. We assume that there is a strong correlation between
logical registers that allow move elimination, and how those same registers are
allocated to physical registers by the register renamer.

This is still a no functional change, because this experimental code path is
disabled for now. This is done in preparation for another patch that will add
the ability to describe how move elimination works in scheduling models.

llvm-svn: 343787

6 years ago[X86][AVX] Add PR39161 test case for v4f64 zzww shuffle
Simon Pilgrim [Thu, 4 Oct 2018 15:06:09 +0000 (15:06 +0000)]
[X86][AVX] Add PR39161 test case for v4f64 zzww shuffle

llvm-svn: 343786

6 years ago[OpenMP][OMPT] Fix unsafe initialization of ompt_data_t objects
Jonathan Peyton [Thu, 4 Oct 2018 14:57:04 +0000 (14:57 +0000)]
[OpenMP][OMPT] Fix unsafe initialization of ompt_data_t objects

Initializing an ompt_data_t object using the pointer union member is potentially
unsafe in 32-bit programs.  This change fixes the issue
by using the constant, ompt_data_none.

Patch by Hansang Bae

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

llvm-svn: 343785

6 years ago[ELF][HEXAGON] Add support for GOT relocations.
Sid Manning [Thu, 4 Oct 2018 14:54:17 +0000 (14:54 +0000)]
[ELF][HEXAGON] Add support for GOT relocations.

The GOT is referenced through the symbol _GLOBAL_OFFSET_TABLE_ .

The relocation added calculates the offset into the global offset table for
the entry of a symbol.  In order to get the correct TargetVA I needed to
create an new relocation expression, HEXAGON_GOT.  It does
Sym.getGotVA() - In.GotPlt->getVA().

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

llvm-svn: 343784

6 years ago[utils] Ensure that update_mca_test_checks.py writes prefixes in alphabetical order
Greg Bedwell [Thu, 4 Oct 2018 14:42:19 +0000 (14:42 +0000)]
[utils] Ensure that update_mca_test_checks.py writes prefixes in alphabetical order

llvm-svn: 343783

6 years ago[utils] simple refactor in update_mca_test_checks.py to make intent more readable
Greg Bedwell [Thu, 4 Oct 2018 14:42:06 +0000 (14:42 +0000)]
[utils] simple refactor in update_mca_test_checks.py to make intent more readable

llvm-svn: 343782

6 years ago[RISCV] Remove overzealous is64Bit checks
Alex Bradbury [Thu, 4 Oct 2018 14:30:03 +0000 (14:30 +0000)]
[RISCV] Remove overzealous is64Bit checks

lowerGlobalAddress, lowerBlockAddress, and insertIndirectBranch contain
overzealous checks for is64Bit. These functions are all safe as-implemented
for RV64.

llvm-svn: 343781

6 years ago[clangd] expose MergedIndex class
Sam McCall [Thu, 4 Oct 2018 14:20:22 +0000 (14:20 +0000)]
[clangd] expose MergedIndex class

Summary:
This allows inheriting from it, so index() can ga away and allowing
TestTU::index) to be fixed.

Reviewers: ioeric

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 343780

6 years ago[clangd] clangd-indexer gathers refs and stores them in index files.
Sam McCall [Thu, 4 Oct 2018 14:09:55 +0000 (14:09 +0000)]
[clangd] clangd-indexer gathers refs and stores them in index files.

Reviewers: ioeric

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 343778

6 years ago[clangd] Remove one-segment-skipping from Dex trigrams.
Sam McCall [Thu, 4 Oct 2018 14:08:11 +0000 (14:08 +0000)]
[clangd] Remove one-segment-skipping from Dex trigrams.

Summary:
Currently queries like "ab" can match identifiers like a_yellow_bee.
The value of allowing this for exactly one segment but no more seems dubious.
It costs ~3% of overall ram (~9% of posting list ram) and some quality.

Reviewers: ilya-biryukov, ioeric

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 343777

6 years ago[X86] Set correct MMO offset on scalarized load pieces
David Greene [Thu, 4 Oct 2018 14:07:59 +0000 (14:07 +0000)]
[X86] Set correct MMO offset on scalarized load pieces

When scalarizing a load, be sure to update the offset in the
MachineMemOperand for each scalar load.

llvm-svn: 343776

6 years ago[cland] Dex: fix/simplify short-trigram generation
Sam McCall [Thu, 4 Oct 2018 14:01:55 +0000 (14:01 +0000)]
[cland] Dex: fix/simplify short-trigram generation

Summary:
1) Instead of x$$ for a short-query trigram, just use x
2) Make rules more coherent: prefixes of length 1-2, and first char + next head
3) Fix Dex::fuzzyFind to mark results as incomplete, because
   short-trigram rules only yield a subset of results.

Reviewers: ioeric

Subscribers: ilya-biryukov, jkorous, mgrang, arphaman, kadircet, cfe-commits

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

llvm-svn: 343775

6 years ago[clangd] Dex: FALSE iterator, peephole optimizations, fix AND bug
Sam McCall [Thu, 4 Oct 2018 13:12:23 +0000 (13:12 +0000)]
[clangd] Dex: FALSE iterator, peephole optimizations, fix AND bug

Summary:
The FALSE iterator will be used in a followup patch to fix a logic bug in Dex
(currently, tokens that don't have posting lists in the index are simply dropped
from the query, changing semantics).

It can usually be optimized away, so added the following opmitizations:
 - simplify booleans inside AND/OR
 - replace effectively-empty AND/OR with booleans
 - flatten nested AND/ORs

While working on this, found a bug in the AND iterator: its constructor sync()
assumes that ReachedEnd is set if applicable, but the constructor never sets it.
This crashes if a non-first iterator is nonempty.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 343774

6 years ago[llvm-mca][x86] Add tests demonstrating ReadAfterLd delay
Simon Pilgrim [Thu, 4 Oct 2018 13:05:42 +0000 (13:05 +0000)]
[llvm-mca][x86] Add tests demonstrating ReadAfterLd delay

llvm-svn: 343773

6 years ago[PassTimingInfo] cleanup on TimingData's Timer handling
Fedor Sergeev [Thu, 4 Oct 2018 12:49:57 +0000 (12:49 +0000)]
[PassTimingInfo] cleanup on TimingData's Timer handling

Replacing Timer* with unique_ptr<Timer> in a pass-to-timer map.
That allows to get rid of unpretty raw deletes in PassTimingInfo destructor.
Strictly cleanup, not intended to change any visible behavior.

llvm-svn: 343772

6 years ago[llvm-exegesis][NFC] Improve parsing of the YAML files
Guillaume Chatelet [Thu, 4 Oct 2018 12:33:46 +0000 (12:33 +0000)]
[llvm-exegesis][NFC] Improve parsing of the YAML files

Summary: sscanf turns out to be slow for reading floating points.

Reviewers: courbet

Subscribers: tschuett, llvm-commits, RKSimon

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

llvm-svn: 343771

6 years ago[doc] Update the programmer's manual about SmallSet's iterator
Kristof Umann [Thu, 4 Oct 2018 12:33:33 +0000 (12:33 +0000)]
[doc] Update the programmer's manual about SmallSet's iterator

Since rL337818, you can now iterate the SmallSet.

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

llvm-svn: 343770

6 years agoRe-commit r343500 "Fix build with GCC < 5.0 (PR39131)"
Tatyana Krasnukha [Thu, 4 Oct 2018 11:39:55 +0000 (11:39 +0000)]
Re-commit r343500 "Fix build with GCC < 5.0 (PR39131)"

Occasionally didn't commit actual fix the first time.

llvm-svn: 343769

6 years ago[clang-tidy] Sequence statements with multiple parents correctly (PR39149)
Martin Bohme [Thu, 4 Oct 2018 11:36:39 +0000 (11:36 +0000)]
[clang-tidy] Sequence statements with multiple parents correctly (PR39149)

Summary:
Before this fix, the bugprone-use-after-move check could incorrectly
conclude that a use and move in a function template were not sequenced.
For details, see

https://bugs.llvm.org/show_bug.cgi?id=39149

Reviewers: alexfh, hokein, aaron.ballman, JonasToth

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 343768

6 years ago[Index] Respect "IndexFunctionLocals" option for type loc.
Haojian Wu [Thu, 4 Oct 2018 11:03:55 +0000 (11:03 +0000)]
[Index] Respect "IndexFunctionLocals" option for type loc.

Summary:
Previously, clang index ignored local symbols defined in the function body even
IndexFunctionLocals is true.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, ioeric, arphaman, kadircet, cfe-commits

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

llvm-svn: 343767

6 years ago[llvm-mca] Check for inconsistencies when constructing instruction descriptors.
Andrea Di Biagio [Thu, 4 Oct 2018 10:36:49 +0000 (10:36 +0000)]
[llvm-mca] Check for inconsistencies when constructing instruction descriptors.

This should help with catching inconsistent definitions of instructions with
zero opcodes, which also declare to consume scheduler/pipeline resources.

llvm-svn: 343766

6 years agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Thu, 4 Oct 2018 10:25:52 +0000 (10:25 +0000)]
Fix MSVC "not all control paths return a value" warning. NFCI.

llvm-svn: 343765

6 years ago[clangd] Revert accidental flag change
Sam McCall [Thu, 4 Oct 2018 10:10:35 +0000 (10:10 +0000)]
[clangd] Revert accidental flag change

llvm-svn: 343764

6 years ago[clangd] Use canonical declarations in ReferenceFinder.
Haojian Wu [Thu, 4 Oct 2018 09:56:08 +0000 (09:56 +0000)]
[clangd] Use canonical declarations in ReferenceFinder.

Summary:
handleDeclOccurrencce reports a canonical declartion, so stick to use
canonical declarations to determine whether a declaration is in the
target set.

Also fix a previous ref test which misses a matched label (it fails without this
patch).

Reviewers: sammccall

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 343763

6 years ago[ELF] - Simplify. NFCI.
George Rimar [Thu, 4 Oct 2018 09:31:15 +0000 (09:31 +0000)]
[ELF] - Simplify. NFCI.

Assign the `Link` to parent directly.

llvm-svn: 343762

6 years ago[constexpr] Fix ICE when memcpy() is given a pointer to an incomplete array
Petr Pavlu [Thu, 4 Oct 2018 09:25:44 +0000 (09:25 +0000)]
[constexpr] Fix ICE when memcpy() is given a pointer to an incomplete array

Fix code for constant evaluation of __builtin_memcpy() and
__builtin_memmove() that would attempt to divide by zero when given two
pointers to an incomplete array.

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

llvm-svn: 343761

6 years ago[clangd] Support refs() in dex. Largely cloned from MemIndex.
Sam McCall [Thu, 4 Oct 2018 09:16:12 +0000 (09:16 +0000)]
[clangd] Support refs() in dex. Largely cloned from MemIndex.

Reviewers: hokein

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 343760

6 years ago[clangd] clangd-indexer: Drop support for MR-via-YAML
Sam McCall [Thu, 4 Oct 2018 08:30:03 +0000 (08:30 +0000)]
[clangd] clangd-indexer: Drop support for MR-via-YAML

Summary:
It's slow, and the open-source reduce implementation doesn't scale properly.
While here, tidy up some dead headers and comments.

Reviewers: kadircet

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 343759

6 years ago[AArch64][ARM] Context sensitive meaning of crypto
Sjoerd Meijer [Thu, 4 Oct 2018 07:38:53 +0000 (07:38 +0000)]
[AArch64][ARM] Context sensitive meaning of crypto

For AArch64, crypto means:
- sm4 + sha3 + sha2 + aes for Armv8.4-A and up, and
- sha2 + aes for Armv8.3-A and earlier.

For AArch32:
Crypto means sha2 + aes, because the Armv8.2-A crypto instructions
were added to AArch64 only.

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

llvm-svn: 343758

6 years ago[RISCV][NFC] Remove dead CHECK lines from vararg.ll test
Alex Bradbury [Thu, 4 Oct 2018 07:35:52 +0000 (07:35 +0000)]
[RISCV][NFC] Remove dead CHECK lines from vararg.ll test

The RISCV32 check prefix is no longer used so these lines are dead.

llvm-svn: 343757

6 years ago[RISCV] Bugfix for floats passed on the stack with the ILP32 ABI on RV32F
Alex Bradbury [Thu, 4 Oct 2018 07:28:49 +0000 (07:28 +0000)]
[RISCV] Bugfix for floats passed on the stack with the ILP32 ABI on RV32F

f32 values passed on the stack would previously cause an assertion in
unpackFromMemLoc.. This would only trigger in the presence of the F extension
making f32 a legal type. Otherwise the f32 would be legalized.

This patch fixes that by keeping LocVT=f32 when a float is passed on the
stack. It also adds test coverage for this case, and tests that also
demonstrate lw/sw/flw/fsw will be selected when most profitable. i.e. there is
no unnecessary i32<->f32 conversion in registers.

llvm-svn: 343756

6 years ago[llvm-exegesis][NFC] Test sched class names only in !NDEBUG mode.
Clement Courbet [Thu, 4 Oct 2018 07:07:16 +0000 (07:07 +0000)]
[llvm-exegesis][NFC] Test sched class names only in !NDEBUG mode.

Sched classes have no names in NDEBUG.

llvm-svn: 343755

6 years ago[X86] Merge matchANDXORWithAllOnesAsANDNP into combineANDXORWithAllOnesIntoANDNP...
Craig Topper [Thu, 4 Oct 2018 06:13:27 +0000 (06:13 +0000)]
[X86] Merge matchANDXORWithAllOnesAsANDNP into combineANDXORWithAllOnesIntoANDNP. NFCI

It's the only caller and the logic pretty easy to combine.

llvm-svn: 343754

6 years ago[CMake] Use just basename when copying C++ ABI headers
Petr Hosek [Thu, 4 Oct 2018 05:38:53 +0000 (05:38 +0000)]
[CMake] Use just basename when copying C++ ABI headers

This avoids duplicate directories when the filename includes path.

Fixes PR39145

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

llvm-svn: 343753

6 years ago[RISCV][NFC] Fix naming of RISCVISelLowering::{LowerRETURNADDR,LowerFRAMEADDR}
Alex Bradbury [Thu, 4 Oct 2018 05:27:50 +0000 (05:27 +0000)]
[RISCV][NFC] Fix naming of RISCVISelLowering::{LowerRETURNADDR,LowerFRAMEADDR}

Rename to lowerRETURNADDR, lowerFRAMEADDR in order to be consistent with the
LLVM coding style and the other functions in this file.

llvm-svn: 343752

6 years ago[llvm-exegesis] Unbreak analysis-uops-variant.test introduced in D52825
Fangrui Song [Thu, 4 Oct 2018 03:32:47 +0000 (03:32 +0000)]
[llvm-exegesis] Unbreak analysis-uops-variant.test introduced in D52825

A `defined(NDEBUG) && !defined(LLVM_ENABLE_DUMP)` build does not call
writeEscaped and there will be no `SBWriteZeroLatency` in the output.

llvm-svn: 343751

6 years ago[LegalizeIntegerTypes] Fix typo in comment. NFC
Craig Topper [Thu, 4 Oct 2018 02:40:35 +0000 (02:40 +0000)]
[LegalizeIntegerTypes] Fix typo in comment. NFC

llvm-svn: 343750

6 years agoUse std::make_pair rather than brace initialization.
Matt Morehouse [Thu, 4 Oct 2018 00:35:24 +0000 (00:35 +0000)]
Use std::make_pair rather than brace initialization.

r343732 broke the Windows bot.  Seems like the compiler on that bot
doesn't like brace initialization.

llvm-svn: 343749

6 years ago[ELF] Fix typo. NFC
Shoaib Meenai [Thu, 4 Oct 2018 00:07:59 +0000 (00:07 +0000)]
[ELF] Fix typo. NFC

llvm-svn: 343748

6 years ago[analyzer] [quickfix] Temporarily disabling a failing test.
George Karpenkov [Thu, 4 Oct 2018 00:07:45 +0000 (00:07 +0000)]
[analyzer] [quickfix] Temporarily disabling a failing test.

llvm-svn: 343747

6 years ago[WebAssembly] Add WebAssembly to LLVM_ALL_TARGETS
Derek Schuff [Wed, 3 Oct 2018 23:56:52 +0000 (23:56 +0000)]
[WebAssembly] Add WebAssembly to LLVM_ALL_TARGETS

Summary:
After fixing memory leaks in rL343362 and rL343733 the sanitizer builds are
clean and we should be good to build by default again.

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

llvm-svn: 343746

6 years ago[ELF] Fix crash on invalid undefined local symbols
Shoaib Meenai [Wed, 3 Oct 2018 23:53:11 +0000 (23:53 +0000)]
[ELF] Fix crash on invalid undefined local symbols

r320770 made LLD handle invalid DSOs where local symbols were found in
the global part of the symbol table. Unfortunately, it didn't handle the
case where those local symbols were also undefined, and r326242 exposed
an assertion failure in that case. Just warn on that case instead of
crashing, by moving the local binding check before the undefined symbol
addition.

The input file for the test is crafted by hand, since I don't know of
any tool that would produce such a broken DSO. I also don't understand
what it even means for a symbol to be undefined but have STB_LOCAL
binding - I don't think that combination makes any sense - but we have
found broken DSOs of this nature that we were linking against. I've
included detailed instructions on how to produce the DSO in the test.

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

llvm-svn: 343745

6 years ago[llvm-nm] Update clang tests based on changed llvm-nm output
Jordan Rupprecht [Wed, 3 Oct 2018 23:40:04 +0000 (23:40 +0000)]
[llvm-nm] Update clang tests based on changed llvm-nm output

llvm-svn: 343744

6 years ago[llvm-nm] Update lld tests based on changed llvm-nm output
Jordan Rupprecht [Wed, 3 Oct 2018 23:39:59 +0000 (23:39 +0000)]
[llvm-nm] Update lld tests based on changed llvm-nm output

llvm-svn: 343743

6 years ago[llvm-nm] Print an explicit "no symbols" message when an object file has no symbols
Jordan Rupprecht [Wed, 3 Oct 2018 23:39:49 +0000 (23:39 +0000)]
[llvm-nm] Print an explicit "no symbols" message when an object file has no symbols

Summary:
GNU nm (and other nm implementations, such as "go tool nm") prints an explicit "no symbols" message when an object file has no symbols. Currently llvm-nm just doesn't print anything. Adding an explicit "no symbols" message will allow llvm-nm to be used in place of nm: some scripts and build processes use `nm <file> | grep "no symbols"` as a test to see if a file has no symbols. It will also be more familiar to anyone used to nm.

That said, the format implemented here is slightly different, in that it doesn't print the tool name in the message (which IMHO is not useful to include).

Demo:
```
$ for nm in nm bin/llvm-nm ; do echo "nm implementation: $nm"; $nm /tmp/foo{1,2}.o; echo; done
nm implementation: nm

/tmp/foo1.o:
nm: /tmp/foo1.o: no symbols

/tmp/foo2.o:
0000000000000000 T foo2

nm implementation: bin/llvm-nm

/tmp/foo1.o:
no symbols

/tmp/foo2.o:
0000000000000000 T foo2
```

Reviewers: MaskRay

Reviewed By: MaskRay

Subscribers: llvm-commits

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

llvm-svn: 343742

6 years ago[RISCV] Handle redundant SplitF64+BuildPairF64 pairs in a DAGCombine
Alex Bradbury [Wed, 3 Oct 2018 23:30:16 +0000 (23:30 +0000)]
[RISCV] Handle redundant SplitF64+BuildPairF64 pairs in a DAGCombine

r343712 performed this optimisation during instruction selection. As Eli
Friedman pointed out in post-commit review, implementing this as a DAGCombine
might allow opportunities for further optimisations.

llvm-svn: 343741

6 years ago[SEMA] split ExtWarn dupl-decl-spec's into Extension and ExtWarn
Nick Desaulniers [Wed, 3 Oct 2018 23:09:29 +0000 (23:09 +0000)]
[SEMA] split ExtWarn dupl-decl-spec's into Extension and ExtWarn

Summary:
For types deduced from typedef's and typeof's, don't warn for duplicate
declaration specifiers in C90 unless -pedantic.

Create a third diagnostic type for duplicate declaration specifiers.
Previously, we had an ExtWarn and a Warning. This change adds a third,
Extension, which only warns when -pedantic is set, staying silent
otherwise.

Fixes PR32985.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: srhines, cfe-commits

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

llvm-svn: 343740

6 years ago[WebAssembly] Bitselect intrinsic and instruction
Thomas Lively [Wed, 3 Oct 2018 23:02:23 +0000 (23:02 +0000)]
[WebAssembly] Bitselect intrinsic and instruction

Summary: Depends on D52755.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 343739

6 years agoRevert "[ASTMatchers] Fix DynamicASTMatchersTests again"
Fangrui Song [Wed, 3 Oct 2018 22:56:26 +0000 (22:56 +0000)]
Revert "[ASTMatchers] Fix DynamicASTMatchersTests again"

This reverts commit 8a6631a983ec9c1d22cc77c5f55a524a651740f0.

The last fix seems good in Debug mode.

llvm-svn: 343738

6 years ago[RISCV][NFC] Refactor LocVT<->ValVT converstion in RISCVISelLowering
Alex Bradbury [Wed, 3 Oct 2018 22:53:25 +0000 (22:53 +0000)]
[RISCV][NFC] Refactor LocVT<->ValVT converstion in RISCVISelLowering

There was some duplicated logic for using the LocInfo of a CCValAssign in
order to convert from the ValVT to LocVT or vice versa. Resolve this by
factoring out convertLocVTFromValVT from unpackFromRegLoc. Also rename
packIntoRegLoc to the more appropriate convertValVTToLocVT and call these
helper functions consistently.

llvm-svn: 343737

6 years ago[analyzer] [tests] [quickfix] Make more test more resilient for non-defaut -std.
Artem Dergachev [Wed, 3 Oct 2018 22:48:00 +0000 (22:48 +0000)]
[analyzer] [tests] [quickfix] Make more test more resilient for non-defaut -std.

It is important to specify the version of the standard because tests should
test the same thing regardless of the current default version of the standard.

llvm-svn: 343736

6 years ago[analyzer] Do not crash if the assumption added in TrustNonNullChecker is enough...
George Karpenkov [Wed, 3 Oct 2018 22:31:09 +0000 (22:31 +0000)]
[analyzer] Do not crash if the assumption added in TrustNonNullChecker is enough to make the state unfeasible

rdar://43541814

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

llvm-svn: 343735

6 years ago[WebAssembly] Refactor use of signatures
Derek Schuff [Wed, 3 Oct 2018 22:25:32 +0000 (22:25 +0000)]
[WebAssembly] Refactor use of signatures

Update use of WebAssemblySignature to go along with D52580

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

llvm-svn: 343734

6 years ago[WebAssembly] Refactor WasmSignature and use it for MCSymbolWasm
Derek Schuff [Wed, 3 Oct 2018 22:22:48 +0000 (22:22 +0000)]
[WebAssembly] Refactor WasmSignature and use it for MCSymbolWasm

MCContext does not destroy MCSymbols on shutdown. So, rather than putting
SmallVectors (which may heap-allocate) inside MCSymbolWasm, use unowned pointer
to a WasmSignature instead. The signatures are now owned by the AsmPrinter.
Also uses WasmSignature instead of param and result vectors in TargetStreamer,
and leaves some TODOs for further simplification.

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

llvm-svn: 343733

6 years agoMinor refacotring of Relocations.cpp. NFC.
Rui Ueyama [Wed, 3 Oct 2018 22:20:26 +0000 (22:20 +0000)]
Minor refacotring of Relocations.cpp. NFC.

This patch splits ThunkCreator::mergeThunks into two smaller functions.
Also adds blank lines to various places so that the code doesn't look
too dense.

llvm-svn: 343732

6 years ago[machineverifier] Detect PHI's that are preceeded by non-PHI's
Daniel Sanders [Wed, 3 Oct 2018 22:05:31 +0000 (22:05 +0000)]
[machineverifier] Detect PHI's that are preceeded by non-PHI's

If present, PHI nodes must appear before non-PHI nodes in a basic block. The
register allocator relies on this and will fail to eliminate PHI's that do not
meet this requirement.

llvm-svn: 343731

6 years ago[mips] Remove -allow-deprecated-dag-overlap flag from tests. NFC
Simon Atanasyan [Wed, 3 Oct 2018 22:02:23 +0000 (22:02 +0000)]
[mips] Remove -allow-deprecated-dag-overlap flag from tests. NFC

Fix DAG check statements in MIPS codegen tests to remove
-allow-deprecated-dag-overlap flag.

llvm-svn: 343730

6 years ago[PPC64] Test documenting toc-restore after interposable recursive call. [NFC]
Sean Fertile [Wed, 3 Oct 2018 21:58:44 +0000 (21:58 +0000)]
[PPC64] Test documenting toc-restore after interposable recursive call. [NFC]

A test verifying that toc restores are properly inserted following recursive
calls, as well as briefly describing why they are needed.

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

llvm-svn: 343729

6 years ago[PPC64] Add test documenting toc-restore when linking with -Bsymbolic. [NFC]
Sean Fertile [Wed, 3 Oct 2018 21:58:42 +0000 (21:58 +0000)]
[PPC64] Add test documenting toc-restore when linking with -Bsymbolic. [NFC]

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

llvm-svn: 343728

6 years ago[InstCombine] allow SimplifyDemandedVectorElts to work with FP binops
Sanjay Patel [Wed, 3 Oct 2018 21:44:59 +0000 (21:44 +0000)]
[InstCombine] allow SimplifyDemandedVectorElts to work with FP binops

We're a long way from D50992 and D51553, but this is where we have to start.
We weren't back-propagating undefs into binop constant values for anything but
add/sub/mul/and/or/xor.

This is likely because we have to be careful about not introducing UB/poison
with div/rem/shift. But I suspect we already are getting the poison part wrong
for add/sub/mul (although it may not be possible to expose the bug currently
because we use SimplifyDemandedVectorElts from a limited set of opcodes).
See the discussion/implementation from D48987 and D49047.

This patch just enables functionality for FP ops because those do not have
UB/poison potential.

llvm-svn: 343727

6 years agoFix buildbot regression by rL339929: NameError: global name 'test_directory' is not...
Jan Kratochvil [Wed, 3 Oct 2018 21:42:54 +0000 (21:42 +0000)]
Fix buildbot regression by rL339929: NameError: global name 'test_directory' is not defined

With buildbot slave under test - I get after rL339929:
http://lab.llvm.org:8014/builders/lldb-x86_64-fedora-28-cmake/builds/243/steps/test1/logs/stdio

  File "/home/buildbot/lldbroot/lldb-x86_64-fedora-28-cmake/scripts/../llvm/tools/lldb/test/dotest.py", line 7, in <module>
    lldbsuite.test.run_suite()
  File "/quad/home/buildbot/lldbroot/lldb-x86_64-fedora-28-cmake/llvm/tools/lldb/packages/Python/lldbsuite/test/dotest.py", line 1177, in run_suite
    configuration.results_formatter_object)
  File "/quad/home/buildbot/lldbroot/lldb-x86_64-fedora-28-cmake/llvm/tools/lldb/packages/Python/lldbsuite/test/dosep.py", line 1692, in main
    dst = core.replace(test_directory, "")[1:]
NameError: global name 'test_directory' is not defined

Patch by Vedant Kumar.

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

llvm-svn: 343726

6 years ago[libc++][NFC] Add error messages to a couple of static_asserts in span
Louis Dionne [Wed, 3 Oct 2018 21:36:16 +0000 (21:36 +0000)]
[libc++][NFC] Add error messages to a couple of static_asserts in span

Summary:
Add error messages to a couple of static_asserts in span to match the
style used in the rest of the file. Also fix an extra paren typo in a
assert error message.

Committed on behalf of Jason Lovett.

Reviewers: ldionne

Subscribers: libcxx-commits

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

llvm-svn: 343725

6 years agoMake meanings of variables clearer in action table generation (NFC)
Heejin Ahn [Wed, 3 Oct 2018 21:30:15 +0000 (21:30 +0000)]
Make meanings of variables clearer in action table generation (NFC)

Summary:

Reviewers: kristina, zhmu, dschuff, rnk

Subscribers: llvm-commits

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

llvm-svn: 343724

6 years ago[X86] Stop promoting vector ISD::SELECT to vXi64.
Craig Topper [Wed, 3 Oct 2018 21:10:29 +0000 (21:10 +0000)]
[X86] Stop promoting vector ISD::SELECT to vXi64.

The additional patterns needed for this aren't overwhelming and introducing extra bitcasts during lowering limits our ability to do computeNumSignBits. Not that I have a good example of that for select. I'm just becoming increasingly grumpy about promotion of AND/OR/XOR. SELECT was just a lot easier to fix.

llvm-svn: 343723

6 years ago[ASTMatchers] Fix DynamicASTMatchersTests again
Fangrui Song [Wed, 3 Oct 2018 21:00:44 +0000 (21:00 +0000)]
[ASTMatchers] Fix DynamicASTMatchersTests again

llvm-svn: 343722

6 years ago[test] Fix -Wunused-variable in rC343665
Fangrui Song [Wed, 3 Oct 2018 20:53:53 +0000 (20:53 +0000)]
[test] Fix -Wunused-variable in rC343665

llvm-svn: 343721

6 years agoRemove stray character from docs
Stephen Kelly [Wed, 3 Oct 2018 20:53:02 +0000 (20:53 +0000)]
Remove stray character from docs

llvm-svn: 343720

6 years agoUpdate documentation for correctness
Stephen Kelly [Wed, 3 Oct 2018 20:52:57 +0000 (20:52 +0000)]
Update documentation for correctness

llvm-svn: 343719

6 years agoAdding skipIf to std::variant libc++ data-formatter test since get is not available...
Shafik Yaghmour [Wed, 3 Oct 2018 20:52:56 +0000 (20:52 +0000)]
Adding skipIf to std::variant libc++ data-formatter test since get is not available before macOS 10.14

Patch by Shafik Yaghmour

llvm-svn: 343718

6 years agoAdd matchers missing from dynamic AST registry
Stephen Kelly [Wed, 3 Oct 2018 20:52:51 +0000 (20:52 +0000)]
Add matchers missing from dynamic AST registry

llvm-svn: 343717

6 years agoSort list of matchers
Stephen Kelly [Wed, 3 Oct 2018 20:52:45 +0000 (20:52 +0000)]
Sort list of matchers

llvm-svn: 343716

6 years ago[analyzer] [tests] [quickfix] Make the test more resilient for a non-defaut std confi...
George Karpenkov [Wed, 3 Oct 2018 20:46:50 +0000 (20:46 +0000)]
[analyzer] [tests] [quickfix] Make the test more resilient for a non-defaut std configuration

llvm-svn: 343715

6 years ago[InstCombine] add tests for binop undef-into-constant propagation; NFC
Sanjay Patel [Wed, 3 Oct 2018 20:35:25 +0000 (20:35 +0000)]
[InstCombine] add tests for binop undef-into-constant propagation; NFC

llvm-svn: 343714

6 years ago[X86] Add CMOV_VK2/VK4 pseudos and remove lowering code that turned v2i1/v4i1 SELECT...
Craig Topper [Wed, 3 Oct 2018 20:28:43 +0000 (20:28 +0000)]
[X86] Add CMOV_VK2/VK4 pseudos and remove lowering code that turned v2i1/v4i1 SELECT into v8i1.

llvm-svn: 343713

6 years ago[RISCV][NFCI] Handle redundant splitf64+buildpairf64 pairs during instruction selection
Alex Bradbury [Wed, 3 Oct 2018 20:12:10 +0000 (20:12 +0000)]
[RISCV][NFCI] Handle redundant splitf64+buildpairf64 pairs during instruction selection

Although we can't write a tablegen pattern to remove redundant
splitf64+buildf64 pairs due to the multiple return values, we can handle it
with some C++ selection code. This is simpler than removing them after
instruction selection through RISCVDAGToDAGISel::PostprocessISelDAG, as was
done previously.

llvm-svn: 343712