platform/upstream/llvm.git
6 years ago[PowerPC] Replace the Post RA List Scheduler with the Machine Scheduler
Stefan Pintilie [Wed, 4 Jul 2018 18:54:25 +0000 (18:54 +0000)]
[PowerPC] Replace the Post RA List Scheduler with the Machine Scheduler

  We want to run the Machine Scheduler instead of the List Scheduler after RA.
  Checked with a performance run on a Power 9 machine with SPEC 2006 and while
  some benchmarks improved and others degraded the geomean was slightly improved
  with the Machine Scheduler.

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

llvm-svn: 336295

6 years ago[Dominators] Add DomTreeUpdater constructor from DT* and PDT*
Jakub Kuderski [Wed, 4 Jul 2018 18:37:15 +0000 (18:37 +0000)]
[Dominators] Add DomTreeUpdater constructor from DT* and PDT*

Summary:
Previously, if a function accepts an optional DT pointer,
```
void Foo (.., DominatorTree * DT = nullptr) {
  ...
  if(DT)
    DomTreeUpdater(*DT, ...).insertEdge(A, B);
  if(DT){
    DomTreeUpdater DTU(*DT, ...);
    ... // Construct the update vector and applyUpdates
  }
  ...
  if(DT){
    DomTreeUpdater DTU(*DT, ...);
    ... // Construct the update vector and applyUpdates
  }
}
```
After this patch, it can be simplified as
```
void Foo (.., DominatorTree * DT = nullptr) {
  DomTreeUpdater DTU(DT, ...);
  ...
  DTU.insertEdge(A, B);
  if(DT){
    ... // Construct the update vector and applyUpdates
  }
  ...
  if(DT){
    ... // Construct the update vector and applyUpdates
  }
}
```
Patch by Chijun Sima <simachijun@gmail.com>.

Reviewers: kuhar, brzycki, dmgreen

Reviewed By: kuhar

Author: NutshellySima

Subscribers: llvm-commits

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

llvm-svn: 336294

6 years ago[InstCombine] allow narrowing of min/max/abs
Sanjay Patel [Wed, 4 Jul 2018 17:44:04 +0000 (17:44 +0000)]
[InstCombine] allow narrowing of min/max/abs

We have bailout hacks based on min/max in various places in instcombine
that shouldn't be necessary. The affected test was added for:
D48930
...which is a consequence of the improvement in:
D48584 (https://reviews.llvm.org/rL336172)

I'm assuming the visitTrunc bailout in this patch was added specifically
to avoid a change from SimplifyDemandedBits, so I'm just moving that
below the EvaluateInDifferentType optimization. A narrow min/max is still
a min/max.

llvm-svn: 336293

6 years ago[X86][BtVer2][MCA][NFC] Add CMPEQ dependency-breaking one-idioms tests
Roman Lebedev [Wed, 4 Jul 2018 17:32:44 +0000 (17:32 +0000)]
[X86][BtVer2][MCA][NFC] Add CMPEQ dependency-breaking one-idioms tests

Summary: As per `Agner's Microarchitecture doc
(21.8 AMD Bobcat and Jaguar pipeline - Dependency-breaking instructions)`,
these, like zero-idioms, are dependency-breaking,
although they produce ones and still consume resources.

FIXME: as discussed in D48877, llvm-mca handling is broken for these.

Reviewers: andreadb

Reviewed By: andreadb

Subscribers: gbedwell, RKSimon, llvm-commits

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

llvm-svn: 336292

6 years agoFix some irregular whitespace/indentation. NFCI.
Simon Pilgrim [Wed, 4 Jul 2018 17:24:05 +0000 (17:24 +0000)]
Fix some irregular whitespace/indentation. NFCI.

llvm-svn: 336291

6 years ago[lit] Don't require semicolon separator
Jonas Devlieghere [Wed, 4 Jul 2018 17:14:52 +0000 (17:14 +0000)]
[lit] Don't require semicolon separator

This patch removes the requirement for a semicolon as a separator when
passing arguments to lit. It relies on the shlex module that is part of
Python to do simple lexical analysis, similar to what happens in a Unix
shell.

llvm-svn: 336290

6 years ago[InstCombine] add value names to test; NFC
Sanjay Patel [Wed, 4 Jul 2018 16:56:35 +0000 (16:56 +0000)]
[InstCombine] add value names to test; NFC

That makes it easier to mix and match lines into other tests.

llvm-svn: 336289

6 years ago[PPCGCodeGen] Change printf to outs() to prevent garbled output. [NFC]
Siddharth Bhat [Wed, 4 Jul 2018 16:51:27 +0000 (16:51 +0000)]
[PPCGCodeGen] Change printf to outs() to prevent garbled output. [NFC]

Summary:
It appears that llvm uses unbuffered C++ streams. So, we should not
mix C and C++ stream operations, because that will give us mixed
up output.

Reviewers: efriedma, jdoerfert, Meinersbur, gareevroman, sebpop, zinob, huihuiz, pollydev, grosser, singam-sanjay, philip.pfaffe

Reviewed By: philip.pfaffe

Subscribers: nemanjai, kbarton

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

llvm-svn: 336288

6 years agoFix and simplify lldb.command decorator
Dave Lee [Wed, 4 Jul 2018 16:11:43 +0000 (16:11 +0000)]
Fix and simplify lldb.command decorator

Summary:
This change fixes one issue with `lldb.command`, and also reduces the implementation.

The fix: a command function's docstring was not shown when running `help <command_name>`. This is because the docstring attached the source function is not propagated to the decorated function (`f.__call__`). By returning the original function, the docstring will be properly displayed by `help`.

Also with this change, the command name is assumed to be the function's name, but can still be explicitly defined as previously.

Additionally, the implementation was updated to:

* Remove inner class
* Remove use of `inspect` module
* Remove `*args` and `**kwargs`

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: keith, xiaobai, lldb-commits

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

llvm-svn: 336287

6 years ago[ARM] [Assembler] Support negative immediates: cover few missing cases
Volodymyr Turanskyy [Wed, 4 Jul 2018 16:11:15 +0000 (16:11 +0000)]
[ARM] [Assembler] Support negative immediates: cover few missing cases

Support for negative immediates was implemented in
https://reviews.llvm.org/rL298380, however few instruction options were missing.

This change adds negative immediates support and respective tests
for the following:

ADD
ADDS
ADDS.W
AND.W
ANDS
BIC.W
BICS
BICS.W
SUB
SUBS
SUBS.W

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

llvm-svn: 336286

6 years ago[MachineOutliner] Fix typo in getOutliningCandidateInfo function name
Yvan Roux [Wed, 4 Jul 2018 15:37:08 +0000 (15:37 +0000)]
[MachineOutliner] Fix typo in getOutliningCandidateInfo function name

getOutlininingCandidateInfo -> getOutliningCandidateInfo

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

llvm-svn: 336285

6 years ago[llvm-objdump] Add --file-headers (-f) option
Paul Semel [Wed, 4 Jul 2018 15:25:03 +0000 (15:25 +0000)]
[llvm-objdump] Add --file-headers (-f) option

llvm-svn: 336284

6 years ago[clang-tidy] Fix http://llvm.org/PR38055
Alexander Kornienko [Wed, 4 Jul 2018 15:19:49 +0000 (15:19 +0000)]
[clang-tidy] Fix http://llvm.org/PR38055

llvm-svn: 336283

6 years ago[ELF] - Simplify. NFC.
George Rimar [Wed, 4 Jul 2018 15:05:21 +0000 (15:05 +0000)]
[ELF] - Simplify. NFC.

Currently, there are only OutputSection and SymbolAssignment
commands possible at the first level under SECTIONS tag.

So, shouldSkip() contained dead "return true".

Patch simplifies the code.

llvm-svn: 336282

6 years agoScopInfo: simplify equivalence classes before storing them [NFCI]
Tobias Grosser [Wed, 4 Jul 2018 14:53:36 +0000 (14:53 +0000)]
ScopInfo: simplify equivalence classes before storing them [NFCI]

This change has no impact on upstream Polly directly, but reduces output
noise for some internal isl versions we are testing. In general, storing
simpler and more canonical output is a good idea. Hence, it seems useful
to upstream this change.

llvm-svn: 336281

6 years ago[ELF] - Extend edata-etext.s test case.
George Rimar [Wed, 4 Jul 2018 14:47:19 +0000 (14:47 +0000)]
[ELF] - Extend edata-etext.s test case.

We did not have a test that would test that
_etext address is equal to etext, _end == end and _edata == edata.

Because of that, the following line was never
executed when running our tests:
https://github.com/llvm-mirror/lld/blob/master/ELF/Writer.cpp#L928

Patch fixes that.

llvm-svn: 336280

6 years ago[CMake] Remove redundant path component
Jonas Devlieghere [Wed, 4 Jul 2018 14:38:21 +0000 (14:38 +0000)]
[CMake] Remove redundant path component

Fixes spurious path component introduced in r336278. The variable is
cached so might require you to re-run CMake.

llvm-svn: 336279

6 years ago[CMake] Use LLVM_RUNTIME_OUTPUT_INTDIR for LLDB exectuable
Jonas Devlieghere [Wed, 4 Jul 2018 14:34:32 +0000 (14:34 +0000)]
[CMake] Use LLVM_RUNTIME_OUTPUT_INTDIR for LLDB exectuable

Apparently there's a difference between using LLVM_RUNTIME_OUTPUT_INTDIR
and LLVM_BINARY_DIR. The former will point to the current binary
directory (i.e. that where lldb is built) while the former will always
point to LLVM's. This was causing trouble for the swift build but should
be a transparent for upstream lldb.

llvm-svn: 336278

6 years ago[X86][SSE] Add v16i16 shl x,c -> pmullw test
Simon Pilgrim [Wed, 4 Jul 2018 14:20:58 +0000 (14:20 +0000)]
[X86][SSE] Add v16i16 shl x,c -> pmullw test

llvm-svn: 336277

6 years ago[ThinLTO] Update ThinLTO cache file atimes when on Windows
Andrew Ng [Wed, 4 Jul 2018 14:17:10 +0000 (14:17 +0000)]
[ThinLTO] Update ThinLTO cache file atimes when on Windows

ThinLTO cache file access times are used for expiration based pruning
and since Vista, file access times are not updated by Windows by
default:

https://blogs.technet.microsoft.com/filecab/2006/11/07/disabling-last-access-time-in-windows-vista-to-improve-ntfs-performance

This means on Windows, cache files are currently being pruned from
creation time. This change manually updates cache files that are
accessed by ThinLTO, when on Windows.

Patch by Owen Reynolds.

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

llvm-svn: 336276

6 years ago[analyzer][ctu] fix unsortable diagnostics
Rafael Stahl [Wed, 4 Jul 2018 14:12:58 +0000 (14:12 +0000)]
[analyzer][ctu] fix unsortable diagnostics

Summary: In the provided test case the PathDiagnostic compare function was not able to find a difference.

Reviewers: xazax.hun, NoQ, dcoughlin, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: a_sidorin, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits

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

llvm-svn: 336275

6 years ago[AArch64][SVE] Asm: Support for reversed subtract (SUBR) instruction.
Sander de Smalen [Wed, 4 Jul 2018 14:05:33 +0000 (14:05 +0000)]
[AArch64][SVE] Asm: Support for reversed subtract (SUBR) instruction.

This patch adds both a vector and an immediate form, e.g.

- Vector form:

    subr z0.h, p0/m, z0.h, z1.h

  subtract active elements of z0 from z1, and store the result in z0.

- Immediate form:

    subr z0.h, z0.h, #255

  subtract elements of z0, and store the result in z0.

llvm-svn: 336274

6 years ago[ELF] - Cover handling of DW_AT_external with test.
George Rimar [Wed, 4 Jul 2018 14:04:59 +0000 (14:04 +0000)]
[ELF] - Cover handling of DW_AT_external with test.

The following check was uncovered with tests:
https://github.com/llvm-mirror/lld/blob/master/ELF/InputFiles.cpp#L159

Patch adds test to cover it.

llvm-svn: 336273

6 years ago[CMake] Move some variables around
Jonas Devlieghere [Wed, 4 Jul 2018 13:59:25 +0000 (13:59 +0000)]
[CMake] Move some variables around

This improves consistency by creating a CMake variable for the dsymutil
path. The motivation is that for Swift, the dsymutil binary and the lldb
binary live in different directories and we need an option to configure
this from the build script.

llvm-svn: 336272

6 years ago[X86][SSE] Add SSE2 target to some shift tests
Simon Pilgrim [Wed, 4 Jul 2018 13:58:13 +0000 (13:58 +0000)]
[X86][SSE] Add SSE2 target to some shift tests

Show the difference in behaviour cf SSE41 (no PMULLD, PBLENDW etc.)

Raised by D48936

llvm-svn: 336271

6 years ago[ELF] - LTO: add test for createEmptyIndex.
George Rimar [Wed, 4 Jul 2018 13:36:45 +0000 (13:36 +0000)]
[ELF] - LTO: add test for createEmptyIndex.

We have a following comment for createEmptyIndex caller code:

// If LazyObjFile has not been added to link, emit empty index files.
// This is needed because this is what GNU gold plugin does and we have a
// distributed build system that depends on that behavior.

Though createEmptyIndex() itself
(https://github.com/llvm-mirror/lld/blob/master/ELF/LTO.cpp#L202)
is never called in our test cases.

Patch adds a test.

llvm-svn: 336270

6 years ago[ASTImporter] import macro source locations
Rafael Stahl [Wed, 4 Jul 2018 13:34:05 +0000 (13:34 +0000)]
[ASTImporter] import macro source locations

Summary: Implement full import of macro expansion info with spelling and expansion locations.

Reviewers: a.sidorin, klimek, martong, balazske, xazax.hun

Reviewed By: martong

Subscribers: thakis, xazax.hun, balazske, rnkovacs, cfe-commits

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

llvm-svn: 336269

6 years agoNFC - Various typo fixes in tests
Gabor Buella [Wed, 4 Jul 2018 13:28:39 +0000 (13:28 +0000)]
NFC - Various typo fixes in tests

llvm-svn: 336268

6 years ago[AArch64][SVE] Asm: Support for instructions to set/read FFR.
Sander de Smalen [Wed, 4 Jul 2018 12:58:46 +0000 (12:58 +0000)]
[AArch64][SVE] Asm: Support for instructions to set/read FFR.

Includes instructions to read the First-Faulting Register (FFR):
- RDFFR (unpredicated)
    rdffr   p0.b
- RDFFR (predicated)
    rdffr   p0.b, p0/z
- RDFFRS (predicated, sets condition flags)
    rdffr   p0.b, p0/z

Includes instructions to set/write the FFR:
- SETFFR (no arguments, sets the FFR to all true)
    setffr
- WRFFR  (unpredicated)
    wrffr   p0.b

llvm-svn: 336267

6 years ago[llvm-exegesis] Remove dead comment.
Clement Courbet [Wed, 4 Jul 2018 12:31:00 +0000 (12:31 +0000)]
[llvm-exegesis] Remove dead comment.

llvm-svn: 336266

6 years ago[AArch64][SVE] Asm: Support for FP conversion instructions.
Sander de Smalen [Wed, 4 Jul 2018 12:13:17 +0000 (12:13 +0000)]
[AArch64][SVE] Asm: Support for FP conversion instructions.

The variants added are:

- fcvt   (FP convert precision)
- scvtf  (signed int -> FP)
- ucvtf  (unsigned int -> FP)
- fcvtzs (FP -> signed int (round to zero))
- fcvtzu (FP -> unsigned int (round to zero))

For example:
  fcvt   z0.h, p0/m, z0.s  (single- to half-precision FP)
  scvtf  z0.h, p0/m, z0.s  (32-bit int to half-precision FP)
  ucvtf  z0.h, p0/m, z0.s  (32-bit unsigned int to half-precision FP)
  fcvtzs z0.s, p0/m, z0.h  (half-precision FP to 32-bit int)
  fcvtzu z0.s, p0/m, z0.h  (half-precision FP to 32-bit unsigned int)

llvm-svn: 336265

6 years agoNFC - Fix type in builtins-ppc-p9vector.c test
Gabor Buella [Wed, 4 Jul 2018 11:29:21 +0000 (11:29 +0000)]
NFC - Fix type in builtins-ppc-p9vector.c test

llvm-svn: 336264

6 years agoNFC - Fix typo in test/CodeGenObjC/gnustep2-class.m
Gabor Buella [Wed, 4 Jul 2018 11:26:09 +0000 (11:26 +0000)]
NFC - Fix typo in test/CodeGenObjC/gnustep2-class.m

llvm-svn: 336263

6 years agoNFC - Fix typo in test/Layout/itanium-pack-and-align.cpp
Gabor Buella [Wed, 4 Jul 2018 11:21:44 +0000 (11:21 +0000)]
NFC - Fix typo in test/Layout/itanium-pack-and-align.cpp

llvm-svn: 336262

6 years agoAdd missing include for size_t
Eric Fiselier [Wed, 4 Jul 2018 11:14:18 +0000 (11:14 +0000)]
Add missing include for size_t

llvm-svn: 336261

6 years ago[clangd] only ignore collected symbols if TU has uncompilable errors.
Eric Liu [Wed, 4 Jul 2018 10:39:48 +0000 (10:39 +0000)]
[clangd] only ignore collected symbols if TU has uncompilable errors.

llvm-svn: 336260

6 years ago[ELF] - Add a test case for relocation pointing to deduplicated COMDAT.
George Rimar [Wed, 4 Jul 2018 10:38:12 +0000 (10:38 +0000)]
[ELF] - Add a test case for relocation pointing to deduplicated COMDAT.

ELF spec doesn't allow a relocation to point to a deduplicated
COMDAT section. Unfortunately this happens in practice (e.g. .eh_frame)

We have a code in MarkLive.cpp for that and it was uncovered by any test case:
https://github.com/llvm-mirror/lld/blob/master/ELF/MarkLive.cpp#L199

Patch adds a test.

llvm-svn: 336259

6 years ago[NFC] Add test that shows that InstCombine can do better
Max Kazantsev [Wed, 4 Jul 2018 10:32:02 +0000 (10:32 +0000)]
[NFC] Add test that shows that InstCombine can do better

llvm-svn: 336258

6 years ago[clang-tools-extra] Cleanup documentation routine
Kirill Bobyrev [Wed, 4 Jul 2018 10:18:03 +0000 (10:18 +0000)]
[clang-tools-extra] Cleanup documentation routine

The following issues are resolved:

* Doxygen didn't generate documentation for a bunch of existing tools
due to the absence of their directories in the doxygen configuration
file. This patch adds all relevant directories to the appropriate list.

* clang-tools-extra/docs/Doxyfile seems to be unused and irrelevant,
doxygen.cfg.in is passed to the CMake's Doxygen invocation, hence
Doxyfile is removed.

The validity of proposed changes was manually checked by building
doxygen-clang-tools and making sure that clangd and other tools are
present in Doxygen-generated docs of clang-tools-extra.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 336257

6 years ago[DebugInfo][LoopVectorize] Preserve DL in generated phi instruction
Anastasis Grammenos [Wed, 4 Jul 2018 10:16:55 +0000 (10:16 +0000)]
[DebugInfo][LoopVectorize] Preserve DL in generated phi instruction

When creating `phi` instructions to resume at the scalar part of the loop,
copy the DebugLoc from the original phi over to the new one.

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

llvm-svn: 336256

6 years ago[SemaCodeComplete] Make sure visited contexts are passed to completion results handler.
Eric Liu [Wed, 4 Jul 2018 10:01:18 +0000 (10:01 +0000)]
[SemaCodeComplete] Make sure visited contexts are passed to completion results handler.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 336255

6 years ago[DebugInfo][InstCombine] Preserve DI after combining zext
Anastasis Grammenos [Wed, 4 Jul 2018 09:55:46 +0000 (09:55 +0000)]
[DebugInfo][InstCombine] Preserve DI after combining zext

When zext is EvaluatedInDifferentType, InstCombine
drops the dbg.value intrinsic. This patch tries to
preserve said DI, by inserting the zext's old DI in the
resulting instruction. (Only for integer type for now)

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

llvm-svn: 336254

6 years ago[clangd] Cleanup unittest: URIs. NFC.
Eric Liu [Wed, 4 Jul 2018 09:54:23 +0000 (09:54 +0000)]
[clangd] Cleanup unittest: URIs. NFC.

llvm-svn: 336253

6 years ago[clangd] Avoid collecting symbols from broken TUs in global-symbol-builder.
Eric Liu [Wed, 4 Jul 2018 09:43:35 +0000 (09:43 +0000)]
[clangd] Avoid collecting symbols from broken TUs in global-symbol-builder.

Summary:
For example, template parameter might not be resolved in a broken TU,
which can result in wrong USR/SymbolID.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, cfe-commits

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

llvm-svn: 336252

6 years ago[Polly-ACC] Add isl_space.h to gpu_tree.c
Siddharth Bhat [Wed, 4 Jul 2018 09:40:55 +0000 (09:40 +0000)]
[Polly-ACC] Add isl_space.h to gpu_tree.c

Summary:
This patch adds <isl_space.h> to gpu_tree.c. This prevents a segfault
when allocating a new isl_space in the function create_sync_domain(), as
the compiler now knows that the return type is a pointer instead of
assuming the function returns an int.

This has been updated in upstream PPCG, so we should bump up our PPCG
version.

Initially discovered by Philip Pfaffe in Polly.

Reviewers: grosser, bollu, philip.pfaffe

Reviewed By: bollu

Subscribers: nemanjai, kbarton, llvm-commits

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

Contributed-by: Alain Denzler <alaindenzler@gmail.com>
llvm-svn: 336251

6 years ago[X86][SSE] Blend any v8i16/v4i32 shift with 2 shift unique values (REAPPLIED)
Simon Pilgrim [Wed, 4 Jul 2018 09:12:48 +0000 (09:12 +0000)]
[X86][SSE] Blend any v8i16/v4i32 shift with 2 shift unique values (REAPPLIED)

We were only doing this for basic blends, despite shuffle lowering now being good enough to handle more complex blends. This means that the two v8i16 splat shifts are performed in parallel instead of serially as the general shift case.

Reapplied with a fixed (extra null tests) version of rL336113 after reversion in rL336189 - extra test case added at rL336247.

llvm-svn: 336250

6 years agoTry to fix FileDistance test on windows.
Eric Liu [Wed, 4 Jul 2018 09:08:40 +0000 (09:08 +0000)]
Try to fix FileDistance test on windows.

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11510/steps/ninja%20check%201/logs/FAIL%3A%20Extra%20Tools%20Unit%20Tests%3A%3AFileDistanceTests.URI

llvm-svn: 336249

6 years ago[clangd] FileDistance: temporarily disable in CodeComplete, it's behaving badly
Sam McCall [Wed, 4 Jul 2018 09:01:04 +0000 (09:01 +0000)]
[clangd] FileDistance: temporarily disable in CodeComplete, it's behaving badly

llvm-svn: 336248

6 years ago[X86][SSE] Add reduced crash test case for r336113 - [X86][SSE] Blend any v8i16/v4i32...
Simon Pilgrim [Wed, 4 Jul 2018 08:55:23 +0000 (08:55 +0000)]
[X86][SSE] Add reduced crash test case for r336113 - [X86][SSE] Blend any v8i16/v4i32 shift with 2 shift unique values

The patch was reverted at r336189 due to crashes

llvm-svn: 336247

6 years ago[clangd] FileDistance: missing constexpr
Sam McCall [Wed, 4 Jul 2018 08:52:13 +0000 (08:52 +0000)]
[clangd] FileDistance: missing constexpr

llvm-svn: 336246

6 years ago[AArch64][SVE] Asm: Support for SVE condition code aliases
Sander de Smalen [Wed, 4 Jul 2018 08:50:49 +0000 (08:50 +0000)]
[AArch64][SVE] Asm: Support for SVE condition code aliases

SVE overloads the AArch64 PSTATE condition flags and introduces
a set of condition code aliases for the assembler. The
details are described in section 2.2 of the architecture
reference manual supplement for SVE.

In short:

  SVE alias =>  AArch64 name
  --------------------------
  NONE      => EQ
  ANY       => NE
  NLAST     => HS
  LAST      => LO
  FIRST     => MI
  NFRST     => PL
  PMORE     => HI
  PLAST     => LS
  TCONT     => GE
  TSTOP     => LT

Reviewers: rengolin, fhahn, SjoerdMeijer, samparker, javed.absar

Reviewed By: fhahn

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

llvm-svn: 336245

6 years ago[Sema] Fix crash in getConstructorName.
Ilya Biryukov [Wed, 4 Jul 2018 08:50:12 +0000 (08:50 +0000)]
[Sema] Fix crash in getConstructorName.

Summary:
Can happen when getConstructorName is called on invalid decls,
specifically the ones that do not have the injected class name.

Reviewers: bkramer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 336244

6 years agoNFC - typo fix in test/CodeGen/avx512f-builtins.c
Gabor Buella [Wed, 4 Jul 2018 08:32:02 +0000 (08:32 +0000)]
NFC - typo fix in test/CodeGen/avx512f-builtins.c

llvm-svn: 336243

6 years ago[clangd] FileDistance: don't add duplicate edges
Sam McCall [Wed, 4 Jul 2018 08:27:28 +0000 (08:27 +0000)]
[clangd] FileDistance: don't add duplicate edges

llvm-svn: 336242

6 years ago[ImplicitNullChecks] Check for rewrite of register used in 'test' instruction
Max Kazantsev [Wed, 4 Jul 2018 08:01:26 +0000 (08:01 +0000)]
[ImplicitNullChecks] Check for rewrite of register used in 'test' instruction

The following code pattern:

       mov %rax, %rcx
       test %rax, %rax
       %rax = ....
       je  throw_npe
       mov(%rcx), %r9
       mov(%rax), %r10

gets transformed into the following incorrect code after implicit null check pass:
        mov %rax, %rcx
       %rax = ....
       faulting_load_op("movl (%rax), %r10", throw_npe)
       mov(%rcx), %r9

For implicit null check pass, if the register that is checked for null value (ie, the register used in the 'test' instruction) is written into before the condition jump, we should avoid doing the optimization.

Patch by Surya Kumari Jangala!

Differential Revision: https://reviews.llvm.org/D48627
Reviewed By: skatkov

llvm-svn: 336241

6 years agoPR33924: merge local declarations that have linkage of some kind within
Richard Smith [Wed, 4 Jul 2018 02:25:38 +0000 (02:25 +0000)]
PR33924: merge local declarations that have linkage of some kind within
merged function definitions; also merge functions with deduced return
types.

This seems like two independent fixes, but unfortunately they are hard
to separate because it's challenging to reliably test either one of them
without also testing the other.

A complication arises with deduced return type support: we need the type
of the function in order to know how to merge it, but we can't load the
actual type of the function because it might reference an entity
declared within the function (and we need to have already merged the
function to correctly merge that entity, which we would need to do to
determine if the function types match). So we instead compare the
declared function type when merging functions, and defer loading the
actual type of a function with a deduced type until we've finished
loading and merging the function.

This reverts r336175, reinstating r336021, with one change (for PR38015):
we look at the TypeSourceInfo of the first-so-far declaration of each
function when considering whether to merge two functions. This works
around a problem where the calling convention in the TypeSourceInfo for
subsequent redeclarations may not match if it was implicitly adjusted.

llvm-svn: 336240

6 years ago[Sema] Consider all format_arg attributes.
Michael Kruse [Wed, 4 Jul 2018 01:37:11 +0000 (01:37 +0000)]
[Sema] Consider all format_arg attributes.

If a function has multiple format_arg attributes, clang only considers
the first it finds (because AttributeLists are in reverse order, not
necessarily the textually first) and ignores all others.

Loop over all FormatArgAttr to print warnings for all declared
format_arg attributes.

For instance, libintl's ngettext (select plural or singular version of
format string) has two __format_arg__ attributes.

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

llvm-svn: 336239

6 years ago[libFuzzer] [NFC] Inline static variable to avoid the linker warning.
George Karpenkov [Wed, 4 Jul 2018 00:37:45 +0000 (00:37 +0000)]
[libFuzzer] [NFC] Inline static variable to avoid the linker warning.

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

llvm-svn: 336238

6 years ago[Support] Remove SaveOr which is no longer used
Fangrui Song [Tue, 3 Jul 2018 23:31:19 +0000 (23:31 +0000)]
[Support] Remove SaveOr which is no longer used

llvm-svn: 336237

6 years ago[lanai] Handle atomic load of i8 like regular load.
Jacques Pienaar [Tue, 3 Jul 2018 22:57:51 +0000 (22:57 +0000)]
[lanai] Handle atomic load of i8 like regular load.

Loads and stores less than 64-bits are already atomic, this adds support for a special case thereof. This needs to be expanded.

llvm-svn: 336236

6 years agoAmmend "Fix MSVC2015 compilation failure after r336206 patch".
Alexander Polyakov [Tue, 3 Jul 2018 22:51:01 +0000 (22:51 +0000)]
Ammend "Fix MSVC2015 compilation failure after r336206 patch".

llvm-svn: 336235

6 years ago[libFuzzer] add one more value profile metric, under a flag (experimental)
Kostya Serebryany [Tue, 3 Jul 2018 22:33:09 +0000 (22:33 +0000)]
[libFuzzer] add one more value profile metric, under a flag (experimental)

llvm-svn: 336234

6 years ago[Sema] Discarded statment should be an evaluatable context.
Erik Pilkington [Tue, 3 Jul 2018 22:15:36 +0000 (22:15 +0000)]
[Sema] Discarded statment should be an evaluatable context.

The constexpr evaluator was erroring out because these templates weren't
defined. Despite being used in a discarded statement, we still need to constexpr
evaluate them, which means that we need to instantiate them. Fixes PR37585.

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

llvm-svn: 336233

6 years ago[X86][AsmParser] Fix inconsistent declaration parameter name in r336218
Fangrui Song [Tue, 3 Jul 2018 21:40:03 +0000 (21:40 +0000)]
[X86][AsmParser] Fix inconsistent declaration parameter name in r336218

llvm-svn: 336232

6 years agoFactor out Clang's desired 8MB stack size constant from the various
Richard Smith [Tue, 3 Jul 2018 21:34:13 +0000 (21:34 +0000)]
Factor out Clang's desired 8MB stack size constant from the various
places we hardcode it.

llvm-svn: 336231

6 years ago[libFuzzer] remove stale code, as suggested in https://reviews.llvm.org/D48800
Kostya Serebryany [Tue, 3 Jul 2018 21:22:44 +0000 (21:22 +0000)]
[libFuzzer] remove stale code, as suggested in https://reviews.llvm.org/D48800

llvm-svn: 336230

6 years ago[libFuzzer] add a tiny and surprisingly hard puzzle
Kostya Serebryany [Tue, 3 Jul 2018 21:17:55 +0000 (21:17 +0000)]
[libFuzzer] add a tiny and surprisingly hard puzzle

llvm-svn: 336229

6 years ago[clangd] Replace UniqueFunction with llvm::unique_function.
Benjamin Kramer [Tue, 3 Jul 2018 20:59:33 +0000 (20:59 +0000)]
[clangd] Replace UniqueFunction with llvm::unique_function.

One implementation of this ought to be enough for everyone.

llvm-svn: 336228

6 years ago[NVPTX] Expand v2f16 INSERT_VECTOR_ELT
Benjamin Kramer [Tue, 3 Jul 2018 20:40:04 +0000 (20:40 +0000)]
[NVPTX] Expand v2f16 INSERT_VECTOR_ELT

Vectorization can create them.

llvm-svn: 336227

6 years ago[X86] Remove repeated 'the' from multiple comments that have been copy and pasted...
Craig Topper [Tue, 3 Jul 2018 20:39:55 +0000 (20:39 +0000)]
[X86] Remove repeated 'the' from multiple comments that have been copy and pasted. NFC

llvm-svn: 336226

6 years agoFix allocation of Nullability attribute.
Erich Keane [Tue, 3 Jul 2018 20:30:34 +0000 (20:30 +0000)]
Fix allocation of Nullability attribute.

Existing code always allocates for on the declarator's attribute pool,
but sometimes adds it to the declspec.  This patch ensures that the
correct pool is used.

Discovered while testing: https://reviews.llvm.org/D48788

llvm-svn: 336225

6 years ago[X86] Add tests for low/high bit clearing with different attributes.
Roman Lebedev [Tue, 3 Jul 2018 19:12:37 +0000 (19:12 +0000)]
[X86] Add tests for low/high bit clearing with different attributes.

D48768 may turn some of these into shifts.

Reviewers: spatel

Reviewed By: spatel

Subscribers: spatel, RKSimon, llvm-commits, craig.topper

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

llvm-svn: 336224

6 years ago[ARM] Fix inconsistent declaration parameter name in r336195
Fangrui Song [Tue, 3 Jul 2018 19:12:27 +0000 (19:12 +0000)]
[ARM] Fix inconsistent declaration parameter name in r336195

llvm-svn: 336223

6 years ago[AArch64] Make function parameter names in declarations match those of definitions
Fangrui Song [Tue, 3 Jul 2018 19:07:53 +0000 (19:07 +0000)]
[AArch64] Make function parameter names in declarations match those of definitions

llvm-svn: 336222

6 years ago[scudo] Get rid of builtin-declaration-mismatch warnings
Kostya Kortchinsky [Tue, 3 Jul 2018 19:03:46 +0000 (19:03 +0000)]
[scudo] Get rid of builtin-declaration-mismatch warnings

Summary:
The C interceptors were using `SIZE_T` defined in the interception library as
a `__sanitizer::uptr`. On some 32-bit platforms, this lead to the following
warning:
```
warning: declaration of ‘void* malloc(SIZE_T)’ conflicts with built-in declaration ‘void* malloc(unsigned int)’ [-Wbuiltin-declaration-mismatch]
INTERCEPTOR_ATTRIBUTE void *malloc(SIZE_T size) {
```
`__sanitizer::uptr` is indeed defined as an `unsigned long` on those.

So just include `stddef.h` and use `size_t` instead.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: delcypher, llvm-commits, #sanitizers

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

llvm-svn: 336221

6 years ago[InstCombine] add tests for shuffle+binop with constant op1; NFC
Sanjay Patel [Tue, 3 Jul 2018 18:43:46 +0000 (18:43 +0000)]
[InstCombine] add tests for shuffle+binop with constant op1; NFC

This adds coverage for a planned enhancement for ConstantExpr::getBinOpIdentity() noted in D48830.

llvm-svn: 336220

6 years agoFix crash in clang.
Zachary Turner [Tue, 3 Jul 2018 18:12:39 +0000 (18:12 +0000)]
Fix crash in clang.

This happened during a recent refactor.  toStringRefArray() returns
a vector<StringRef>, which was being implicitly converted to an
ArrayRef<StringRef>, and then the vector was immediately being
destroyed, so the ArrayRef<> was losing its backing storage.
Fix this by making sure the vector gets permanent storage.

llvm-svn: 336219

6 years ago[X86][AsmParser] Rework the in/out (%dx) hack one more time.
Craig Topper [Tue, 3 Jul 2018 18:07:30 +0000 (18:07 +0000)]
[X86][AsmParser] Rework the in/out (%dx) hack one more time.

This patch adds a new token type specifically for (%dx). We will now always create this token when we parse (%dx). After all operands have been parsed, if the mnemonic is in/out we'll morph this token to a regular register token. Otherwise we keep it as the special DX token which won't match any instructions.

This removes the need for passing Mnemonic through the parsing functions. It also seems closer to gas where when its used on the wrong instruction it just gets diagnosed as an invalid operand rather than a bad memory address.

llvm-svn: 336218

6 years ago[X86][AsmParser] Don't consider %eip as a valid register outside of 32-bit mode.
Craig Topper [Tue, 3 Jul 2018 17:40:51 +0000 (17:40 +0000)]
[X86][AsmParser] Don't consider %eip as a valid register outside of 32-bit mode.

This might make the error message added in r335668 unneeded, but I'm not sure yet.

The check for RIP is technically unnecessary since RIP is in GR64, but that fact is kind of surprising so be explicit.

llvm-svn: 336217

6 years agoFix typo in lib/Support/Path.cpp to test commit access
Vladimir Stefanovic [Tue, 3 Jul 2018 17:26:43 +0000 (17:26 +0000)]
Fix typo in lib/Support/Path.cpp to test commit access

llvm-svn: 336216

6 years ago[Constants] add identity constants for fadd/fmul
Sanjay Patel [Tue, 3 Jul 2018 17:12:59 +0000 (17:12 +0000)]
[Constants] add identity constants for fadd/fmul

As the test diffs show, the current users of getBinOpIdentity()
are InstCombine and Reassociate. SLP vectorizer is a candidate
for using this functionality too (D28907).

The InstCombine shuffle improvements are part of the planned
enhancements noted in D48830.

InstCombine actually has several other uses of getBinOpIdentity()
via SimplifyUsingDistributiveLaws(), but we don't call that for
any FP ops. Fixing that might be another part of removing the
custom reassociation in InstCombine that is only done for fadd+fmul.

llvm-svn: 336215

6 years ago[Reassociate] add tests for binop with identity constant; NFC
Sanjay Patel [Tue, 3 Jul 2018 16:44:18 +0000 (16:44 +0000)]
[Reassociate] add tests for binop with identity constant; NFC

llvm-svn: 336214

6 years ago[scudo] Enable Scudo on PPC64
Kostya Kortchinsky [Tue, 3 Jul 2018 16:09:18 +0000 (16:09 +0000)]
[scudo] Enable Scudo on PPC64

Summary:
In conjunction with the clang side change D48833, this will enable Scudo on
PPC64. I tested `check-scudo` on a powerpc64le box and everything passes.

Reviewers: eugenis, alekseyshl

Reviewed By: alekseyshl

Subscribers: mgorny, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 336213

6 years agoFix MSVC2015 compilation failure after r336206 patch.
Alexander Polyakov [Tue, 3 Jul 2018 16:07:30 +0000 (16:07 +0000)]
Fix MSVC2015 compilation failure after r336206 patch.

Added missing headers.

llvm-svn: 336212

6 years ago[Reassociate] regenerate checks; NFC
Sanjay Patel [Tue, 3 Jul 2018 16:01:41 +0000 (16:01 +0000)]
[Reassociate] regenerate checks; NFC

llvm-svn: 336211

6 years ago[AArch64][SVE] Asm: Support for FP Complex ADD/MLA.
Sander de Smalen [Tue, 3 Jul 2018 16:01:27 +0000 (16:01 +0000)]
[AArch64][SVE] Asm: Support for FP Complex ADD/MLA.

The variants added in this patch are:

- Predicated Complex floating point ADD with rotate, e.g.

   fcadd   z0.h, p0/m, z0.h, z1.h, #90

- Predicated Complex floating point MLA with rotate, e.g.

   fcmla   z0.h, p0/m, z1.h, z2.h, #180

- Unpredicated Complex floating point MLA with rotate (indexed operand), e.g.

   fcmla   z0.h, p0/m, z1.h, z2.h[0], #180

Reviewers: rengolin, fhahn, SjoerdMeijer, samparker, javed.absar

Reviewed By: fhahn

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

llvm-svn: 336210

6 years ago[AArch64][GlobalISel] Fix fallbacks introduced in r336120 due to unselectable stores.
Amara Emerson [Tue, 3 Jul 2018 15:59:26 +0000 (15:59 +0000)]
[AArch64][GlobalISel] Fix fallbacks introduced in r336120 due to unselectable stores.

r336120 resulted in falling back to SelectionDAG more often due to the G_STORE
MMOs not matching the vreg size. This fixes that by explicitly any-extending the
value.

llvm-svn: 336209

6 years ago[Reassociate] add test for missing FP constant analysis; NFC
Sanjay Patel [Tue, 3 Jul 2018 15:56:04 +0000 (15:56 +0000)]
[Reassociate] add test for missing FP constant analysis; NFC

llvm-svn: 336208

6 years agoRename lazy initialization functions to reflect behavior (NFC)
Teresa Johnson [Tue, 3 Jul 2018 15:52:57 +0000 (15:52 +0000)]
Rename lazy initialization functions to reflect behavior (NFC)

Suggested in review for D48698.

llvm-svn: 336207

6 years ago[lldb-mi] Re-implement symbol-list-lines command.
Alexander Polyakov [Tue, 3 Jul 2018 15:40:20 +0000 (15:40 +0000)]
[lldb-mi] Re-implement symbol-list-lines command.

Summary: Now this command uses SB API instead of HandleCommand.

Reviewers: aprantl, clayborg

Reviewed By: aprantl, clayborg

Subscribers: ki.stfu, eraman, lldb-commits

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

llvm-svn: 336206

6 years ago[AArch64][SVE] Asm: Support for FMUL (indexed)
Sander de Smalen [Tue, 3 Jul 2018 15:31:04 +0000 (15:31 +0000)]
[AArch64][SVE] Asm: Support for FMUL (indexed)

Unpredicated FP-multiply of SVE vector with a vector-element given by
vector[index], for example:

  fmul z0.s, z1.s, z2.s[0]

which performs an unpredicated FP-multiply of all 32-bit elements in
'z1' with the first element from 'z2'.

This patch adds restricted register classes for SVE vectors:
  ZPR_3b (only z0..z7 are allowed)  - for indexed vector of 16/32-bit elements.
  ZPR_4b (only z0..z15 are allowed) - for indexed vector of 64-bit elements.

Reviewers: rengolin, fhahn, SjoerdMeijer, samparker, javed.absar

Reviewed By: fhahn

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

llvm-svn: 336205

6 years ago[AArch64][SVE] Asm: Support for predicated unary operations.
Sander de Smalen [Tue, 3 Jul 2018 14:57:48 +0000 (14:57 +0000)]
[AArch64][SVE] Asm: Support for predicated unary operations.

The patch includes support for the following instructions:

       ABS z0.h, p0/m, z0.h
       NEG z0.h, p0/m, z0.h

  (S|U)XTB z0.h, p0/m, z0.h
  (S|U)XTB z0.s, p0/m, z0.s
  (S|U)XTB z0.d, p0/m, z0.d

  (S|U)XTH z0.s, p0/m, z0.s
  (S|U)XTH z0.d, p0/m, z0.d

  (S|U)XTW z0.d, p0/m, z0.d

llvm-svn: 336204

6 years ago[clangd] Use default format style and fallback style. NFC
Eric Liu [Tue, 3 Jul 2018 14:51:23 +0000 (14:51 +0000)]
[clangd] Use default format style and fallback style. NFC

llvm-svn: 336203

6 years ago[Driver] Add PPC64 as supported for Scudo
Kostya Kortchinsky [Tue, 3 Jul 2018 14:39:29 +0000 (14:39 +0000)]
[Driver] Add PPC64 as supported for Scudo

Summary:
Scudo works on PPC64 as is, so mark the architecture as supported for it. This
will also require a change to config-ix.cmake on the compiler-rt side.

Update the tests accordingly.

Reviewers: eugenis, alekseyshl

Reviewed By: alekseyshl

Subscribers: cfe-commits

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

llvm-svn: 336202

6 years ago[ELF][MIPS] Use llvm-mc to generate test case input file. NFC
Simon Atanasyan [Tue, 3 Jul 2018 14:39:27 +0000 (14:39 +0000)]
[ELF][MIPS] Use llvm-mc to generate test case input file. NFC

llvm-svn: 336201

6 years agoAdd new API to SBTarget and SBModule classes.
Alexander Polyakov [Tue, 3 Jul 2018 14:22:44 +0000 (14:22 +0000)]
Add new API to SBTarget and SBModule classes.

Summary: The new API allows to find a list of compile units related to target/module.

Reviewers: aprantl, clayborg

Reviewed By: aprantl

Subscribers: jingham, lldb-commits

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

llvm-svn: 336200

6 years ago[ELF] - Add a comment. NFC.
George Rimar [Tue, 3 Jul 2018 14:16:19 +0000 (14:16 +0000)]
[ELF] - Add a comment. NFC.

Minor follow up for r336197
"[ELF] - Add support for '||' and '&&' in linker scripts."

llvm-svn: 336199

6 years ago[DAGCombiner] visitSDIV - Permit MIN_SIGNED_VALUE in pow2 vector codegen
Simon Pilgrim [Tue, 3 Jul 2018 14:11:32 +0000 (14:11 +0000)]
[DAGCombiner] visitSDIV - Permit MIN_SIGNED_VALUE in pow2 vector codegen

Now that D45806 has landed, we can re-enable support for MIN_SIGNED_VALUE in the sdiv by pow2-constant code

llvm-svn: 336198

6 years ago[ELF] - Add support for '||' and '&&' in linker scripts.
George Rimar [Tue, 3 Jul 2018 14:02:52 +0000 (14:02 +0000)]
[ELF] - Add support for '||' and '&&' in linker scripts.

This is https://bugs.llvm.org//show_bug.cgi?id=37976,
we had no support, but seems someone faced it.

llvm-svn: 336197

6 years ago[InstCombine] fold shuffle-with-binop and common value
Sanjay Patel [Tue, 3 Jul 2018 13:44:22 +0000 (13:44 +0000)]
[InstCombine] fold shuffle-with-binop and common value

This is the last significant change suggested in PR37806:
https://bugs.llvm.org/show_bug.cgi?id=37806#c5
...though there are several follow-ups noted in the code comments
in this patch to complete this transform.

It's possible that a binop feeding a select-shuffle has been eliminated
by earlier transforms (or the code was just written like this in the 1st
place), so we'll fail to match the patterns that have 2 binops from:
D48401,
D48678,
D48662,
D48485.

In that case, we can try to materialize identity constants for the remaining
binop to fill in the "ghost" lanes of the vector (where we just want to pass
through the original values of the source operand).

I added comments to ConstantExpr::getBinOpIdentity() to show planned follow-ups.
For now, we only handle the 5 commutative integer binops (add/mul/and/or/xor).

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

llvm-svn: 336196