platform/upstream/llvm.git
4 years agoInclude SmallVector.h in IPO.h to fix modules build [NFC]
Raphael Isemann [Thu, 30 Apr 2020 14:33:54 +0000 (16:33 +0200)]
Include SmallVector.h in IPO.h to fix modules build [NFC]

This file currently doesn't compile under LLVM_ENABLE_MODULES as SmallVector
is used in this header but is never forward declared or included in any way.
Let's include SmallVector.h instead and get rid of the SmallVectorImpl fwd
declaration which is now no longer necessary.

4 years ago[AMDGPU] Use int and unsigned instead of other 32-bit integer types. NFC.
Jay Foad [Thu, 30 Apr 2020 14:05:40 +0000 (15:05 +0100)]
[AMDGPU] Use int and unsigned instead of other 32-bit integer types. NFC.

4 years agoRevert an accidental commit of four AddressSanitizer refactor CLs
Alexander Potapenko [Thu, 30 Apr 2020 14:15:43 +0000 (16:15 +0200)]
Revert an accidental commit of four AddressSanitizer refactor CLs

I couldn't make arc land the changes properly, for some reason they all got
squashed. Reverting them now to land cleanly.

Summary: This reverts commit cfb5f89b62f885a7a50b1dd49a0cb5532fc75176.

Reviewers: kcc, thejh

Subscribers:

4 years ago[AIX] emit .extern and .weak directive linkage
diggerlin [Thu, 30 Apr 2020 13:53:41 +0000 (09:53 -0400)]
[AIX] emit .extern and .weak directive linkage

SUMMARY:

emit .extern and .weak directive linkage

Reviewers: hubert.reinterpretcast, Jason Liu
Subscribers: wuzish, nemanjai, hiraditya

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

4 years ago[X86][SSE] Add bitselect tests where the mask is a broadcasted scalar
Simon Pilgrim [Thu, 30 Apr 2020 13:45:06 +0000 (14:45 +0100)]
[X86][SSE] Add bitselect tests where the mask is a broadcasted scalar

Shows issue that the IsNot() test can't see through shuffles/broadcasts

4 years ago[clangd] Second attempt at fixing VS2019 build bots
Kadir Cetinkaya [Thu, 30 Apr 2020 13:37:07 +0000 (15:37 +0200)]
[clangd] Second attempt at fixing VS2019 build bots

4 years ago[AddressSanitizer] Refactor ClDebug{Min,Max} handling
Jann Horn [Thu, 30 Apr 2020 09:05:01 +0000 (11:05 +0200)]
[AddressSanitizer] Refactor ClDebug{Min,Max} handling

Summary:
A following commit will split the loop over ToInstrument into two.
To avoid having to duplicate the condition for suppressing instrumentation
sites based on ClDebug{Min,Max}, refactor it out into a new function.

While we're at it, we can also avoid the indirection through
NumInstrumented for setting FunctionModified.

This is patch 1/4 of a patch series:
https://reviews.llvm.org/D77616 [PATCH 1/4] [AddressSanitizer] Refactor ClDebug{Min,Max} handling
https://reviews.llvm.org/D77617 [PATCH 2/4] [AddressSanitizer] Split out memory intrinsic handling
https://reviews.llvm.org/D77618 [PATCH 3/4] [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
https://reviews.llvm.org/D77619 [PATCH 4/4] [AddressSanitizer] Instrument byval call arguments

Reviewers: kcc, glider

Reviewed By: glider

Subscribers: jfb, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir] Use memory effect to detecting allocation
Lei Zhang [Mon, 27 Apr 2020 16:31:29 +0000 (12:31 -0400)]
[mlir] Use memory effect to detecting allocation

This commit marks AllocLikeOp as MemAlloc in StandardOps.

Also in Linalg dependency analysis use memory effect to detect
allocation. This allows the dependency analysis to be more
general and recognize other allocation-like operations.

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

4 years ago[InstCombine] add tests for bitcast+inselt; NFC
Sanjay Patel [Thu, 30 Apr 2020 13:11:29 +0000 (09:11 -0400)]
[InstCombine] add tests for bitcast+inselt; NFC

4 years ago[InstCombine] update auto-generated test checks; NFC
Sanjay Patel [Thu, 30 Apr 2020 12:38:36 +0000 (08:38 -0400)]
[InstCombine] update auto-generated test checks; NFC

4 years ago[NFC][clang] Replace raw new/delete with unique_ptr to store ABIInfo in TargetCodeGenInfo
jasonliu [Thu, 30 Apr 2020 02:50:57 +0000 (02:50 +0000)]
[NFC][clang] Replace raw new/delete with unique_ptr to store ABIInfo in TargetCodeGenInfo

Use unique_ptr to manage the lifetime of ABIInfo member inside TargetCodeGenInfo.

Reviewed By: hubert.reinterpretcast

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

4 years ago[clangd] Fix VS2019 build bots too
Kadir Cetinkaya [Thu, 30 Apr 2020 11:57:42 +0000 (13:57 +0200)]
[clangd] Fix VS2019 build bots too

4 years ago[DAGCombine] Move the remaining X86 funnel shift patterns to DAGCombine
Simon Pilgrim [Thu, 30 Apr 2020 11:53:05 +0000 (12:53 +0100)]
[DAGCombine] Move the remaining X86 funnel shift patterns to DAGCombine

X86 matches several 'shift+xor' funnel shift patterns:

  fold (or (srl (srl x1, 1), (xor y, 31)), (shl x0, y))  -> (fshl x0, x1, y)
  fold (or (shl (shl x0, 1), (xor y, 31)), (srl x1, y))  -> (fshr x0, x1, y)
  fold (or (shl (add x0, x0), (xor y, 31)), (srl x1, y)) -> (fshr x0, x1, y)

These patterns are also what we end up with the proposed expansion changes in D77301.

This patch moves these to DAGCombine's generic MatchFunnelPosNeg.

All existing X86 test cases still pass, and we just have a small codegen change in pr32282.ll.

Reviewed By: @spatel

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

4 years ago[DAG] Add TODO comment regarding ADD(X,X) -> SHL(X,1) canonicalization
Simon Pilgrim [Thu, 30 Apr 2020 10:22:01 +0000 (11:22 +0100)]
[DAG] Add TODO comment regarding ADD(X,X) -> SHL(X,1) canonicalization

As discussed on D78935

4 years ago[InstCombine] add tests for FP->int->FP->FP casting; NFC
Sanjay Patel [Wed, 29 Apr 2020 18:45:50 +0000 (14:45 -0400)]
[InstCombine] add tests for FP->int->FP->FP casting; NFC

4 years agoFix silly mistake in 31c09d03a1f [AMDGPU] Remove WaitcntBrackets::MixedPendingEvents...
Jay Foad [Thu, 30 Apr 2020 10:40:57 +0000 (11:40 +0100)]
Fix silly mistake in 31c09d03a1f [AMDGPU] Remove WaitcntBrackets::MixedPendingEvents[]. NFC.

4 years ago[globalopt] Don't emit DWARF fragments for members
David Spickett [Thu, 23 Apr 2020 13:40:57 +0000 (14:40 +0100)]
[globalopt] Don't emit DWARF fragments for members
of a struct that cover the whole struct

This can happen when the rest of the
members of are zero length. Following
the same pattern applied to the SROA
pass in:
d7f6f1636d53c3e2faf55cdf20fbb44a1a149df1

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

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

4 years ago[RISCV][NFC] Remove Duplicated F Extension Patterns
Sam Elliott [Thu, 30 Apr 2020 09:38:35 +0000 (10:38 +0100)]
[RISCV][NFC] Remove Duplicated F Extension Patterns

4 years ago[AArch64][SVE] Remove unused FP reduction intrinsic definitions
Cullen Rhodes [Tue, 28 Apr 2020 10:55:07 +0000 (10:55 +0000)]
[AArch64][SVE] Remove unused FP reduction intrinsic definitions

Summary: FP reductions no longer use these intrinsics since D78723.

Reviewers: efriedma, sdesmalen

Reviewed By: efriedma, sdesmalen

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

4 years ago[AArch64][SVE] Custom lowering of floating-point reductions
Cullen Rhodes [Tue, 21 Apr 2020 10:44:46 +0000 (10:44 +0000)]
[AArch64][SVE] Custom lowering of floating-point reductions

Summary:
This patch implements custom floating-point reduction ISD nodes that
have vector results, which are used to lower the following intrinsics:

    * llvm.aarch64.sve.fadda
    * llvm.aarch64.sve.faddv
    * llvm.aarch64.sve.fmaxv
    * llvm.aarch64.sve.fmaxnmv
    * llvm.aarch64.sve.fminv
    * llvm.aarch64.sve.fminnmv

SVE reduction instructions keep their result within a vector register,
with all other bits set to zero.

Changes in this patch were implemented by Paul Walker and Sander de
Smalen.

Reviewers: sdesmalen, efriedma, rengolin

Reviewed By: efriedma

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

4 years ago[CodeGen] Add support for inserting elements into scalable vectors
David Sherwood [Fri, 24 Apr 2020 06:55:53 +0000 (07:55 +0100)]
[CodeGen] Add support for inserting elements into scalable vectors

Summary:
This patch tries to ensure that we do something sensible when
generating code for the ISD::INSERT_VECTOR_ELT DAG node when operating
on scalable vectors. Previously we always returned 'undef' when
inserting an element into an out-of-bounds lane index, whereas now
we only do this for fixed length vectors. For scalable vectors it
is assumed that the backend will do the right thing in the same way
that we have to deal with variable lane indices.

In this patch I have permitted a few basic combinations for scalable
vector types where it makes sense, but in general avoided most cases
for now as they currently require the use of BUILD_VECTOR nodes.

This patch includes tests for all scalable vector types when inserting
into lane 0, but I've only included one or two vector types for other
cases such as variable lane inserts.

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

4 years ago[clangd][Hover] Get rid of unused private field in Paragraph
Kadir Cetinkaya [Thu, 30 Apr 2020 10:13:12 +0000 (12:13 +0200)]
[clangd][Hover] Get rid of unused private field in Paragraph

4 years ago[clang-format] Fix a bug causing BeforeLambdaBody to affect brace initialiser formatting
mydeveloperday [Thu, 30 Apr 2020 10:11:34 +0000 (11:11 +0100)]
[clang-format] Fix a bug causing BeforeLambdaBody to affect brace initialiser formatting

Summary: The condition added with the new setting checked whether the character was an l-brace, not specifically a lambda l-brace, when deciding whether it was possible to break before it or not. This caused the l-brace of some initialiser lists to break onto the next line with the first argument of the initialiser list when the setting was enabled.

Reviewed By: MyDeveloperDay, Wawha

Patch By: duncan-llvm

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

4 years ago[clang-format] Correct the AfterControlStatement configuration option output style
mydeveloperday [Thu, 30 Apr 2020 10:05:02 +0000 (11:05 +0100)]
[clang-format] Correct the AfterControlStatement configuration option output style

Summary:
Due to the order in which the enum cases were defined the old options which were retained for backwards compatibility were being preferred over the new options when printing with the --dump-config option.

Reviewers: MyDeveloperDay

Reviewed By: MyDeveloperDay

Patch By:  duncan-llvm

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

4 years ago[clang-format] Fix lambda with ellipsis in return type
mydeveloperday [Thu, 30 Apr 2020 10:02:42 +0000 (11:02 +0100)]
[clang-format] Fix lambda with ellipsis in return type

Summary:
BTW my actual code that hit this issue is like

```
[a, b = std::move(b)](auto &&... c) mutable -> std::invoke_result_t<decltype(b), decltype(c)...> { /* omitted */ }
```

where this explicit return type is required for SFINAE.

Reviewed By: krasimir, MyDeveloperDay

Patch By: johnchen902

Subscribers: krasimir, dexonsmith, cfe-commits

Tags: #clang-format, #clang

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

4 years ago[clang-format] [PR45357] Fix issue found with operator spacing
mydeveloperday [Thu, 30 Apr 2020 09:55:59 +0000 (10:55 +0100)]
[clang-format] [PR45357] Fix issue found with operator spacing

Summary:
This is a tentative fix for https://bugs.llvm.org/show_bug.cgi?id=45357

Spaces seem to be introduced between * and * due to changes brought in for {D69573}

Reviewers: sylvestre.ledru, mitchell-stellar, sammccall, Abpostelnicu, krasimir, jbcoe

Reviewed By: Abpostelnicu

Subscribers: tstellar, hans, Abpostelnicu, cfe-commits

Tags: #clang, #clang-format

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

4 years ago[clang-format] NFC Correct clang-format headers file so documentation can be once...
mydeveloperday [Thu, 30 Apr 2020 09:47:23 +0000 (10:47 +0100)]
[clang-format] NFC Correct clang-format headers file so documentation can be once again autogenerated

Summary:
`ClangFormatStyleOptions.rst` should ALWAYS be autogenerated from Format.h using `clang/docs/tools/dump_format_style.py` if not its liable to get removed leaving options undocumented.

This revision reworks the documentation for {D73354} {D73768} to ensure we can continue to regenerated

Fix other minor changes that ensure the documentation remains consistent (Format.h obviously got re clang-formatted after the rst had been regenerated previously)

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

4 years ago[docs][llvm-cxxfilt] Fix indentation in rst file
James Henderson [Thu, 30 Apr 2020 09:40:11 +0000 (10:40 +0100)]
[docs][llvm-cxxfilt] Fix indentation in rst file

This makes it consistent throughout the options, although the end result
is unchanged.

4 years agoFix spurious warning in ExtensionDependencies.inc [nfc]
serge-sans-paille [Thu, 30 Apr 2020 08:14:37 +0000 (10:14 +0200)]
Fix spurious warning in ExtensionDependencies.inc [nfc]

4 years ago[MLIR] Add isa<> support for Dialects.
Tres Popp [Wed, 29 Apr 2020 13:45:50 +0000 (15:45 +0200)]
[MLIR] Add isa<> support for Dialects.

Summary:
The purpose of this is to aid in having code behave differently on
Operations based on their Dialect without caring about the specific
Op. Additionally this is consistent with most other types supporting
isa<> and dyn_cast<>.

A Dialect matches isa<> based only on its namespace and relies on each
namespace being unique.

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

4 years ago[BPI][NFC] IRCE shoud qequest BPI through analysis manager.
Evgeniy Brevnov [Wed, 29 Apr 2020 11:42:36 +0000 (18:42 +0700)]
[BPI][NFC] IRCE shoud qequest BPI through analysis manager.

Summary: There is no need to create BPI explicitly. It should be requested through AM in a normal way.

Reviewers: skatkov

Reviewed By: skatkov

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[clangd] Fix windows build bots without rvalue refs
Kadir Cetinkaya [Thu, 30 Apr 2020 08:24:39 +0000 (10:24 +0200)]
[clangd] Fix windows build bots without rvalue refs

4 years ago[Debuginfo][NFC] findRecursively: Replace std::vector by SmallVector
Alexey Lapshin [Wed, 29 Apr 2020 17:00:31 +0000 (20:00 +0300)]
[Debuginfo][NFC] findRecursively: Replace std::vector by SmallVector

Summary:
Change std::vector to SmallVector to prevent re-allocations and to
have small pre-allocated storage.

Reviewers: clayborg, dblaikie

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

4 years ago[AMDGPU] Simplify loops in SIInsertWaitcnts::generateWaitcntInstBefore
Jay Foad [Tue, 28 Apr 2020 07:54:19 +0000 (08:54 +0100)]
[AMDGPU] Simplify loops in SIInsertWaitcnts::generateWaitcntInstBefore

The loops over use operands and def operands were mostly identical.
Combine them, and likewise for load memoperands and store memoperands.
NFC.

4 years ago[AMDGPU] Remove Def argument from WaitcntBrackets::getRegInterval. NFC.
Jay Foad [Mon, 27 Apr 2020 19:14:52 +0000 (20:14 +0100)]
[AMDGPU] Remove Def argument from WaitcntBrackets::getRegInterval. NFC.

It's cleaner to check this in the callers instead.

4 years ago[clangd] Make use of URIs in FileShardedIndex
Kadir Cetinkaya [Wed, 29 Apr 2020 09:21:14 +0000 (11:21 +0200)]
[clangd] Make use of URIs in FileShardedIndex

Summary:
This makes FileShardedIndex more robust and gets rid of the need for a
URIToFileCache, as it is done by the callers now and it is only once per file,
rather than once per symbol.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[MC] Move MCInstrAnalysis::evaluateBranch to X86MCInstrAnalysis::evaluateBranch
Fangrui Song [Thu, 30 Apr 2020 06:17:14 +0000 (23:17 -0700)]
[MC] Move MCInstrAnalysis::evaluateBranch to X86MCInstrAnalysis::evaluateBranch

The generic implementation is actually specific to x86. It assumes the
offset is relative to the end of the instruction and the immediate is
not scaled (which is false on most RISC).

4 years ago[BPI] Incorrect probability reported in case of mulptiple edges.
Evgeniy Brevnov [Wed, 29 Apr 2020 07:08:01 +0000 (14:08 +0700)]
[BPI] Incorrect probability reported in case of mulptiple edges.

Summary:
By design 'BranchProbabilityInfo:: getEdgeProbability(const BasicBlock *Src, const BasicBlock *Dst) const' should return sum of probabilities over all edges from Src to Dst. Current implementation is buggy and returns 1/num_of_successors if probabilities are not explicitly set.

Note current implementation of BPI printing has an issue as well and annotates each edge with sum of probabilities over all ages from one basic block to another. That's why 30% probability reported (instead of 10%) in the lit test. This is not urgent issue since only printing is affected.
Note also current implementation assumes that either all or none edges have probabilities set. This is not the only place which uses such assumption. At least we should assert that in verifier. In addition we can think on a more robust API of BPI which would prevent situations.

Reviewers: skatkov, yrouban, taewookoh

Reviewed By: skatkov

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[BPI][NFC] Reuse post dominantor tree from analysis manager when available
Evgeniy Brevnov [Tue, 28 Apr 2020 09:31:20 +0000 (16:31 +0700)]
[BPI][NFC] Reuse post dominantor tree from analysis manager when available

Summary: Currenlty BPI unconditionally creates post dominator tree each time. While this is not incorrect we can save compile time by reusing existing post dominator tree (when it's valid) provided by analysis manager.

Reviewers: skatkov, taewookoh, yrouban

Reviewed By: skatkov

Subscribers: hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[lit] Provide extension API for custom result categories
Julian Lettner [Tue, 14 Apr 2020 22:55:38 +0000 (15:55 -0700)]
[lit] Provide extension API for custom result categories

The lnt test suite defines custom result codes [1].  Support those via
an extension API instead of "by accident", which should offer the
advantage of properly handling them when we print test results.

[1] https://reviews.llvm.org/D77986

Reviewed By: Meinersbur

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

4 years agoMake wrong preallocated arg count verifier error clearer
Arthur Eubanks [Wed, 29 Apr 2020 20:50:19 +0000 (13:50 -0700)]
Make wrong preallocated arg count verifier error clearer

Reviewers: rnk

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Vector] Provide progressive lowering of masked n-D vector transfers
Nicolas Vasilache [Thu, 30 Apr 2020 01:12:10 +0000 (21:12 -0400)]
[mlir][Vector] Provide progressive lowering of masked n-D vector transfers

This revision allows masked vector transfers with m-D buffers and n-D vectors to
progressively lower to m-D buffer and 1-D vector transfers.

For a vector.transfer_read, assuming a `memref<(leading_dims) x (major_dims) x (minor_dims) x type>` and a `vector<(minor_dims) x type>` are involved in the transfer, this generates pseudo-IR resembling:
```
     if (any_of(%ivs_major + %offsets, <, major_dims)) {
       %v = vector_transfer_read(
         {%offsets_leading, %ivs_major + %offsets_major, %offsets_minor},
          %ivs_minor):
         memref<(leading_dims) x (major_dims) x (minor_dims) x type>,
         vector<(minor_dims) x type>;
     } else {
       %v = splat(vector<(minor_dims) x type>, %fill)
     }
```

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

4 years ago[ELF] Add --print-archive-stats=
Fangrui Song [Tue, 28 Apr 2020 02:30:09 +0000 (19:30 -0700)]
[ELF] Add --print-archive-stats=

gold has an option --print-symbol-counts= which prints:

  // For each archive
  archive $archive $members $fetched_members
  // For each object file
  symbols $object $defined_symbols $used_defined_symbols

In most cases, `$defined_symbols = $used_defined_symbols` unless weak
symbols are present. Strangely `$used_defined_symbols` includes symbols defined relative to --gc-sections discarded sections.
The `symbols` lines do not appear to be useful.

`archive` lines are useful: `$fetched_members=0` lines correspond to
unused archives. The information can be used to trim dependencies.

This patch implements --print-archive-stats= which prints the number of
members and the number of fetched members for each archive.

Reviewed By: grimar

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

4 years ago[ELF] Add --rosegment to complement --no-rosegment
Fangrui Song [Thu, 30 Apr 2020 00:31:35 +0000 (17:31 -0700)]
[ELF] Add --rosegment to complement --no-rosegment

This option can cancel --no-rosegment and it just seems right to have
a corresponding positive option for a --no-* negative option.

Anecdotally, gold had --rosegment but did not have --no-rosegment.
I added --no-rosegment (https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=9a6c68caa9543e09b064b7ac7c2b658f277bc19c) for binutils>=2.35

4 years agoReset another globalMemCounter.
Dan Albert [Thu, 30 Apr 2020 00:11:01 +0000 (17:11 -0700)]
Reset another globalMemCounter.

4 years ago[scudo] Initialize the allocator in setTrackAllocationStacks.
Evgenii Stepanov [Wed, 29 Apr 2020 21:41:48 +0000 (14:41 -0700)]
[scudo] Initialize the allocator in setTrackAllocationStacks.

Summary:
If this is called before the malloc call in a thread (or in the whole
program), the lazy initialization of the allocation can overwrite
Options.

Reviewers: pcc, cryptoad

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years ago[mlir] Simplify BranchOpInterface by using MutableOperandRange
River Riddle [Wed, 29 Apr 2020 23:09:43 +0000 (16:09 -0700)]
[mlir] Simplify BranchOpInterface by using MutableOperandRange

This range allows for performing many different operations on successor operands, including erasing/adding/setting. This removes the need for the explicit canEraseSuccessorOperand and eraseSuccessorOperand methods.

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

4 years ago[mlir][DeclareOpInterfaceMethods] Allow specifying a set of methods to force declarat...
River Riddle [Wed, 29 Apr 2020 23:09:30 +0000 (16:09 -0700)]
[mlir][DeclareOpInterfaceMethods] Allow specifying a set of methods to force declaration generation for.

Currently a declaration won't be generated if the method has a default implementation. Meaning that operations that wan't to override the default have to explicitly declare the method in the extraClassDeclarations. This revision adds an optional list parameter to DeclareOpInterfaceMethods to allow for specifying a set of methods that should always have the declarations generated, even if there is a default.

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

4 years ago[mlir] Move the operation equivalence out of CSE and into OperationSupport
River Riddle [Wed, 29 Apr 2020 23:09:20 +0000 (16:09 -0700)]
[mlir] Move the operation equivalence out of CSE and into OperationSupport

This provides a general hash and comparison for checking if two operations are equivalent. This revision also optimizes the handling of result types to take advantage of how result types are stored on the operation.

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

4 years ago[mlir] Add a new MutableOperandRange class for adding/remove operands
River Riddle [Wed, 29 Apr 2020 23:09:11 +0000 (16:09 -0700)]
[mlir] Add a new MutableOperandRange class for adding/remove operands

This class allows for mutating an operand range in-place, and provides vector like API for adding/erasing/setting. ODS now uses this class to generate mutable wrappers for named operands, with the name `MutableOperandRange <operand-name>Mutable()`

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

4 years ago[test][MachineOutliner] REQUIRES: asserts
Puyan Lotfi [Wed, 29 Apr 2020 23:43:17 +0000 (19:43 -0400)]
[test][MachineOutliner] REQUIRES: asserts

This new test checks some of the debug output to ensure what iteration
the outliner reached a fixed point. For now I am making it REQUIRES:
asserts so that it wont break any bots that have asserts disabled.

4 years ago[gn build] Port 9854edd817c
LLVM GN Syncbot [Wed, 29 Apr 2020 22:52:50 +0000 (22:52 +0000)]
[gn build] Port 9854edd817c

4 years ago[lld-macho] Support X86_64_RELOC_BRANCH
Jez Ng [Wed, 29 Apr 2020 22:42:45 +0000 (15:42 -0700)]
[lld-macho] Support X86_64_RELOC_BRANCH

Relatively straightforward diff, to set the stage for calling functions
in dylibs.

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

4 years ago[lld-macho] Have Symbol::getVA() return a non-relative virtual address
Jez Ng [Wed, 29 Apr 2020 22:42:40 +0000 (15:42 -0700)]
[lld-macho] Have Symbol::getVA() return a non-relative virtual address

Currently, getVA() returns a virtual address with the assumption that
the ImageBase is zero. As I understand, this is what lld-ELF is doing.
However, under our current design, it seems like an awkward setup --
I'm finding that I have to add and subtract ImageBase in several places
to make things work out.

As such, I think it's simpler to have getVA() return a non-relative VA,
but I'm not sure if I'm missing something. Would love to hear more from
folks familiar with lld-ELF.

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

4 years ago[lld-macho] Support reading of universal binaries
Jez Ng [Wed, 29 Apr 2020 22:42:36 +0000 (15:42 -0700)]
[lld-macho] Support reading of universal binaries

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

4 years ago[lld-macho] Disable colors in errors when not printing to a pty
Jez Ng [Wed, 29 Apr 2020 22:42:32 +0000 (15:42 -0700)]
[lld-macho] Disable colors in errors when not printing to a pty

This makes for better tests (and is just the right thing to do)

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

4 years ago[lld-macho] Implement basic export trie
Jez Ng [Wed, 29 Apr 2020 22:42:19 +0000 (15:42 -0700)]
[lld-macho] Implement basic export trie

Build the trie by performing a three-way radix quicksort: We start by
sorting the strings by their first characters, then sort the strings
with the same first characters by their second characters, and so on
recursively. Each time the prefixes diverge, we add a node to the trie.
Thanks to @ruiu for the idea.

I used llvm-mc's radix quicksort implementation as a starting point. The
trie offset fixpoint code was taken from
MachONormalizedFileBinaryWriter.cpp.

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

4 years ago[llvm][NFC] Use CallBase explicitly instead of Instruction in FunctionComparator
Mircea Trofin [Wed, 29 Apr 2020 16:01:38 +0000 (09:01 -0700)]
[llvm][NFC] Use CallBase explicitly instead of Instruction in FunctionComparator

Reviewers: dblaikie, craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFCi] Iterative Outliner + clang-format refactoring.
Puyan Lotfi [Wed, 29 Apr 2020 07:33:47 +0000 (03:33 -0400)]
[NFCi] Iterative Outliner + clang-format refactoring.

Prior to D69446 I had done some NFC cleanup to make landing an iterative
outliner a cleaner more straight-forward patch. Since then, it seems that has
landed but I noticed some ways it could be cleaned up. Specifically:

1) doOutline was meant to be the re-runable function, but instead
   runOnceOnModule was created that just calls doOutline.
2) In D69446 we discussed that the flag allowing the re-run of the
   outliner should be a flag to tell how many additional times to run
   the outliner again, not the total number of times. I don't think it
   makes sense to introduce a flag, but print an error if the flag is
   set to 0.

This is an NFCi, the i being that I get rid of the way that the
machine-outline-runs flag could be used to tell the outliner to not run
at all, and because I renamed the flag to '-machine-outliner-reruns'.

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

4 years ago[llvm][NFC] Inliner: rename call site variables.
Mircea Trofin [Wed, 29 Apr 2020 16:27:35 +0000 (09:27 -0700)]
[llvm][NFC] Inliner: rename call site variables.

Summary:
Renamed 'CS' to 'CB', and, in one case, to a more specific name to avoid
naming collision with outer scope (a maintainability/readability reason,
not correctness)

Also updated comments.

Reviewers: davidxl, dblaikie, jdoerfert

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years agolibclc: Pass system libraries to the linker after llvm libraries
Tom Stellard [Wed, 29 Apr 2020 22:34:48 +0000 (15:34 -0700)]
libclc: Pass system libraries to the linker after llvm libraries

Summary:
The llvm libraries depend on the symbols in the system libaries, so
the system libraries need to be added after.

Reviewers: jvesely

Reviewed By: jvesely

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Pass] Register a signal handler when generating crash reproducers.
River Riddle [Wed, 29 Apr 2020 22:08:25 +0000 (15:08 -0700)]
[mlir][Pass] Register a signal handler when generating crash reproducers.

The current implementation uses CrashRecoveryContext, but this only supports recovering in a certain number of cases. This revision adds a signal handler to support even more situations.

This revision was able to properly generate a reproducer for a segfault in the Inliner, that the current recovery couldn't.

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

4 years ago[mlir][Pass] Add support for generating local crash reproducers
River Riddle [Wed, 29 Apr 2020 22:08:15 +0000 (15:08 -0700)]
[mlir][Pass] Add support for generating local crash reproducers

This revision adds a mode to the crash reproducer generator to attempt to generate a more local reproducer. This will attempt to generate a reproducer right before the offending pass that fails. This is useful for the majority of failures that are specific to a single pass, and situations where some passes in the pipeline are not registered with a specific tool.

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

4 years ago[mlir][Pass][NFC] Merge OpToOpPassAdaptor and OpToOpPassAdaptorParallel
River Riddle [Wed, 29 Apr 2020 22:08:05 +0000 (15:08 -0700)]
[mlir][Pass][NFC] Merge OpToOpPassAdaptor and OpToOpPassAdaptorParallel

This moves the threading check to runOnOperation. This produces a much cleaner interface for the adaptor pass, and will allow for the ability to enable/disable threading in a much cleaner way in the future.

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

4 years ago[clangd] Parse `foo` in documentation comments and render as code.
Sam McCall [Sat, 4 Apr 2020 07:12:30 +0000 (09:12 +0200)]
[clangd] Parse `foo` in documentation comments and render as code.

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[ELF] --gdb-index: support .debug_loclists
Fangrui Song [Wed, 29 Apr 2020 01:53:12 +0000 (18:53 -0700)]
[ELF] --gdb-index: support .debug_loclists

--gdb-index currently crashes when reading a translation unit with
DWARF v5 .debug_loclists . Call stack:

```
SyntheticSections.cpp GdbIndexSection::create
SyntheticSections.cpp readAddressAreas
DWARFUnit.cpp DWARFUnit::tryExtractDIEsIfNeeded
DWARFListTable.cpp DWARFListTableHeader::extract
...
DWARFDataExtractor.cpp DWARFDataExtractor::getRelocatedValue
lld/ELF/DWARF.cpp LLDDwarfObj<ELFT>::find (sec.sec is nullptr)
...

```

This patch adds support for .debug_loclists to make `DWARFUnit::tryExtractDIEsIfNeeded` happy.
Building --gdb-index does not need .debug_loclists

Reviewed By: dblaikie, grimar

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

4 years agoRevert "[InlineCost] Addressing a very strict assert check in CostAnnotationWriter...
Kirill Naumov [Wed, 29 Apr 2020 21:59:20 +0000 (21:59 +0000)]
Revert "[InlineCost] Addressing a very strict assert check in CostAnnotationWriter::emitInstructionAnnot"

This reverts commit 66947d05fd193bb8948943a62455d617974f2012.

4 years agoRename NamedAttributeList to MutableDictionaryAttr
Jacques Pienaar [Wed, 29 Apr 2020 20:42:54 +0000 (13:42 -0700)]
Rename NamedAttributeList to MutableDictionaryAttr

Makes the relationship and function clearer. Accordingly rename getAttrList to getMutableAttrDict.

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

4 years agoReland D78837 [lld] Remove special cases from default ld driver mode.
Fangrui Song [Wed, 29 Apr 2020 19:18:45 +0000 (12:18 -0700)]
Reland D78837 [lld] Remove special cases from default ld driver mode.

Drops the behavior from rL217112.

Use the Gnu driver mode by default for all platforms when ld is
invoked. Other names for the program (such as link or ld64) continue
working as before.

Reviewed By: MaskRay, srhines, smeenai, ruiu

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

4 years ago[X86] Merge the last of the useBWIRegs() section into the useAVX512Regs() section...
Craig Topper [Wed, 29 Apr 2020 21:31:00 +0000 (14:31 -0700)]
[X86] Merge the last of the useBWIRegs() section into the useAVX512Regs() section of the X86TargetLowering constructor. NFC

This section is the remnant of how this code was structured before
we made v32i16/v64i8 legal types with avx512f when not restricting
to 256 bit vectors. Now that there are just a few items left,
merge them near similar things in the other section.

4 years agoFix ext-int Sema test that didn't specify a triple.
Erich Keane [Wed, 29 Apr 2020 21:29:58 +0000 (14:29 -0700)]
Fix ext-int Sema test that didn't specify a triple.

I added a limit to make sure that _ExtInt isn't exposed on systems that
haven't considered it in their ABI.  The ext-int.cpp Sema test didn't
have a triple, so on non x86/x86_64 it would fail with this new error.

This patch adds said triple to make sure this passes.

4 years ago[compiler-rt] Fix issue related to switch to Python3 in lit config
Julian Lettner [Wed, 29 Apr 2020 21:33:19 +0000 (14:33 -0700)]
[compiler-rt] Fix issue related to switch to Python3 in lit config

4 years ago[SVE][NFC] Remove unused variable
Tobias Bosch [Wed, 29 Apr 2020 21:14:04 +0000 (14:14 -0700)]
[SVE][NFC] Remove unused variable

Summary: Remove unused variable.

Reviewers: echristo, efriedma

Reviewed By: echristo

Subscribers: tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[MemorySSA] Pass DT to the upward iterator for proper PhiTranslation.
Alina Sbirlea [Wed, 29 Apr 2020 05:57:19 +0000 (22:57 -0700)]
[MemorySSA] Pass DT to the upward iterator for proper PhiTranslation.

Summary:
A valid DominatorTree is needed to do PhiTranslation.
Before this patch, a MemoryUse could be optimized to an access outside a loop, while the address it loads from is modified in the loop.
This can lead to a miscompile.

Reviewers: george.burgess.iv

Subscribers: Prazek, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFC] Make ConstantVector/ConstantDataVector::getType() return a FixedVectorType
Christopher Tetreault [Wed, 29 Apr 2020 20:59:27 +0000 (13:59 -0700)]
[NFC] Make ConstantVector/ConstantDataVector::getType() return a FixedVectorType

Reviewers: efriedma, huihuiz, dexonsmith, spatel

Reviewed By: efriedma

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoRevert "[lld] Remove special cases from default ld driver mode."
Dan Albert [Wed, 29 Apr 2020 21:14:51 +0000 (14:14 -0700)]
Revert "[lld] Remove special cases from default ld driver mode."

This reverts commit da093c388fc9a559295faa6265cb8b1643ce9eeb.

Broke a test on Darwin. Will fix the test and resubmit.

4 years agoDisable _ExtInt by default
Erich Keane [Wed, 29 Apr 2020 20:15:04 +0000 (13:15 -0700)]
Disable _ExtInt by default

Since the _ExtInt type got into the repo, we've discovered that the ABI
implications weren't completely understood. The other architectures are
going to be audited (see D79118), however downstream targets aren't
going to benefit from this audit.

This patch disables the _ExtInt type by default and makes the
target-info an opt-in.  As it is audited, I'll re-enable these for all
of our default targets.

4 years ago[Darwin] Fix compilation issues on arm64
Julian Lettner [Wed, 29 Apr 2020 19:55:21 +0000 (12:55 -0700)]
[Darwin] Fix compilation issues on arm64

Newer iOS SDK introduce accessors to retrieve the register values
(arm_thread_state64_get_*) and disallows direct access to fields. If
arm_thread_state64_get_sp is defined, the accessors are available.

4 years ago[clangd] Fix BUILD_SHARED_LIBS build more.
Sam McCall [Wed, 29 Apr 2020 20:46:33 +0000 (22:46 +0200)]
[clangd] Fix BUILD_SHARED_LIBS build more.

4 years ago[CFG] Turning on Heat Colors for CFG by default
Kirill Naumov [Wed, 29 Apr 2020 18:34:48 +0000 (18:34 +0000)]
[CFG] Turning on Heat Colors for CFG by default

This option seems to be very useful, so let's turn it on by default

Reviewed-By: davidxl
Diff: https://reviews.llvm.org/D79110

4 years ago[InlineCost] Addressing a very strict assert check in CostAnnotationWriter::emitInstr...
Kirill Naumov [Wed, 29 Apr 2020 17:59:44 +0000 (17:59 +0000)]
[InlineCost] Addressing a very strict assert check in CostAnnotationWriter::emitInstructionAnnot

The assert checks that every instruction must be annotated by this point while it is not
necessary. If the inlining process was interrupted because the threshold was reached, the rest
of the instructions would not be annotated which triggers the assert.
The added test shows the situation in which it can happen.

Reviewed-By: mtrofin
Diff: https://reviews.llvm.org/D79107

4 years agoUnbreak check-builtins on macOS after Python3 switch.
Nico Weber [Wed, 29 Apr 2020 20:40:58 +0000 (16:40 -0400)]
Unbreak check-builtins on macOS after Python3 switch.

See https://crbug.com/1076480 for details.

4 years ago[X86] Lower the cost of v4i64->v4i32 and v8i64->v8i32 truncate with AVX
Craig Topper [Wed, 29 Apr 2020 20:00:04 +0000 (13:00 -0700)]
[X86] Lower the cost of v4i64->v4i32 and v8i64->v8i32 truncate with AVX

We generate much better code these days than we used to. And we use the same sequence for AVX1 and AVX2 for these

For v4i64->v4i32 we generate:
vextractf128    xmm1, ymm0, 1
vshufps xmm0, xmm0, xmm1, 136   # xmm0 = xmm0[0,2],xmm1[0,2]

And for v8i64->v8i32 we generate:
vperm2f128      ymm2, ymm0, ymm1, 49 # ymm2 = ymm0[2,3],ymm1[2,3]
vinsertf128     ymm0, ymm0, xmm1, 1
vshufps ymm0, ymm0, ymm2, 136   # ymm0 = ymm0[0,2],ymm2[0,2],ymm0[4,6],ymm2[4,6]

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

4 years ago[mlir] Extract DictionaryAttr sort method
Jacques Pienaar [Tue, 28 Apr 2020 14:57:16 +0000 (07:57 -0700)]
[mlir] Extract DictionaryAttr sort method

Enable calling the sort, as expected by getWithSorted, into static member function so that callers can get same sorting behavior.

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

4 years ago[clangd] Still need pthreads in clangDaemon.
Sam McCall [Wed, 29 Apr 2020 19:41:12 +0000 (21:41 +0200)]
[clangd] Still need pthreads in clangDaemon.

4 years ago[lld] Remove special cases from default ld driver mode.
Dan Albert [Wed, 29 Apr 2020 19:18:45 +0000 (12:18 -0700)]
[lld] Remove special cases from default ld driver mode.

Summary:
Use the Gnu driver mode by default for all platforms when ld is
invoked. Other names for the program (such as link or ld64) continue
working as before.

Reviewers: MaskRay, int3, srhines, smeenai, ruiu

Reviewed By: MaskRay, srhines, smeenai, ruiu

Subscribers: smeenai, srhines, nickdesaulniers, llvm-commits

Tags: #lld, #llvm

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

4 years ago[NFC] Split ext-int calling convention tests into their own file.
Erich Keane [Wed, 29 Apr 2020 19:18:59 +0000 (12:18 -0700)]
[NFC] Split ext-int calling convention tests into their own file.

I'm currently auditing all of the calling convention implications of
_ExtInt for all platforms, so splitting them up into their own test will
make this a much easier task to organize.

4 years ago[AMDGPU] Remove WaitcntBrackets::MixedPendingEvents[]. NFC.
Jay Foad [Wed, 29 Apr 2020 17:40:17 +0000 (18:40 +0100)]
[AMDGPU] Remove WaitcntBrackets::MixedPendingEvents[]. NFC.

It's trivial to derive this information from other state.

4 years ago[AMDGPU] Initialize gpr upper bounds to -1. NFC.
Jay Foad [Wed, 29 Apr 2020 16:13:36 +0000 (17:13 +0100)]
[AMDGPU] Initialize gpr upper bounds to -1. NFC.

These upper bounds are inclusive, so -1 (rather than 0) is the natural
way to express an empty range.

4 years ago[AMDGPU] Simplify MergeInfo calculations. NFC.
Jay Foad [Wed, 29 Apr 2020 15:58:07 +0000 (16:58 +0100)]
[AMDGPU] Simplify MergeInfo calculations. NFC.

This makes the definition and uses of NewUB more symmetrical, and makes
it clear that ScoreLBs[T] does not change.

4 years ago[FileCollector] move Root creation
Jan Korous [Wed, 29 Apr 2020 18:44:40 +0000 (11:44 -0700)]
[FileCollector] move Root creation

If we don't handle the errors we can't rely on the directory being created early anyway.

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

4 years ago[SVE] Upgrade VectorType tests to test new types
Christopher Tetreault [Wed, 29 Apr 2020 18:21:04 +0000 (11:21 -0700)]
[SVE] Upgrade VectorType tests to test new types

Reviewers: efriedma, sdesmalen, c-rhodes, ddunbar

Reviewed By: sdesmalen

Subscribers: huntergr, tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[SystemZ] Allow specifying plain register numbers in AsmParser
Ulrich Weigand [Wed, 29 Apr 2020 17:59:50 +0000 (19:59 +0200)]
[SystemZ] Allow specifying plain register numbers in AsmParser

For compatibility with other assemblers on the platform, allow
using just plain integer register numbers in all places where a
register operand is expected.

Bug: llvm.org/PR45582

4 years ago[SystemZ] Simplify register parsing in AsmParser
Ulrich Weigand [Wed, 29 Apr 2020 16:33:13 +0000 (18:33 +0200)]
[SystemZ] Simplify register parsing in AsmParser

Remove redundant Group and Regs arguments from parseRegister
and eliminate one of its overloaded versions.

Remove redundant Regs argument from parseAddress.

NFC intended.

4 years ago[x86] add tests for awkward 'icmp eq i1'; NFC
Sanjay Patel [Wed, 29 Apr 2020 13:00:10 +0000 (09:00 -0400)]
[x86] add tests for awkward 'icmp eq i1'; NFC

4 years ago[libc++] Re-disable DSL test on Windows
Louis Dionne [Wed, 29 Apr 2020 18:19:27 +0000 (14:19 -0400)]
[libc++] Re-disable DSL test on Windows

This reverts commit 51a60ed14c4e, since the test still doesn't pass on
Windows. Marking the test as UNSUPORTED on Windows again until I've
figured out the problem.

4 years agoFix x86/x86_64 calling convention for _ExtInt
Erich Keane [Fri, 24 Apr 2020 03:36:29 +0000 (20:36 -0700)]
Fix x86/x86_64 calling convention for _ExtInt

After speaking with Craig Topper about some recent defects, he pointed
out that _ExtInts should be passed indirectly if larger than the largest
int register, and like ints when smaller than that.  This patch
implements that.

Note that this changed the way vaargs worked quite a bit, but they still
work.

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

4 years ago[lldb] Remove a redundant semicolon, fixing GCC warnings. NFC.
Martin Storsjö [Wed, 29 Apr 2020 18:00:20 +0000 (21:00 +0300)]
[lldb] Remove a redundant semicolon, fixing GCC warnings. NFC.

4 years ago[clang] [MinGW] Add the compiler rt libdirs to the search path
Martin Storsjö [Wed, 29 Apr 2020 07:34:08 +0000 (10:34 +0300)]
[clang] [MinGW] Add the compiler rt libdirs to the search path

This matches what is done for MSVC in
b8000c0ce84541c5b5535419234fb65ce77d6756. Since that commit, compiler
rt sanitizer libraries aren't linked to with absolute path on windows,
but using their basenames, requiring the libdirs to be passed to
the linker.

This fixes undefined behaviour sanitizer on MinGW after
b8000c0ce84541c5b5535419234fb65ce77d6756.

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

4 years ago[llvm-objcopy] [COFF] Fix a misconception about debug directory payloads
Martin Storsjö [Mon, 27 Apr 2020 11:30:42 +0000 (14:30 +0300)]
[llvm-objcopy] [COFF] Fix a misconception about debug directory payloads

The debug directory payload is not located directly after the
debug directory entry itself, but can essentially be located anywhere
in the binary (even outside of mapped sections, although we don't
handle that case).

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