platform/upstream/llvm.git
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

4 years ago[llvm-readobj] [COFF] Cope with debug directory payloads in unmapped areas
Martin Storsjö [Mon, 27 Apr 2020 11:55:31 +0000 (14:55 +0300)]
[llvm-readobj] [COFF] Cope with debug directory payloads in unmapped areas

According to the spec, the payload for debug directories can be
in parts of the binary that aren't mapped at runtime - in these
cases, AddressOfRawData is just set to zero.

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

4 years ago[VFDatabase] Scalar functions are vector functions with VF =1
Anh Tuyen Tran [Wed, 29 Apr 2020 17:20:37 +0000 (17:20 +0000)]
[VFDatabase] Scalar functions are vector functions with VF =1

Summary:
Return scalar function when VF==1. The new trivial mapping scalar --> scalar when VF==1 to prevent false positive for "isVectorizable" query.

Author: masoud.ataei (Masoud Ataei)

Reviewers: Whitney (Whitney Tsang), fhahn (Florian Hahn), pjeeva01 (Jeeva P.), fpetrogalli (Francesco Petrogalli), rengolin (Renato Golin)

Reviewed By: fpetrogalli (Francesco Petrogalli)

Subscribers: hiraditya (Aditya Kumar), llvm-commits, LLVM

Tag: LLVM

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

4 years ago[mlir][StandardToSPIRV] Handle conversion of cmpi operation with i1
MaheshRavishankar [Wed, 29 Apr 2020 16:57:31 +0000 (09:57 -0700)]
[mlir][StandardToSPIRV] Handle conversion of cmpi operation with i1
type operands.

The instructions used to convert std.cmpi cannot have i1 types
according to SPIR-V specification. A different set of operations are
specified in the SPIR-V spec for comparing boolean types. Enhance the
StandardToSPIRV lowering to target these instructions when operands to
std.cmpi operation are of i1 type.

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

4 years ago[MachineVerifier] Remove an unused function. NFCI.
Davide Italiano [Wed, 29 Apr 2020 16:58:07 +0000 (09:58 -0700)]
[MachineVerifier] Remove an unused function. NFCI.

4 years ago[libc++] NFC: Properly indent nested #ifs in platform_support.h
Louis Dionne [Wed, 29 Apr 2020 16:52:59 +0000 (12:52 -0400)]
[libc++] NFC: Properly indent nested #ifs in platform_support.h

4 years ago[debuginfo-tests] Update Python CMake variable
Jonas Devlieghere [Wed, 29 Apr 2020 16:51:24 +0000 (09:51 -0700)]
[debuginfo-tests] Update Python CMake variable

4 years ago[libc++] Re-disable parts of the failing RU locale tests on Apple
Louis Dionne [Wed, 29 Apr 2020 16:49:25 +0000 (12:49 -0400)]
[libc++] Re-disable parts of the failing RU locale tests on Apple

Instead of completely disabling the tests on Apple, which makes them
disabled on all platforms we test (and hence useless), this commit
disables only the assertions that actually fail. I also created a
bug report to track re-enabling them (https://llvm.org/PR45739).

4 years ago[llvm][NFC] Removed addressed fixme; formatting.
Mircea Trofin [Wed, 29 Apr 2020 16:04:14 +0000 (09:04 -0700)]
[llvm][NFC] Removed addressed fixme; formatting.

Removed already-addressed fixme, and updated formatting of a few lines
that were triggering Harbormaster.

4 years ago[libc++] Try re-enabling long-disabled locale tests on Apple platforms
Louis Dionne [Wed, 29 Apr 2020 16:00:13 +0000 (12:00 -0400)]
[libc++] Try re-enabling long-disabled locale tests on Apple platforms

These two locale tests are disabled because they were said to "pass in
an uncontrolled manner on Apple platforms". This commit re-enables them
to see what that means, and whether that is still relevant on the
platforms we test.

Before this commit, the tests were either XFAILed or UNSUPPORTED on
Apple and Linux, which is pretty much all the systems we support. If
the tests truly don't work anywhere, they should be removed instead.

4 years ago[PGO][PGSO] Prep for enabling non-cold code size opts under non-partial-profile sampl...
Hiroshi Yamauchi [Mon, 27 Apr 2020 17:55:55 +0000 (10:55 -0700)]
[PGO][PGSO] Prep for enabling non-cold code size opts under non-partial-profile sample PGO.

Summary:
- Distinguish between partial-profile and non-partial-profile sample PGO.
- Add a flag for partial-profile sample PGO.
- Tune the sample PGO cutoff.
- No default behavior change (yet).

Reviewers: davidxl

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[x86] Enable bypassing 64-bit division on generic x86-64
Simon Pilgrim [Wed, 29 Apr 2020 15:47:10 +0000 (16:47 +0100)]
[x86] Enable bypassing 64-bit division on generic x86-64

This is currently enabled for Intel big cores from Sandy Bridge onward, as well as Atom, Silvermont, and KNL, due to 64-bit division being so slow on these cores. AMD cores can do this in hardware (use 32-bit division based on input operand width), so it's not a win there. But since the majority of x86 CPUs benefit from this optimization, and since the potential upside is significantly greater than the downside, we should enable this for the generic x86-64 target.

Patch By: @atdt

Reviewed By: @craig.topper, @RKSimon

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

4 years ago[libc++] Mark two timed_mutex tests as flaky
Louis Dionne [Wed, 29 Apr 2020 15:52:02 +0000 (11:52 -0400)]
[libc++] Mark two timed_mutex tests as flaky

4 years ago[gn build] (manually) port ad97ccf6b26a
Nico Weber [Wed, 29 Apr 2020 15:51:10 +0000 (11:51 -0400)]
[gn build] (manually) port ad97ccf6b26a

4 years ago[AArch64] Remove inexistent system register ERXTS_EL1
Victor Campos [Wed, 15 Apr 2020 15:51:00 +0000 (16:51 +0100)]
[AArch64] Remove inexistent system register ERXTS_EL1

Summary:
AArch64's system register ERXTS_EL1 is present in the backend as a
component of the Arm Reliability, Availability and Serviceability (RAS)
extension. However, it has been removed from the specification before
its final release.

This patch removes the register.

Reviewers: SjoerdMeijer, DavidSpickett

Reviewed By: DavidSpickett

Subscribers: DavidSpickett, kristof.beyls, hiraditya, danielkiss, llvm-commits

Tags: #llvm

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

4 years ago[llvm][NFC] Change parameter type to more specific CallBase in IndirectCallPromotion
Mircea Trofin [Tue, 28 Apr 2020 21:50:06 +0000 (14:50 -0700)]
[llvm][NFC] Change parameter type to more specific CallBase in IndirectCallPromotion

Reviewers: dblaikie, craig.topper, wmi

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[libc++] Try re-enabling DSL test on Windows
Louis Dionne [Wed, 29 Apr 2020 15:30:37 +0000 (11:30 -0400)]
[libc++] Try re-enabling DSL test on Windows

The issue we were seeing before should have been fixed by 178a0c80baab.

4 years ago[libclang] Shared libraries require PIC unless WIN32
David Zarzycki [Wed, 29 Apr 2020 14:31:56 +0000 (10:31 -0400)]
[libclang] Shared libraries require PIC unless WIN32

4 years ago[mlir][std] allow subview take memrefs from non-zero addrspaces.
Wen-Heng (Jack) Chung [Wed, 29 Apr 2020 15:12:19 +0000 (17:12 +0200)]
[mlir][std] allow subview take memrefs from non-zero addrspaces.

On certain targets std.subview should be able to take memrefs from non-zero
addrspaces. Improve lowering logic to llvm dialect and amend the tests.

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

4 years agoRevert rG5c4b4a62256876 "PseudoSourceValue.h - reduce GlobalValue.h include to forwar...
Simon Pilgrim [Wed, 29 Apr 2020 15:11:26 +0000 (16:11 +0100)]
Revert rG5c4b4a62256876 "PseudoSourceValue.h - reduce GlobalValue.h include to forward declaration. NFC."

Causes buildbot failures.

4 years ago[mlir][vector] let transfer_read and transfer_write take non-zero addrspace.
Wen-Heng (Jack) Chung [Wed, 29 Apr 2020 15:06:44 +0000 (17:06 +0200)]
[mlir][vector] let transfer_read and transfer_write take non-zero addrspace.

Enhance lowering logic and tests so vector.transfer_read and
vector.transfer_write take memrefs on non-zero addrspaces.

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

4 years ago[AMDGPU] Use a MapVector instead of a DenseMap and a std::vector. NFC.
Jay Foad [Wed, 29 Apr 2020 14:46:33 +0000 (15:46 +0100)]
[AMDGPU] Use a MapVector instead of a DenseMap and a std::vector. NFC.

4 years ago[AMDGPU] Minor cleanups. NFC.
Jay Foad [Wed, 29 Apr 2020 13:10:56 +0000 (14:10 +0100)]
[AMDGPU] Minor cleanups. NFC.

4 years ago[clangd] Add CMake dependencies for Protobuf-generated files
Kirill Bobyrev [Wed, 29 Apr 2020 14:59:32 +0000 (16:59 +0200)]
[clangd] Add CMake dependencies for Protobuf-generated files

Summary:
Dependencies ensure that Protobufs are generated before all libraries
depending on the headers are **built**, not linked.

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

4 years agoPseudoSourceValue.h - reduce GlobalValue.h include to forward declaration. NFC.
Simon Pilgrim [Wed, 29 Apr 2020 14:05:59 +0000 (15:05 +0100)]
PseudoSourceValue.h - reduce GlobalValue.h include to forward declaration. NFC.

Fix MachineMemOperand.h implicit dependency on Type.h via PseudoSourceValue.h

4 years agoFixing typo (singed -> signed); NFC
Aaron Ballman [Wed, 29 Apr 2020 14:33:21 +0000 (10:33 -0400)]
Fixing typo (singed -> signed); NFC

4 years agoRevert "[ELF][PPC64] Don't perform toc-indirect to toc-relative relax... "
Sean Fertile [Wed, 29 Apr 2020 13:27:54 +0000 (09:27 -0400)]
Revert "[ELF][PPC64] Don't perform toc-indirect to toc-relative relax... "

This reverts commit 03ffe5860549e97a0f2d8262b100e8910f61c528.

Full tile of reverted commit is:
[ELF][PPC64] Don't perform toc-indirect to toc-relative relaxation for
R_PPC64_TOC16_HA not followed by R_PPC64_TOC16_LO_DS

Breaks the multistage lld PowerPC buildbot.

4 years ago[lldb/DWARF] Fix a split-dwarf crash while parsing compile units
Pavel Labath [Wed, 29 Apr 2020 14:14:41 +0000 (16:14 +0200)]
[lldb/DWARF] Fix a split-dwarf crash while parsing compile units

The cause of this crash is relatively simple -- we are using a
SymbolFileDWARFDwo to parse a (skeleton) dwarf unit. This cause the
CompileUnit to be created with the wrong ID, which later triggers an
assertion in SymbolFile::SetCompileUnitAtIndex. The fix is also simple
-- ensure we use the right symbol file for parsing.

However, a fairly elaborate setup is needed trigger this bug, because
ParseCompileUnit is normally called very early on (and with the right
symbol file object) during the process of accessing a compile unit.
The only way this can be triggered is if the DWARF unit is
"accidentally" pulled into scope during expression evaluation
This can happen if the "this" object used for the context of an
expression is in a namespace, and that namespace is also present in
other compile units

The included test recreates this setup.

4 years ago[libc++] Fix MacOS platform detection broken in Python 3
Louis Dionne [Wed, 29 Apr 2020 13:56:52 +0000 (09:56 -0400)]
[libc++] Fix MacOS platform detection broken in Python 3

Since 88af3ddb1e8a, libc++ will prefer Python 3 when available. It is
available on Apple platforms, so subprocess.check_output will return
bytes instead of str. This lead to comparisons against str to be false,
and the MacOS platform not being detected properly.

4 years ago[clangd] Move non-clang base pieces into separate support/ lib. NFCI
Sam McCall [Tue, 28 Apr 2020 15:49:17 +0000 (17:49 +0200)]
[clangd] Move non-clang base pieces into separate support/ lib. NFCI

Summary:
This enforces layering, reduces a sprawling clangd/ directory, and makes life
easier for embedders.

Reviewers: kbobyrev

Subscribers: mgorny, ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, jfb, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years agoRevert 6654719 "[CMake] Fix logic error: NOT LIBCLANG_BUILD_STATIC does not imply...
Hans Wennborg [Wed, 29 Apr 2020 13:12:43 +0000 (15:12 +0200)]
Revert 6654719 "[CMake] Fix logic error: NOT LIBCLANG_BUILD_STATIC does not imply PIC"

It broke building libclang.dll in Windows builds configured with
LLVM_ENABLE_PIC=OFF. See discussion on the cfe-commits thread.

4 years ago[SveEmitter] Add builtins for svmov_b and svnot_b.
Sander de Smalen [Wed, 29 Apr 2020 10:59:57 +0000 (11:59 +0100)]
[SveEmitter] Add builtins for svmov_b and svnot_b.

These are custom expanded in CGBuiltin:

  svmov_b_z(pg, op) <=> svand_b_z(pg, op, op)
  svnot_b_z(pg, op) <=> sveor_b_z(pg, op, pg)

Reviewers: SjoerdMeijer, efriedma, ctetreau, rengolin

Reviewed By: efriedma

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

4 years ago[analyzer] Fix build error. NFC.
Valeriy Savchenko [Wed, 29 Apr 2020 12:20:57 +0000 (15:20 +0300)]
[analyzer] Fix build error. NFC.

Move DenseMapInfo specialization to llvm namespace

4 years ago[NFC][ARM] Modify cost model test
Sam Parker [Wed, 29 Apr 2020 11:42:47 +0000 (12:42 +0100)]
[NFC][ARM] Modify cost model test

4 years ago[NFC][ARM] Add two cost model tests
Sam Parker [Wed, 29 Apr 2020 11:36:05 +0000 (12:36 +0100)]
[NFC][ARM] Add two cost model tests

4 years agoFix Wparentheses gcc warning. NFC.
Simon Pilgrim [Wed, 29 Apr 2020 11:21:05 +0000 (12:21 +0100)]
Fix Wparentheses gcc warning. NFC.

It should be either a float(32) or an int(32).

4 years ago[TTI] Add DemandedElts to getScalarizationOverhead
Simon Pilgrim [Wed, 29 Apr 2020 10:39:13 +0000 (11:39 +0100)]
[TTI] Add DemandedElts to getScalarizationOverhead

The improvements to the x86 vector insert/extract element costs in D74976 resulted in the estimated costs for vector initialization and scalarization increasing higher than should be expected. This is particularly noticeable on pre-SSE4 targets where the available of legal INSERT_VECTOR_ELT ops is more limited.

This patch does 2 things:
1 - it implements X86TTIImpl::getScalarizationOverhead to more accurately represent the typical costs of a ISD::BUILD_VECTOR pattern.
2 - it adds a DemandedElts mask to getScalarizationOverhead to permit the SLP's BoUpSLP::getGatherCost to be rewritten to use it directly instead of accumulating raw vector insertion costs.

This fixes PR45418 where a v4i8 (zext'd to v4i32) was no longer vectorizing.

A future patch should extend X86TTIImpl::getScalarizationOverhead to tweak the EXTRACT_VECTOR_ELT scalarization costs as well.

Reviewed By: @craig.topper

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

4 years ago[SveEmitter] Add builtins for gather prefetches
Sander de Smalen [Wed, 29 Apr 2020 10:36:41 +0000 (11:36 +0100)]
[SveEmitter] Add builtins for gather prefetches

Patch by Andrzej Warzynski

Reviewed By: efriedma

Tags: #clang

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

4 years agoRecommit "[VPlan] Add & use VPValue operands for VPWidenRecipe (NFC)."
Florian Hahn [Wed, 29 Apr 2020 09:22:30 +0000 (10:22 +0100)]
Recommit "[VPlan] Add & use VPValue operands for VPWidenRecipe (NFC)."

The crash that caused the original revert has been fixed in
a3c964a278b4. I also added a reduced version of the crash reproducer.

This reverts the revert commit 2107af9ccfdfe67a90ea9ed4f3bfd7c72c4e29ac.

4 years ago[MLIR] Introduce op trait PolyhedralScope (revised)
Uday Bondhugula [Wed, 29 Apr 2020 00:08:23 +0000 (05:38 +0530)]
[MLIR] Introduce op trait PolyhedralScope (revised)

(A previous version of this, dd2c639c3cd397dfef941186fb85c82e4e918425, was
reverted.)

Introduce op trait PolyhedralScope for ops to define a new scope for
polyhedral optimization / affine dialect purposes, thus generalizing
such scopes beyond FuncOp. Ops to which this trait is attached will
define a new scope for the consideration of SSA values as valid symbols
for the purposes of polyhedral analysis and optimization. Update methods
that check for dim/symbol validity to work based on this trait.

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