platform/upstream/llvm.git
6 years ago[AMDGPU] Change llvm.debugtrap to be a debug breakpoint that can resume execution.
Tony Tye [Wed, 16 May 2018 16:19:34 +0000 (16:19 +0000)]
[AMDGPU] Change llvm.debugtrap to be a debug breakpoint that can resume execution.

No longer require the queue pointer to be passed in in fixed SGPRs.

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

llvm-svn: 332485

6 years ago[x86] add tests for DAG FP undef operands; NFC
Sanjay Patel [Wed, 16 May 2018 16:16:48 +0000 (16:16 +0000)]
[x86] add tests for DAG FP undef operands; NFC

llvm-svn: 332484

6 years ago[AArch64][SVE] Improve diagnostics for vectors with incorrect element-size.
Sander de Smalen [Wed, 16 May 2018 15:45:17 +0000 (15:45 +0000)]
[AArch64][SVE] Improve diagnostics for vectors with incorrect element-size.

For regular SVE vector operands, this patch introduces a more
sensible diagnostic when the vector has a wrong suffix (e.g. z0.s vs z0.b).

For example:
  add z0.s, z1.s, z2.b      -> invalid element width
               ^_____^
               mismatch

For the vector-with-shift/extend (e.g. z0.s, uxtw #2) this patch takes
a slightly different approach and instead returns a 'invalid operand'
if the element size is not as expected. This is because the diagnostics
are more specificied to suggest using the right shift/extend suffix. This
is a trade-off not to introduce more operand classes and still provide
useful diagnostics for LD1 and PRF instructions.

For example:
  ld1w z1.s, p0/z, [x0, z0.s] -> invalid shift/extend specified, expected 'z[0..31].s, (uxtw|sxtw)'
  ld1w z1.d, p0/z, [x0, z0.s] -> invalid operand
          ^________________^
               mismatch

For gather prefetches, both 'z0.s' and 'z0.d' would be allowed:
  prfw #0, p0, [x0, z0.s]   -> invalid shift/extend specified, expected 'z[0..31].s, (uxtw|sxtw) #2'
  prfw #0, p0, [x0, z0.d]   -> invalid shift/extend specified, expected 'z[0..31].d, (lsl|uxtw|sxtw) #2'

Without this change, the diagnostic would unnecessarily suggest a
different element size:
  prfw #0, p0, [x0, z0.s]   -> invalid shift/extend specified, expected 'z[0..31].d, (lsl|uxtw|sxtw) #2'

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

Reviewed By: SjoerdMeijer

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

llvm-svn: 332483

6 years ago[AArch64] Gangup loads and stores for pairing.
Sirish Pande [Wed, 16 May 2018 15:36:52 +0000 (15:36 +0000)]
[AArch64] Gangup loads and stores for pairing.

Keep loads and stores together (target defines how many loads
and stores to gang up), such that it will help in pairing
and vectorization.

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

llvm-svn: 332482

6 years ago[Attr] Don't print fake MSInheritance argument
Joel E. Denny [Wed, 16 May 2018 15:18:30 +0000 (15:18 +0000)]
[Attr] Don't print fake MSInheritance argument

This was discovered at:

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180514/228390.html

Reviewed by: aaron.ballman

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

llvm-svn: 332481

6 years agoRevert r332474: [Attr] Don't print fake MSInheritance argument
Joel E. Denny [Wed, 16 May 2018 15:18:27 +0000 (15:18 +0000)]
Revert r332474: [Attr] Don't print fake MSInheritance argument

I botched the commit log attributes.

llvm-svn: 332480

6 years ago[InstCombine] allow more binop (shuffle X), C transforms
Sanjay Patel [Wed, 16 May 2018 15:15:22 +0000 (15:15 +0000)]
[InstCombine] allow more binop (shuffle X), C transforms

The canonicalization was restricted to shuffle masks with
a 1-to-1 mapping to the constant vector, but that disqualifies
the common splat pattern. This is part of solving PR37463:
https://bugs.llvm.org/show_bug.cgi?id=37463

llvm-svn: 332479

6 years ago[sanitizer] Minor 32-bit primary improvements
Kostya Kortchinsky [Wed, 16 May 2018 15:13:26 +0000 (15:13 +0000)]
[sanitizer] Minor 32-bit primary improvements

Summary:
For the 32-bit TransferBatch:
- `SetFromArray` callers have bounds `count`, so relax the `CHECK` to `DCHECK`;
- same for `Add`;
- mark `CopyToArray` as `const`;
For the 32-bit Primary:
- `{Dea,A}llocateBatch` are only called from places that check `class_id`,
  relax the `CHECK` to `DCHECK`;
- same for `AllocateRegion`;
- remove `GetRegionBeginBySizeClass` that is not used;
- use a local variable for the random shuffle state, so that the compiler can
  use a register instead of reading and writing to the `SizeClassInfo` at every
  iteration;
For the 32-bit local cache:
- pass the count to drain instead of doing a `Min` everytime which is at times
  superfluous.

Reviewers: alekseyshl

Reviewed By: alekseyshl

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

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

llvm-svn: 332478

6 years ago[OPENMP] DO not crash on combined constructs in declare target
Alexey Bataev [Wed, 16 May 2018 15:08:32 +0000 (15:08 +0000)]
[OPENMP] DO not crash on combined constructs in declare target
functions.

If the combined construct is specified in the declare target function
and the device code is emitted, the compiler crashes because of the
incorrectly chosen captured stmt. We should choose the innermost
captured statement, not the outermost.

llvm-svn: 332477

6 years ago[ThinLTO] Make llvm-lto module ID numbering consistent with linkers
Teresa Johnson [Wed, 16 May 2018 14:58:14 +0000 (14:58 +0000)]
[ThinLTO] Make llvm-lto module ID numbering consistent with linkers

The module ID numbering typically starts at 0 (in both the new and old
LTO APIs, used by linkers). Make llvm-lto consistent with that.

Split out of D46699.

llvm-svn: 332476

6 years ago[ThinLTO] Add const qualifier to a couple of flag getter methods
Teresa Johnson [Wed, 16 May 2018 14:56:02 +0000 (14:56 +0000)]
[ThinLTO] Add const qualifier to a couple of flag getter methods

Split these minor fixes out of D46699.

llvm-svn: 332475

6 years ago[Attr] Don't print fake MSInheritance argument
Joel E. Denny [Wed, 16 May 2018 14:51:18 +0000 (14:51 +0000)]
[Attr] Don't print fake MSInheritance argument

This was discovered at:

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180514/228390.html

Reviewed by: aaron.ballman

https://reviews.llvm.org/D46905

llvm-svn: 332474

6 years ago[OpenCL] make test independent of optimizer
Sanjay Patel [Wed, 16 May 2018 14:38:07 +0000 (14:38 +0000)]
[OpenCL] make test independent of optimizer

There shouldn't be any tests that run the entire optimizer here,
but the last test in this file is definitely going to break with
a change in LLVM IR canonicalization. Change that part to check
the unoptimized IR because that's the real intent of this file.

llvm-svn: 332473

6 years ago[AArch64][SVE] Asm: Support for gather PRF prefetch instructions
Sander de Smalen [Wed, 16 May 2018 14:16:01 +0000 (14:16 +0000)]
[AArch64][SVE] Asm: Support for gather PRF prefetch instructions

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

Reviewed By: SjoerdMeijer

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

llvm-svn: 332472

6 years ago[ScopInfo] Remove usage of isl_set_n_basic_set()
Philip Pfaffe [Wed, 16 May 2018 14:05:03 +0000 (14:05 +0000)]
[ScopInfo] Remove usage of isl_set_n_basic_set()

Summary: This patch aims to remove the usage of old C-styled isl functions (in this case `isl_set_n_basic_set()`) in favor of new C++ isl interface based methods in `ScopInfo.cpp`.

Patch by Sahil Yerawar

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

llvm-svn: 332471

6 years agoAdd support for __declspec(code_seg("segname"))
Erich Keane [Wed, 16 May 2018 13:57:17 +0000 (13:57 +0000)]
Add support for __declspec(code_seg("segname"))

Add support for __declspec(code_seg("segname"))

This patch is built on the existing support for #pragma code_seg. The code_seg
declspec is allowed on functions and classes. The attribute enables the
placement of code into separate named segments, including compiler-generated
members and template instantiations.

For more information, please see the following:
https://msdn.microsoft.com/en-us/library/dn636922.aspx

A new CodeSeg attribute is used instead of adding a new spelling to the existing
Section attribute since they don’t apply to the same Subjects. Section
attributes are also added for the code_seg declspec since they are used for
#pragma code_seg. No CodeSeg attributes are added to the AST.

The patch is written to match with the Microsoft compiler’s behavior even where
that behavior is a little complicated (see https://reviews.llvm.org/D22931, the
Microsoft feedback page is no longer available since MS has removed the page).
That code is in getImplicitSectionAttrFromClass routine.

Diagnostics messages are added to match with the Microsoft compiler for code-seg
attribute mismatches on base and derived classes and virtual overrides.

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

llvm-svn: 332470

6 years ago[Frontend] Avoid running plugins during code completion parse
Ivan Donchevskii [Wed, 16 May 2018 13:50:05 +0000 (13:50 +0000)]
[Frontend] Avoid running plugins during code completion parse

The parsing that is done for code completion is a special case that will
discard any generated diagnostics, so avoid running plugins for this
case in the first place to avoid performance penalties due to the
plugins.

A scenario for this is for example libclang with extra plugins like tidy.

Patch by Nikolai Kosjar

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

llvm-svn: 332469

6 years ago[llvm-mca] Move definitions in FetchStage.cpp inside namespace mca. NFC
Andrea Di Biagio [Wed, 16 May 2018 13:38:17 +0000 (13:38 +0000)]
[llvm-mca] Move definitions in FetchStage.cpp inside namespace mca. NFC

Also, get rid of a redundant include in FetchStage.h and FetchStage.cpp.

llvm-svn: 332468

6 years ago[OPENMP, NVPTX] Add check for SPMD mode in orphaned parallel directives.
Alexey Bataev [Wed, 16 May 2018 13:36:30 +0000 (13:36 +0000)]
[OPENMP, NVPTX] Add check for SPMD mode in orphaned parallel directives.

If the orphaned directive is executed in SPMD mode, we need to emit the
check for the SPMD mode and run the orphaned parallel directive in
sequential mode.

llvm-svn: 332467

6 years ago[BasicAA] Fix handling of invariant group launders
Krzysztof Pszeniczny [Wed, 16 May 2018 13:16:54 +0000 (13:16 +0000)]
[BasicAA] Fix handling of invariant group launders

Summary:
A recent patch ([[ https://reviews.llvm.org/rL331587 | rL331587 ]]) to Capture Tracking taught it that the `launder_invariant_group` intrinsic captures its argument only by returning it. Unfortunately, BasicAA still considered every call instruction as a possible escape source and hence concluded that the result of a `launder_invariant_group` call cannot alias any local non-escaping value. This led to [[ https://bugs.llvm.org/show_bug.cgi?id=37458 | bug 37458 ]].

This patch updates the relevant check for escape sources in BasicAA.

Reviewers: Prazek, kuhar, rsmith, hfinkel, sanjoy, xbolva00

Reviewed By: hfinkel, xbolva00

Subscribers: JDevlieghere, hiraditya, llvm-commits

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

llvm-svn: 332466

6 years agoFix an Index test caused by a clang-format change (r332436).
Eric Liu [Wed, 16 May 2018 12:58:13 +0000 (12:58 +0000)]
Fix an Index test caused by a clang-format change (r332436).

llvm-svn: 332465

6 years ago[mips] Simplify some of the predicate scopes for (negative) multiply add/sub instruct...
Simon Dardis [Wed, 16 May 2018 12:44:27 +0000 (12:44 +0000)]
[mips] Simplify some of the predicate scopes for (negative) multiply add/sub instructions (NFCI)

llvm-svn: 332464

6 years ago[analyzer] Improve the modeling of memset().
Henry Wong [Wed, 16 May 2018 12:37:53 +0000 (12:37 +0000)]
[analyzer] Improve the modeling of memset().

Since there is no perfect way bind the non-zero value with the default binding, this patch only considers the case where buffer's offset is zero and the char value is 0. And according to the value for overwriting, decide how to update the string length.

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

Reviewed By: NoQ

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

llvm-svn: 332463

6 years ago[mips] Join existing scopes for DecoderNamespace (NFCI)
Simon Dardis [Wed, 16 May 2018 12:37:04 +0000 (12:37 +0000)]
[mips] Join existing scopes for DecoderNamespace (NFCI)

llvm-svn: 332462

6 years ago[llvm-mca] Fix perf regression after r332390.
Andrea Di Biagio [Wed, 16 May 2018 12:33:09 +0000 (12:33 +0000)]
[llvm-mca] Fix perf regression after r332390.

Revision 332390 introduced a FetchStage class in llvm-mca.
By design, FetchStage owns all the instructions in-flight in the OoO Backend.

Before this change, new instructions were added to a DenseMap indexed by
instruction id. The problem with using a DenseMap is that elements are not
ordered by key. This was causing a massive slow down in method
FetchStage::postExecute(), which searches for instructions retired that can be
deleted.

This patch replaces the DenseMap with a std::map ordered by instruction index.
At the end of every cycle, we search for the first instruction which is not
marked as "retired", and we remove all the previous instructions before it.
This works well because instructions are retired in-order.

Before this patch, a debug build of llvm-mca (on my Ryzen linux machine) took
~8.0 seconds to simulate 3000 iterations of a x86 dot-product (a `vmulps,
vpermilps, vaddps, vpermilps, vaddps` sequence). With this patch, it now takes
~0.8s to run all the 3000 iterations.

llvm-svn: 332461

6 years ago[clangd] Parse all comments in Sema and completion.
Ilya Biryukov [Wed, 16 May 2018 12:32:49 +0000 (12:32 +0000)]
[clangd] Parse all comments in Sema and completion.

Summary:
And add tests for the comment extraction code.

clangd will now show non-doxygen comments in completion for results
coming from Sema and Dynamic index.
Static index does not include the comments yet, I will enable it in
a separate commit after investigating which implications it has for
the size of the index.

Reviewers: sammccall, hokein, ioeric

Reviewed By: sammccall

Subscribers: klimek, MaskRay, jkorous, cfe-commits

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

llvm-svn: 332460

6 years ago[clangd] Retrieve minimally formatted comment text in completion.
Ilya Biryukov [Wed, 16 May 2018 12:32:44 +0000 (12:32 +0000)]
[clangd] Retrieve minimally formatted comment text in completion.

Summary:
Previous implementation used to extract brief text from doxygen comments.
Brief text parsing slows down completion and is not suited for
non-doxygen comments.

This commit switches to providing comments that mimic the ones
originally written in the source code, doing minimal reindenting and
removing the comments markers to make the output more user-friendly.

It means we lose support for doxygen-specific features, e.g. extracting
brief text, but provide useful results for non-doxygen comments.
Switching the doxygen support back is an option, but I suggest to see
whether the current approach gives more useful results.

Reviewers: sammccall, hokein, ioeric

Reviewed By: sammccall

Subscribers: klimek, MaskRay, jkorous, cfe-commits

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

llvm-svn: 332459

6 years ago[AST] Added a helper to extract a user-friendly text of a comment.
Ilya Biryukov [Wed, 16 May 2018 12:30:09 +0000 (12:30 +0000)]
[AST] Added a helper to extract a user-friendly text of a comment.

Summary:
The helper is used in clangd for documentation shown in code completion
and storing the docs in the symbols. See D45999.

This patch reuses the code of the Doxygen comment lexer, disabling the
bits that do command and html tag parsing.
The new helper works on all comments, including non-doxygen comments.
However, it does not understand or transform any doxygen directives,
i.e. cannot extract brief text, etc.

Reviewers: sammccall, hokein, ioeric

Reviewed By: ioeric

Subscribers: mgorny, cfe-commits

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

llvm-svn: 332458

6 years ago[CodeComplete] Expose helpers to get RawComment of completion result.
Ilya Biryukov [Wed, 16 May 2018 12:30:01 +0000 (12:30 +0000)]
[CodeComplete] Expose helpers to get RawComment of completion result.

Summary: Used in clangd, see D45999.

Reviewers: sammccall, hokein, ioeric, arphaman

Reviewed By: sammccall

Subscribers: arphaman, cfe-commits

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

llvm-svn: 332457

6 years ago[clangd] Filter out private proto symbols in SymbolCollector.
Eric Liu [Wed, 16 May 2018 12:12:30 +0000 (12:12 +0000)]
[clangd] Filter out private proto symbols in SymbolCollector.

Summary:
This uses heuristics to identify private proto symbols. For example,
top-level symbols whose name contains "_" are considered private. These symbols
are not expected to be used by users.

Reviewers: ilya-biryukov, malaperle

Reviewed By: ilya-biryukov

Subscribers: sammccall, klimek, MaskRay, jkorous, cfe-commits

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

llvm-svn: 332456

6 years ago[llvm-exegesis] Fix unused variable warning in release mode.
Clement Courbet [Wed, 16 May 2018 11:49:15 +0000 (11:49 +0000)]
[llvm-exegesis] Fix unused variable warning in release mode.

llvm-svn: 332455

6 years agoTest commit access: remove superflous spaces
Gabor Marton [Wed, 16 May 2018 11:48:11 +0000 (11:48 +0000)]
Test commit access: remove superflous spaces

llvm-svn: 332454

6 years agoAMDGPU: Custom lower v4i16/v4f16 vector operations
Matt Arsenault [Wed, 16 May 2018 11:47:30 +0000 (11:47 +0000)]
AMDGPU: Custom lower v4i16/v4f16 vector operations

Avoids stack access.

Also handle extract hi elt pattern from truncate + shift
to avoid a couple test regressions.

llvm-svn: 332453

6 years ago[SimplifyLibcalls] Replace locked IO with unlocked IO
David Bolvansky [Wed, 16 May 2018 11:39:52 +0000 (11:39 +0000)]
[SimplifyLibcalls] Replace locked IO with unlocked IO

Summary: If file stream arg is not captured and source is fopen, we could replace IO calls by unlocked IO ("_unlocked" function variants) to gain better speed,

Reviewers: efriedma, RKSimon, spatel, sanjoy, hfinkel, majnemer, lebedev.ri, rja

Reviewed By: rja

Subscribers: rja, srhines, efriedma, lebedev.ri, llvm-commits

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

llvm-svn: 332452

6 years ago[X86] Split WriteCvtI2F/WriteCvtF2I into I<->F32 and I<->F64 scheduler classes
Simon Pilgrim [Wed, 16 May 2018 10:53:45 +0000 (10:53 +0000)]
[X86] Split WriteCvtI2F/WriteCvtF2I into I<->F32 and I<->F64 scheduler classes

A lot of the models still have too many InstRW overrides for these new classes - this needs cleaning up but I wanted to get the classes in first

llvm-svn: 332451

6 years ago[LoopUnroll] Split out simplify code after Unroll into a new function. NFC
David Green [Wed, 16 May 2018 10:41:58 +0000 (10:41 +0000)]
[LoopUnroll] Split out simplify code after Unroll into a new function. NFC

So that it can be shared with other passes that may end up doing the same
thing.

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

llvm-svn: 332450

6 years ago[GlobalISel][IRTranslator] Split aggregates during IR translation.
Amara Emerson [Wed, 16 May 2018 10:32:02 +0000 (10:32 +0000)]
[GlobalISel][IRTranslator] Split aggregates during IR translation.

We currently handle all aggregates by creating one large LLT, and letting the
legalizer deal with splitting them up. However using this approach means that
we can't support big endian code correctly.

This patch changes the way that the IRTranslator deals with aggregate values,
by splitting them up into their constituent element values. To do this, parts
of the translator need to be modified to deal with multiple VRegs for a single
Value.

A new Value to VReg mapper is introduced to help keep compile time under
control, currently there is no measurable impact on CTMark despite the extra
code being generated in some cases.

Patch is based on the original work of Tim Northover.

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

llvm-svn: 332449

6 years ago[diagtool] Add diagtool to install target.
Jonas Devlieghere [Wed, 16 May 2018 10:23:25 +0000 (10:23 +0000)]
[diagtool] Add diagtool to install target.

Although not very well known, diagtool is an incredibly convenient
utility for dealing with diagnostics.
Particularly useful are the "tree" and "show-enabled" commands:

 - The former prints the hierarchy of diagnostic (warning) flags and
   which of them are enabled by default.
 - The latter can be used to replace an invocation to clang and will
   print which diagnostics are disabled, warnings or errors.
   For instance: `diagtool show-enabled -Wall -Werror /tmp/test.c` will
   print that -Wunused-variable (warn_unused_variable) will be treated as
   an error.

This patch adds them to the install target so it gets shipped with the
LLVM release. It also adds a very basic man page and mentions this
change in the release notes.

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

llvm-svn: 332448

6 years ago[llvm-mca] Regenerate tests after r332381 and r332361. NFC
Andrea Di Biagio [Wed, 16 May 2018 10:12:06 +0000 (10:12 +0000)]
[llvm-mca] Regenerate tests after r332381 and r332361. NFC

llvm-svn: 332447

6 years ago[mips] Add support for isBranchOffsetInRange and use it for MipsLongBranch
Simon Dardis [Wed, 16 May 2018 10:03:05 +0000 (10:03 +0000)]
[mips] Add support for isBranchOffsetInRange and use it for MipsLongBranch

Add support for this target hook, covering MIPS, microMIPS and MIPSR6, along
with some tests. Also add missing getOppositeBranchOpc() cases exposed by the
tests.

Reviewers: atanasyan, abeserminji, smaksimovic

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

llvm-svn: 332446

6 years ago[llvm-exegesis] Add a flag to output analysis csv to a file.
Clement Courbet [Wed, 16 May 2018 09:50:04 +0000 (09:50 +0000)]
[llvm-exegesis] Add a flag to output analysis csv to a file.

Reviewers: gchatelet

Subscribers: llvm-commits, tschuett

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

llvm-svn: 332445

6 years ago[AArch64] Support "S" inline assembler constraint
Peter Smith [Wed, 16 May 2018 09:33:25 +0000 (09:33 +0000)]
[AArch64] Support "S" inline assembler constraint

This patch re-introduces the "S" inline assembler constraint. This matches
an absolute symbolic address or a label reference. The primary use case is

asm("adrp %0, %1\n\t"
    "add %0, %0, :lo12:%1" : "=r"(addr) : "S"(&var));

I say re-introduces as it seems like "S" was implemented in the original
AArch64 backend, but it looks like it wasn't carried forward to the merged
backend. The original implementation had A and L modifiers that could be
used to print ":lo12:" to the string. It looks like gcc doesn't use these
and :lo12: is expected to be written in the inline assembly string so I've
not implemented A and L. Clang already supports the S modifier.

Fixes PR37180

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

llvm-svn: 332444

6 years ago[llvm-mca] Remove redundant includes in Stage.h.
Andrea Di Biagio [Wed, 16 May 2018 09:24:38 +0000 (09:24 +0000)]
[llvm-mca] Remove redundant includes in Stage.h.

This patch also makes Stage::isReady() a const method.

No functional change.

llvm-svn: 332443

6 years ago[AArch64][SVE] Asm: Support for structured LD2, LD3 and LD4 (scalar+scalar) load...
Sander de Smalen [Wed, 16 May 2018 09:16:20 +0000 (09:16 +0000)]
[AArch64][SVE] Asm: Support for structured LD2, LD3 and LD4 (scalar+scalar) load instructions.

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

Reviewed By: fhahn

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

llvm-svn: 332442

6 years agoFix unused variable warning in r332437.
Clement Courbet [Wed, 16 May 2018 09:10:04 +0000 (09:10 +0000)]
Fix unused variable warning in r332437.

llvm-svn: 332441

6 years agoEscape ]]> in xunit xml output
Alexander Richardson [Wed, 16 May 2018 09:00:28 +0000 (09:00 +0000)]
Escape ]]> in xunit xml output

Summary:
This sequence ends the CDATA block so any characters after that are no
longer escaped. This can be fixed by replacing "]]>" with "]]]]><![CDATA[>".

Reviewers: cmatthews

Reviewed By: cmatthews

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

llvm-svn: 332440

6 years agoEmit a left-shift instead of a power-of-two multiply for jump-tables
Alexander Richardson [Wed, 16 May 2018 08:58:26 +0000 (08:58 +0000)]
Emit a left-shift instead of a power-of-two multiply for jump-tables

Summary:
SelectionDAGLegalize::ExpandNode() inserts an ISD::MUL when lowering a
BR_JT opcode. While many backends optimize this multiply into a shift, e.g.
the MIPS backend currently always lowers this into a sequence of
load-immediate+multiply+mflo in MipsSETargetLowering::lowerMulDiv().

I initially changed the multiply to a shift in the MIPS backend but it
turns out that would not have handled the MIPSR6 case and was a lot more
code than doing it in LegalizeDAG.
I believe performing this simple optimization in LegalizeDAG instead of
each individual backend is the better solution since this also fixes other
backeds such as MSP430 which calls the multiply runtime function
__mspabi_mpyi without this patch.

Reviewers: sdardis, atanasyan, pftbest, asl

Reviewed By: sdardis

Subscribers: llvm-commits

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

llvm-svn: 332439

6 years ago[clangd] Fix a link failure in unittests
Heejin Ahn [Wed, 16 May 2018 08:53:57 +0000 (08:53 +0000)]
[clangd] Fix a link failure in unittests

Summary: D46524 (rL332378) introduced a link failure when built with
`-DSHARED_LIB=ON`, which this patch fixes.

Reviewers: ioeric

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

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

llvm-svn: 332438

6 years ago[llvm-exegesis] Analysis: Display sched class for instructions.
Clement Courbet [Wed, 16 May 2018 08:47:21 +0000 (08:47 +0000)]
[llvm-exegesis] Analysis: Display sched class for instructions.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 332437

6 years agoclang-format: Allow optimizer to break template declaration.
Francois Ferrand [Wed, 16 May 2018 08:25:03 +0000 (08:25 +0000)]
clang-format: Allow optimizer to break template declaration.

Summary:
Introduce `PenaltyBreakTemplateDeclaration` to control the penalty,
and change `AlwaysBreakTemplateDeclarations` to an enum with 3 modes:
* `No` for regular, penalty based, wrapping of template declaration
* `MultiLine` for always wrapping before multi-line declarations (e.g.
  same as legacy behavior when `AlwaysBreakTemplateDeclarations=false`)
* `Yes` for always wrapping (e.g. same as legacy behavior when
  `AlwaysBreakTemplateDeclarations=true`)

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

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

llvm-svn: 332436

6 years ago[X86][SSE] Fix tests for vector rotates by splat variable.
Simon Pilgrim [Wed, 16 May 2018 08:23:47 +0000 (08:23 +0000)]
[X86][SSE] Fix tests for vector rotates by splat variable.

We weren't correctly splatting the offset shift

llvm-svn: 332435

6 years agoclang-format: tweak formatting of variable initialization blocks
Francois Ferrand [Wed, 16 May 2018 08:03:52 +0000 (08:03 +0000)]
clang-format: tweak formatting of variable initialization blocks

Summary:
This patch changes the behavior of PenaltyBreakBeforeFirstCallParameter
so that is does not apply after a brace, when Cpp11BracedListStyle is
false.

This way, variable initialization is wrapped more like an initializer
than like a function call, which is more consistent with user
expectations for this braced list style.

With PenaltyBreakBeforeFirstCallParameter=200, this gives the following
code: (with Cpp11BracedListStyle=false)

Before :

  const std::unordered_map<std::string, int> Something::MyHashTable =
      { { "aaaaaaaaaaaaaaaaaaaaa", 0 },
        { "bbbbbbbbbbbbbbbbbbbbb", 1 },
        { "ccccccccccccccccccccc", 2 } };

After :

  const std::unordered_set<std::string> Something::MyUnorderedSet = {
    { "aaaaaaaaaaaaaaaaaaaaa", 0 },
    { "bbbbbbbbbbbbbbbbbbbbb", 1 },
    { "ccccccccccccccccccccc", 2 }
  };

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

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

llvm-svn: 332434

6 years ago[AArch64][SVE] Asm: Support for contiguous PRF prefetch instructions.
Sander de Smalen [Wed, 16 May 2018 07:50:09 +0000 (07:50 +0000)]
[AArch64][SVE] Asm: Support for contiguous PRF prefetch instructions.

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

Reviewed By: SjoerdMeijer

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

llvm-svn: 332433

6 years ago[Unix] Indent ChangeStd{in,out}ToBinary.
Fangrui Song [Wed, 16 May 2018 06:43:27 +0000 (06:43 +0000)]
[Unix] Indent ChangeStd{in,out}ToBinary.

llvm-svn: 332432

6 years agoRemove unused variable introduced in r332336
Mikael Holmen [Wed, 16 May 2018 06:36:11 +0000 (06:36 +0000)]
Remove unused variable introduced in r332336

The unused variable caused a compilation warning:

../lib/Target/X86/X86ISelLowering.cpp:34614:17: error: unused variable 'SMax' [-Werror,-Wunused-variable]
    if (SDValue SMax = MatchMinMax(SMin, ISD::SMAX, C1))
                ^
1 error generated.

llvm-svn: 332431

6 years ago[ObjCARC] Prevent code motion into a catchswitch
Shoaib Meenai [Wed, 16 May 2018 04:52:18 +0000 (04:52 +0000)]
[ObjCARC] Prevent code motion into a catchswitch

A catchswitch must be the only non-phi instruction in its basic block;
attempting to move a retain or release into a catchswitch basic block
will result in invalid IR. Explicitly mark a CFG hazard in this case to
prevent the code motion.

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

llvm-svn: 332430

6 years agoRevert "Signal handling should be signal-safe"
JF Bastien [Wed, 16 May 2018 04:36:37 +0000 (04:36 +0000)]
Revert "Signal handling should be signal-safe"

Some bots don't have double-pointer width compare-and-exchange. Revert for now.q

llvm-svn: 332429

6 years agoSignal handling should be signal-safe
JF Bastien [Wed, 16 May 2018 04:30:00 +0000 (04:30 +0000)]
Signal handling should be signal-safe

Summary:
Before this patch, signal handling wasn't signal safe. This leads to real-world
crashes. It used ManagedStatic inside of signals, this can allocate and can lead
to unexpected state when a signal occurs during llvm_shutdown (because
llvm_shutdown destroys the ManagedStatic). It also used cl::opt without custom
backing storage. Some de-allocation was performed as well. Acquiring a lock in a
signal handler is also a great way to deadlock.

We can't just disable signals on llvm_shutdown because the signals might do
useful work during that shutdown. We also can't just disable llvm_shutdown for
programs (instead of library uses of clang) because we'd have to then mark the
pointers as not leaked and make sure all the ManagedStatic uses are OK to leak
and remain so.

Move all of the code to lock-free datastructures instead, and avoid having any
of them in an inconsistent state. I'm not trying to be fancy, I'm not using any
explicit memory order because this code isn't hot. The only purpose of the
atomics is to guarantee that a signal firing on the same or a different thread
doesn't see an inconsistent state and crash. In some cases we might miss some
state (for example, we might fail to delete a temporary file), but that's fine.

Note that I haven't touched any of the backtrace support despite it not
technically being totally signal-safe. When that code is called we know
something bad is up and we don't expect to continue execution, so calling
something that e.g. sets errno is the least of our problems.

A similar patch should be applied to lib/Support/Windows/Signals.inc, but that
can be done separately.

<rdar://problem/28010281>

Reviewers: dexonsmith

Subscribers: aheejin, llvm-commits

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

llvm-svn: 332428

6 years ago[DebugInfo] Only handle DBG_VALUE in InlineSpiller.
Shiva Chen [Wed, 16 May 2018 02:57:26 +0000 (02:57 +0000)]
[DebugInfo] Only handle DBG_VALUE in InlineSpiller.

The instructions using registers should be DBG_VALUE and normal
instructions. Use isDebugValue() to filter out DBG_VALUE and add
an assert to ensure there is no other kind of debug instructions
using the registers.

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

Patch by Hsiangkai Wang.

llvm-svn: 332427

6 years agoFix LSR compile time hang.
Evgeny Stupachenko [Wed, 16 May 2018 02:48:50 +0000 (02:48 +0000)]
Fix LSR compile time hang.

Summary:
Limit number of reassociations in GenerateReassociationsImpl.

Reviewers: qcolombet, mkazantsev

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

From: Evgeny Stupachenko <evstupac@gmail.com>
                         <evgeny.v.stupachenko@intel.com>
llvm-svn: 332426

6 years agoFix 32-bit buildbots.
Richard Smith [Wed, 16 May 2018 01:08:07 +0000 (01:08 +0000)]
Fix 32-bit buildbots.

llvm-svn: 332425

6 years agoremove output xml incase it is leftover from another run
Chris Matthews [Wed, 16 May 2018 00:37:00 +0000 (00:37 +0000)]
remove output xml incase it is leftover from another run

llvm-svn: 332424

6 years agoUse not to catch unexpected pass as well as remove old test results
Chris Matthews [Wed, 16 May 2018 00:33:29 +0000 (00:33 +0000)]
Use not to catch unexpected pass as well as remove old test results

As per review feedback, make sure we rm temp files, and make the return
code checking for lit more specific.

llvm-svn: 332423

6 years ago[analyzer] Do not crash on callback for call_once passed by value
George Karpenkov [Wed, 16 May 2018 00:29:13 +0000 (00:29 +0000)]
[analyzer] Do not crash on callback for call_once passed by value

https://bugs.llvm.org/show_bug.cgi?id=37312
rdar://40270582

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

llvm-svn: 332422

6 years agoRevert commits r332160, r332164, r332236.
Douglas Yung [Wed, 16 May 2018 00:27:43 +0000 (00:27 +0000)]
Revert commits r332160, r332164, r332236.

It was decided this is the wrong approach to fix this issue.

llvm-svn: 332421

6 years agoARM: Remove unnecessary argument. NFCI.
Peter Collingbourne [Wed, 16 May 2018 00:21:47 +0000 (00:21 +0000)]
ARM: Remove unnecessary argument. NFCI.

IsLittleEndian is already a field of ARMAsmBackend.

llvm-svn: 332420

6 years agoARM: Deduplicate code and remove unnecessary declaration. NFCI.
Peter Collingbourne [Wed, 16 May 2018 00:21:31 +0000 (00:21 +0000)]
ARM: Deduplicate code and remove unnecessary declaration. NFCI.

llvm-svn: 332419

6 years ago[Debugify] Fix test failing after r332416
Anastasis Grammenos [Wed, 16 May 2018 00:11:52 +0000 (00:11 +0000)]
[Debugify] Fix test failing after r332416

I missed a test that needed an update.

Failing bot: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/30071

llvm-svn: 332418

6 years ago[analyzer] Make plist-html diagnostic consumer produce multi-file reports.
Artem Dergachev [Wed, 16 May 2018 00:11:24 +0000 (00:11 +0000)]
[analyzer] Make plist-html diagnostic consumer produce multi-file reports.

Previously plist-html output produced multi-file HTML reports
but only single-file Plist reports.

Change plist-html output to produce multi-file Plist reports as well.

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

llvm-svn: 332417

6 years ago[Debugfiy] Print the pass name next to the result
Anastasis Grammenos [Tue, 15 May 2018 23:38:05 +0000 (23:38 +0000)]
[Debugfiy] Print the pass name next to the result

CheckDebugify now prints the pass name right next to the result of the check.

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

llvm-svn: 332416

6 years ago[MachineOutliner] Add optsize markings to outlined functions.
Eli Friedman [Tue, 15 May 2018 23:36:46 +0000 (23:36 +0000)]
[MachineOutliner] Add optsize markings to outlined functions.

It doesn't matter much this late in the pipeline, but one place that
does check for it is the function alignment code.

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

llvm-svn: 332415

6 years ago[libunwind][MIPS] Support MIPS floating-point registers for hard-float ABIs.
John Baldwin [Tue, 15 May 2018 22:44:56 +0000 (22:44 +0000)]
[libunwind][MIPS] Support MIPS floating-point registers for hard-float ABIs.

Summary:
For MIPS ABIs with 64-bit floating point registers including newabi
and O32 with 64-bit floating point registers, just save and restore the
32 floating-point registers as doubles.

For O32 MIPS with 32-bit floating-point registers, save and restore the
individual floating-point registers as "plain" registers.  These registers
are encoded as floats rather than doubles, but the DWARF unwinder
assumes that floating-point registers are stored as doubles when reading
them from memory (via AddressSpace::getDouble()).  Treating the
registers as "normal" registers instead causes the DWARF unwinder to
fetch them from memory as a 32-bit register.  This does mean that for
O32 with 32-bit floating-point registers unw_get_fpreg() and
unw_set_fpreg() do not work.  One would have to use unw_get_reg()
and unw_set_reg() instead.  However, DWARF unwinding works
correctly as the DWARF CFI emits records for individual 32-bit
floating-point registers even when they are treated as doubles stored
in paired registers.  If the lack of unw_get/set_fpreg() becomes a pressing
need in the future for O32 MIPS we could add in special handling to
make it work.

Reviewers: sdardis, compnerd

Reviewed By: sdardis

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

llvm-svn: 332414

6 years agoEmit an error when include <atomic> after <stdatomic.h>
Volodymyr Sapsai [Tue, 15 May 2018 22:38:31 +0000 (22:38 +0000)]
Emit an error when include <atomic> after <stdatomic.h>

C11 defines `kill_dependency` as a macro in <stdatomic.h>. When you
include <atomic> after <stdatomic.h>, the macro clashes with
`std::kill_dependency` and causes multiple errors. Explicit error should
help in diagnosing those errors.

No change for working code that includes <atomic> before <stdatomic.h>.

rdar://problem/27435938

Reviewers: rsmith, EricWF, mclow.lists, jfb

Reviewed By: jfb

Subscribers: jfb, jkorous-apple, christof, bumblebritches57, JonChesterfield, smeenai, cfe-commits

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

llvm-svn: 332413

6 years ago[WebAssembly] Fix R_WEBASSEMBLY_FUNCTION_OFFSET_I32 relocation entries
Sam Clegg [Tue, 15 May 2018 22:27:50 +0000 (22:27 +0000)]
[WebAssembly] Fix R_WEBASSEMBLY_FUNCTION_OFFSET_I32 relocation entries

Fixes: lld: warning: unexpected existing value for R_WEBASSEMBLY_FUNCTION_OFFSET_I32: existing=839 expected=838

The existing solution is trying to erroneously recover correct offset of
the function code from the body (which is not a function segment that
includes its size, locals, and code).

The D46763 is trying to maintain the offset of the function code
allowing properly calculate the new relocation entry.

Patch by Yury Delendik

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

llvm-svn: 332412

6 years ago[Attr] Don't print implicit attributes
Joel E. Denny [Tue, 15 May 2018 22:16:47 +0000 (22:16 +0000)]
[Attr] Don't print implicit attributes

Fixes bug reported at:

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180514/228390.html

Reviewed by: aaron.ballman

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

llvm-svn: 332411

6 years ago[X86][SSE] Add tests for vector rotates by splat variable.
Simon Pilgrim [Tue, 15 May 2018 22:11:51 +0000 (22:11 +0000)]
[X86][SSE] Add tests for vector rotates by splat variable.

llvm-svn: 332410

6 years ago[AMDGPU] Fix handling of void types in isLegalAddressingMode
Stanislav Mekhanoshin [Tue, 15 May 2018 22:07:51 +0000 (22:07 +0000)]
[AMDGPU] Fix handling of void types in isLegalAddressingMode

It is legal for the type passed to isLegalAddressingMode to be
unsized or, more specifically, VoidTy. In this case, we must
check the legality of load / stores for all legal types. Directly
trying to call getTypeStoreSize is incorrect, and leads to breakage
in e.g. Loop Strength Reduction. This change guards against that
behaviour.

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

llvm-svn: 332409

6 years ago[lld] Make helpers static. NFC.
Benjamin Kramer [Tue, 15 May 2018 22:01:54 +0000 (22:01 +0000)]
[lld] Make helpers static. NFC.

llvm-svn: 332408

6 years ago[InstCombine] fix binop (shuffle X), C --> shuffle (binop X, C') to check uses
Sanjay Patel [Tue, 15 May 2018 22:00:37 +0000 (22:00 +0000)]
[InstCombine] fix binop (shuffle X), C --> shuffle (binop X, C') to check uses

llvm-svn: 332407

6 years ago[WebAssembly] Provide WasmFunction content offset information.
Sam Clegg [Tue, 15 May 2018 21:49:58 +0000 (21:49 +0000)]
[WebAssembly] Provide WasmFunction content offset information.

WasmObjectWriter mostly operates with function segments offsets that do
not include their size fields. WasmObjectFile needs to have and provide
this information to the lld to maintain proper
R_WEBASSEMBLY_FUNCTION_OFFSET_I32 relocations entries.

Patch by Yury Delendik

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

llvm-svn: 332406

6 years ago[Documentation] Fix Release Notes format issues.
Eugene Zelenko [Tue, 15 May 2018 21:45:01 +0000 (21:45 +0000)]
[Documentation] Fix Release Notes format issues.

llvm-svn: 332405

6 years agoAMDGPU: Add a missing test for the 128-bit local addr space option
Marek Olsak [Tue, 15 May 2018 21:41:57 +0000 (21:41 +0000)]
AMDGPU: Add a missing test for the 128-bit local addr space option

This should have been pushed with:
  "AMDGPU: enable 128-bit for local addr space under an option"

llvm-svn: 332404

6 years agoStructurizeCFG: fix inverting conditions
Marek Olsak [Tue, 15 May 2018 21:41:55 +0000 (21:41 +0000)]
StructurizeCFG: fix inverting conditions

Author: Samuel Pitoiset

Without this patch, it appears to me that we are selecting
the wrong operand when inverting conditions. In the attached
test, it will select %tmp3 instead of %tmp4. To fix it, just
use 'A' as everywhere.

This fixes a regression introduced by
"[PatternMatch] define m_Not using m_Xor and cst_pred_ty"

https://reviews.llvm.org/D46351

llvm-svn: 332403

6 years ago[msan] Instrument masked.store, masked.load intrinsics.
Evgeniy Stepanov [Tue, 15 May 2018 21:28:25 +0000 (21:28 +0000)]
[msan] Instrument masked.store, masked.load intrinsics.

Summary: Instrument masked store/load intrinsics.

Reviewers: kcc

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 332402

6 years agoDon't produce a redundant "auto type is incompatible with C++98" on every lambda...
Richard Smith [Tue, 15 May 2018 21:27:30 +0000 (21:27 +0000)]
Don't produce a redundant "auto type is incompatible with C++98" on every lambda with no explicit return type.

We already warned about the lambda, and we don't have a source location for the imagined "auto" anyway.

llvm-svn: 332401

6 years agoMove helper classes into anonymous namespaces. NFCI.
Benjamin Kramer [Tue, 15 May 2018 21:26:47 +0000 (21:26 +0000)]
Move helper classes into anonymous namespaces. NFCI.

llvm-svn: 332400

6 years ago[InstCombine] clean up code for binop-shuffle transforms; NFCI
Sanjay Patel [Tue, 15 May 2018 21:23:58 +0000 (21:23 +0000)]
[InstCombine] clean up code for binop-shuffle transforms; NFCI

llvm-svn: 332399

6 years ago[MinGW] Handle the GNU ld option -Map for outputting a linker map
Martin Storsjo [Tue, 15 May 2018 21:12:29 +0000 (21:12 +0000)]
[MinGW] Handle the GNU ld option -Map for outputting a linker map

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

llvm-svn: 332398

6 years agoAddress post-commit review comments after r328731. NFC.
Akira Hatanaka [Tue, 15 May 2018 21:00:30 +0000 (21:00 +0000)]
Address post-commit review comments after r328731. NFC.

- Define a function (canPassInRegisters) that determines whether a
record can be passed in registers based on language rules and
target-specific ABI rules.

- Set flag RecordDecl::ParamDestroyedInCallee to true in MSVC mode and
remove ASTContext::isParamDestroyedInCallee, which is no longer needed.

- Use the same type (unsigned) for RecordDecl's bit-field members.

For more background, see the following discussions that took place on
cfe-commits.

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180326/223498.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180402/223688.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180409/224754.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226494.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180507/227647.html

llvm-svn: 332397

6 years ago[llvm-objcopy] Add --only-keep-debug as a noop
Jake Ehrlich [Tue, 15 May 2018 20:53:53 +0000 (20:53 +0000)]
[llvm-objcopy] Add --only-keep-debug as a noop

This option just keeps being a problem and really needs to be implemented
in some fashion. Implementing it properly requires some kind of
"replaceSectionReference" method because all the existing links need to be
maintained. The desired behavior is just for allocated sections to become
NOBITS but actually implementing that is rather tricky due to the current
design of llvm-objcopy. However converting allocated sections to NOBITS is
just an optimization and not something debuggers need. Debuggers can debug
a stripped executable and take an unstripped executable for that stripped
executable as input. Additionally allocated sections account for a very
small part of debug binaries so this optimization is quite small. I propose
that for the time being we implement this as a NOP so that people can use
llvm-objcopy where they need to, just in a sub-optimal way.

This option has already blocked a lot of people and its currently blocking me.

llvm-svn: 332396

6 years ago[AArch64] Improve single vector lane unscaled stores
Evandro Menezes [Tue, 15 May 2018 20:41:12 +0000 (20:41 +0000)]
[AArch64] Improve single vector lane unscaled stores

When storing the 0th lane of a vector, use a simpler and usually more
efficient scalar store instead.  In this case, also using the unscaled
offset.

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

llvm-svn: 332394

6 years ago[InstCombine] add more tests for binop-shuffle; NFC
Sanjay Patel [Tue, 15 May 2018 20:34:09 +0000 (20:34 +0000)]
[InstCombine] add more tests for binop-shuffle; NFC

The splat pattern is part of PR37463:
https://bugs.llvm.org/show_bug.cgi?id=37463

llvm-svn: 332393

6 years ago[DAGCombine] Move load checks on store of loads into candidate
Nirav Dave [Tue, 15 May 2018 20:31:53 +0000 (20:31 +0000)]
[DAGCombine] Move load checks on store of loads into candidate
search. NFCI.

Migrate single-use and non-volatility, non-indexed requirements on
stores of immediate store values to candidate collection pass from
later stage.

llvm-svn: 332392

6 years agoNios2: Unbreak build.
Peter Collingbourne [Tue, 15 May 2018 20:21:58 +0000 (20:21 +0000)]
Nios2: Unbreak build.

llvm-svn: 332391

6 years ago[llvm-mca] Introduce a pipeline Stage class and FetchStage.
Matt Davis [Tue, 15 May 2018 20:21:04 +0000 (20:21 +0000)]
[llvm-mca] Introduce a pipeline Stage class and FetchStage.

Summary:
    This is just an idea, really two ideas.  I expect some push-back,
    but I realize that posting a diff is the most comprehensive way to express
    these concepts.

    This patch introduces a Stage class which represents the
    various stages of an instruction pipeline.  As a start, I have created a simple
    FetchStage that is based on existing logic for how MCA produces
    instructions, but now encapsulated in a Stage.  The idea should become more concrete
    once we introduce additional stages.  The idea being, that when a stage completes,
    the next stage in the pipeline will be executed.  Stages are chained together
    as a singly linked list to closely model a real pipeline. For now there is only one stage,
    so the stage-to-stage flow of instructions isn't immediately obvious.

    Eventually, Stage will also handle event notifications, but that functionality
    is not complete, and not destined for this patch.  Ideally, an interested party
    can register for notifications from a particular stage.  Callbacks will be issued to
    these listeners at various points in the execution of the stage.
    For now, eventing functionality remains similar to what it has been in mca::Backend.
    We will be building-up the Stage class as we move on, such as adding debug output.

    This patch also removes the unique_ptr<Instruction> return value from
    InstrBuilder::createInstruction.  An Instruction pointer is still produced,
    but now it's up to the caller to decide how that item should be managed post-allocation
    (e.g., smart pointer).  This allows the Fetch stage to create instructions and
    manage the lifetime of those instructions as it wishes, and not have to be bound to any
    specific managed pointer type.  Other callers of createInstruction might have different
    requirements, and thus can manage the pointer to fit their needs.  Another idea would be to push the
   ownership to the RCU.

    Currently, the FetchStage will wrap the Instruction
    pointer in a shared_ptr.  This allows us to remove the Instruction container in
    Backend, which was probably going to disappear, or move, at some point anyways.
    Note that I did run these changes through valgrind, to make sure we are not leaking
    memory.  While the shared_ptr comes with some additional overhead it relieves us
    from having to manage a list of generated instructions, and/or make lookup calls
    to remove the instructions.

    I realize that both the Stage class and the Instruction pointer management
    (mentioned directly above) are separate but related ideas, and probably should
    land as separate patches; I am happy to do that if either idea is decent.
    The main reason these two ideas are together is that
    Stage::execute() can mutate an InstRef. For the fetch stage, the InstRef is populated
    as the primary action of that stage (execute()).  I didn't want to change the Stage interface
    to support the idea of generating an instruction.  Ideally, instructions are to
    be pushed through the pipeline.  I didn't want to draw too much of a
    specialization just for the fetch stage.  Excuse the word-salad.

Reviewers: andreadb, courbet, RKSimon

Reviewed By: andreadb

Subscribers: llvm-commits, mgorny, javed.absar, tschuett, gbedwell

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

llvm-svn: 332390

6 years ago[x86][eflags] Fix PR37431 by teaching the EFLAGS copy lowering to
Chandler Carruth [Tue, 15 May 2018 20:16:57 +0000 (20:16 +0000)]
[x86][eflags] Fix PR37431 by teaching the EFLAGS copy lowering to
specially handle SETB_C* pseudo instructions.

Summary:
While the logic here is somewhat similar to the arithmetic lowering, it
is different enough that it made sense to have its own function.
I actually tried a bunch of different optimizations here and none worked
well so I gave up and just always do the arithmetic based lowering.

Looking at code from the PR test case, we actually pessimize a bunch of
code when generating these. Because SETB_C* pseudo instructions clobber
EFLAGS, we end up creating a bunch of copies of EFLAGS to feed multiple
SETB_C* pseudos from a single set of EFLAGS. This in turn causes the
lowering code to ruin all the clever code generation that SETB_C* was
hoping to achieve. None of this is needed. Whenever we're generating
multiple SETB_C* instructions from a single set of EFLAGS we should
instead generate a single maximally wide one and extract subregs for all
the different desired widths. That would result in substantially better
code generation. But this patch doesn't attempt to address that.

The test case from the PR is included as well as more directed testing
of the specific lowering pattern used for these pseudos.

Reviewers: craig.topper

Subscribers: sanjoy, mcrosier, llvm-commits, hiraditya

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

llvm-svn: 332389

6 years agoUse perfect forwarding to deduplicate code in unit test. NFC.
Benjamin Kramer [Tue, 15 May 2018 20:08:15 +0000 (20:08 +0000)]
Use perfect forwarding to deduplicate code in unit test. NFC.

llvm-svn: 332388

6 years agoAMDGPU: Fix v_dot{4, 8}* instruction encoding
Konstantin Zhuravlyov [Tue, 15 May 2018 19:32:47 +0000 (19:32 +0000)]
AMDGPU: Fix v_dot{4, 8}* instruction encoding

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

llvm-svn: 332387

6 years ago[llvm-rc] Add support for the optional CLASS statement for dialogs
Martin Storsjo [Tue, 15 May 2018 19:21:28 +0000 (19:21 +0000)]
[llvm-rc] Add support for the optional CLASS statement for dialogs

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

llvm-svn: 332386

6 years ago[MemorySSA] Don't sort IDF blocks.
Michael Zolotukhin [Tue, 15 May 2018 18:40:29 +0000 (18:40 +0000)]
[MemorySSA] Don't sort IDF blocks.

Summary:
After r332167 we started to sort the IDF blocks inside IDF calculation, so
there is no need to re-sort them on the user site. The test changes are due to
a slightly different order we're using now (originally we used DFSInNumber and
now the blocks are sorted by a pair (LevelFromRoot, DFSInNumber)).

Reviewers: dberlin, mgrang

Subscribers: Prazek, hiraditya, george.burgess.iv, llvm-commits

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

llvm-svn: 332385