platform/upstream/llvm.git
4 years ago[lit] Create one output file when `--output` is specified more than once
Julian Lettner [Tue, 5 May 2020 04:36:20 +0000 (21:36 -0700)]
[lit] Create one output file when `--output` is specified more than once

The argparse 'append' action concatenates multiple occurrences of an
argument (even when we specify `nargs=1` or `nargs='?'`).  This means
that we create multiple identical output files if the `--output`
argument is given more than once.  This isn't useful and we instead want
this to behave like a standard optional argument: last occurrence wins.

4 years ago[PDB] Move stream index tracking to GSIStreamBuilder
Reid Kleckner [Tue, 5 May 2020 03:49:26 +0000 (20:49 -0700)]
[PDB] Move stream index tracking to GSIStreamBuilder

The GSIHashStreamBuilder doesn't need to know the stream index.
Standardize the naming (Idx -> Index in public APIs).

4 years ago[MLIR] Update documentation of cmake best practices
Stephen Neuendorffer [Tue, 5 May 2020 03:32:36 +0000 (20:32 -0700)]
[MLIR] Update documentation of cmake best practices

4 years ago[MLIR] Reapply: Adjust libMLIR building to more closely follow libClang
Stephen Neuendorffer [Mon, 4 May 2020 19:41:43 +0000 (12:41 -0700)]
[MLIR] Reapply: Adjust libMLIR building to more closely follow libClang

This reverts commit ab1ca6e60fc58b857cc5030ca6e024d20d919cb9.

4 years ago[MLIR] Normalize usage of intrinsics_gen
Stephen Neuendorffer [Tue, 5 May 2020 00:11:15 +0000 (17:11 -0700)]
[MLIR] Normalize usage of intrinsics_gen

Portions of MLIR which depend on LLVMIR generally need to depend on
intrinsics_gen, to ensure that tablegen'd header files from LLVM are built
first.  Without this, we get errors, typically about llvm/IR/Attributes.inc
not being found.

Note that previously the Linalg Dialect depended on intrinsics_gen, but it
doesn't need to, since it doesn't use LLVMIR.

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

4 years ago[dsymutil] Thread the VFS through dsymutil (NFC)
Jonas Devlieghere [Tue, 5 May 2020 03:19:15 +0000 (20:19 -0700)]
[dsymutil] Thread the VFS through dsymutil (NFC)

This patch threads the virtual file system through dsymutil.

Currently there is no good way to find out exactly what files are
necessary in order to reproduce a dsymutil link, at least not without
knowledge of how dsymutil's internals.  My motivation for this change is
to add lightweight "reproducers" that automatically gather the input
object files through the FileCollectorFileSystem. The files together
with the YAML mapping will allow us to transparently reproduce a
dsymutil link, even without having to mess with the OSO path prefix.

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

4 years ago[mlir] Add support for merging identical blocks during canonicalization
River Riddle [Tue, 5 May 2020 02:54:36 +0000 (19:54 -0700)]
[mlir] Add support for merging identical blocks during canonicalization

This revision adds support for merging identical blocks, or those with the same operations that branch to the same successors. Operands that mismatch between the different blocks are replaced with new block arguments added to the merged block.

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

4 years ago[mlir] Remove tabs from predecessor comments
Geoffrey Martin-Noble [Tue, 5 May 2020 01:30:48 +0000 (01:30 +0000)]
[mlir] Remove tabs from predecessor comments

This change removes tabs from the comments printed by the asmprinter after basic
block declarations in favor of two spaces. This is currently the only place in
the printed IR that uses tabs.

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

4 years ago[CallGraphUpdater] Removed references to calles when deleting function
Sergey Dmitriev [Tue, 5 May 2020 01:58:59 +0000 (18:58 -0700)]
[CallGraphUpdater] Removed references to calles when deleting function

Summary: Otherwise we can get unaccounted references to call graph nodes.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[CUDA][HIP] Fix empty ctor/dtor check for union
Yaxun (Sam) Liu [Mon, 4 May 2020 21:27:41 +0000 (17:27 -0400)]
[CUDA][HIP] Fix empty ctor/dtor check for union

union ctor does not call ctors of its data members. union dtor does not call dtors of its data members.
Also union does not have base class.

Currently when clang checks whether union has an empty ctor/dtor, it checks the ctors/dtors of its
data members. This causes incorrectly diagnose device side global variables and shared variables as
having non-empty ctors/dtors.

This patch fixes that.

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

4 years ago[LTO] Suppress emission of empty combined module by default
Zakk Chen [Tue, 28 Apr 2020 03:04:36 +0000 (20:04 -0700)]
[LTO] Suppress emission of empty combined module by default

Summary:
That unless the user requested an output object (--lto-obj-path), the an
unused empty combined module is not emitted.

This changed is helpful for some target (ex. RISCV-V) which encoded the
ABI info in IR module flags (target-abi). Empty unused module has no ABI
info so the linker would get the linking error during merging
incompatible ABIs.

Reviewers: tejohnson, espindola, MaskRay

Subscribers: emaste, inglorion, arichardson, hiraditya, simoncook, MaskRay, steven_wu, dexonsmith, PkmX, dang, lenary, s.egerton, luismarques, llvm-commits

Tags: #llvm

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

4 years agoClarify comment
Adrian Prantl [Tue, 5 May 2020 01:14:55 +0000 (18:14 -0700)]
Clarify comment

4 years ago[mlir][EDSC] Fix off-by-one BlockBuilder insertion point.
Nicolas Vasilache [Mon, 4 May 2020 20:36:47 +0000 (16:36 -0400)]
[mlir][EDSC] Fix off-by-one BlockBuilder insertion point.

Summary:
In the particular case of an insertion in a block without a terminator, the BlockBuilder insertion point should be block->end().

Adding a unit test to exercise this.

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

4 years ago[mlir][IR] Add a Region::getOps method that returns a range of immediately nested...
River Riddle [Tue, 5 May 2020 00:46:06 +0000 (17:46 -0700)]
[mlir][IR] Add a Region::getOps method that returns a range of immediately nested operations

This allows for walking the operations nested directly within a region, without traversing nested regions.

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

4 years ago[mlir][mlir-opt] Disable multithreading when parsing the input module.
River Riddle [Mon, 4 May 2020 18:21:49 +0000 (11:21 -0700)]
[mlir][mlir-opt] Disable multithreading when parsing the input module.

This removes the unnecessary/costly context synchronization when parsing, as the context is guaranteed to not be used by any other threads.

4 years agoUpdate LLDB filespec tests for remove_dots change
Reid Kleckner [Tue, 5 May 2020 00:24:59 +0000 (17:24 -0700)]
Update LLDB filespec tests for remove_dots change

It looks like the new implementation is correct, since there were TODOs
here about getting the new behavior.

I am not sure if "C:..\.." should become "C:" or "C:\", though. The new
output doesn't precisely match the TODO message, but it seems
appropriate given the specification of remove_dots and how .. traversals
work at the root directory.

4 years ago[ORC] Rename SearchOrder operations on JITDylib to LinkOrder.
Lang Hames [Mon, 4 May 2020 23:43:42 +0000 (16:43 -0700)]
[ORC] Rename SearchOrder operations on JITDylib to LinkOrder.

Refering to the link order of a dylib better matches the terminology used in
static compilation. As upcoming patches will increase the number of places where
link order matters (for example when closing JITDylibs) it's better to get this
name change out of the way early.

4 years agoRe-land "Optimize path::remove_dots"
Reid Kleckner [Mon, 4 May 2020 23:23:48 +0000 (16:23 -0700)]
Re-land "Optimize path::remove_dots"

This reverts commit fb5fd74685e728b1d5e68d33e9842bcd734b98e6.
Re-instates commit 53913a65b408ade2956061b4c0aaed6bba907403

The fix is to trim off trailing separators, as in `/foo/bar/` and
produce `/foo/bar`. VFS tests rely on this. I added unit tests for
remove_dots.

4 years ago[PDB] Use the global BumpPtrAllocator
Reid Kleckner [Mon, 4 May 2020 23:05:12 +0000 (16:05 -0700)]
[PDB] Use the global BumpPtrAllocator

Profiling shows that time is spent destroying the allocator member of
PDBLinker, and that is unneeded.

4 years ago[mlir][StandardToSPIRV] Emulate bitwidths not supported for store op.
Hanhan Wang [Mon, 4 May 2020 22:13:46 +0000 (15:13 -0700)]
[mlir][StandardToSPIRV] Emulate bitwidths not supported for store op.

Summary:
As D78974, this patch implements the emulation for store op. The emulation is
done with atomic operations. E.g., if the storing value is i8, rewrite the
StoreOp to:

 1) load a 32-bit integer
 2) clear 8 bits in the loading value
 3) store 32-bit value back
 4) load a 32-bit integer
 5) modify 8 bits in the loading value
 6) store 32-bit value back

The step 1 to step 3 are done by AtomicAnd as one atomic step, and the step 4
to step 6 are done by AtomicOr as another atomic step.

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

4 years ago[mlir] Support big endian in DenseElementsAttr
Haruki Imai [Mon, 4 May 2020 17:59:48 +0000 (17:59 +0000)]
[mlir] Support big endian in DenseElementsAttr

This std::copy_n copies 8 byte data (APInt raw data) by 1 byte from the
beginning of char array. This is no problem in little endian, but the
data is not copied correctly in big endian because the data should be
copied from the end of the char array.

- Example of 4 byte data (such as float32)

Little endian (First 4 bytes):
Address | 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08
Data    | 0xcd 0xcc 0x8c 0x3f 0x00 0x00 0x00 0x00

Big endian (Last 4 bytes):
Address | 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08
Data    | 0x00 0x00 0x00 0x00 0x3f 0x8c 0xcc 0xcd

In general, when it copies N(N<8) byte data in big endian, the start
address should be incremented by (8 - N) bytes.
The original code has no problem when it includes 8 byte data(such as
 double) even in big endian.

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

4 years ago[lld-macho] Support X86_64_RELOC_SIGNED_{1,2,4}
Fangrui Song [Mon, 4 May 2020 02:25:30 +0000 (19:25 -0700)]
[lld-macho] Support X86_64_RELOC_SIGNED_{1,2,4}

We currently only support extern relocations.
`X86_64_RELOC_SIGNED_{1,2,4}` are like X86_64_RELOC_SIGNED, but with the
implicit addend fixed to 1, 2, and 4, respectively.
See the comment in `lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp RecordX86_64Relocation`.

Reviewed By: int3

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

4 years ago[RegisterCoalescer] Extend a subrange if needed when filling range gap
Krzysztof Parzyszek [Wed, 15 Apr 2020 22:09:17 +0000 (17:09 -0500)]
[RegisterCoalescer] Extend a subrange if needed when filling range gap

Register live ranges may have had gaps that after coalescing should be
removed. This is done by adding a new segment to the range, and merging
it with neighboring segments. When doing so, do not assume that each
subrange of the register ended at the same index. If a subrange ended
earlier, adding this segment could make the live range invalid.
Instead, if the subrange is not live at the start of the segment,
extend it first.

4 years ago[lldb/Expression] Make Language() const, NFC
Vedant Kumar [Mon, 4 May 2020 19:59:39 +0000 (12:59 -0700)]
[lldb/Expression] Make Language() const, NFC

Allow Language() to be called from const methods within UserExpression.

4 years ago[lldb] Fix -Wdtor-name warnings
Jonas Devlieghere [Mon, 4 May 2020 21:31:38 +0000 (14:31 -0700)]
[lldb] Fix -Wdtor-name warnings

Fix warning: ISO C++ requires the name after '::~' to be found in the
same scope as the name before '::~' [-Wdtor-name]

4 years ago[x86] add test for shift+op+concat; NFC
Sanjay Patel [Mon, 4 May 2020 21:26:54 +0000 (17:26 -0400)]
[x86] add test for shift+op+concat; NFC

D79360 could change this kind of sequence.

4 years ago[arm64] Remove an old special case that's not needed anymore.
Davide Italiano [Mon, 4 May 2020 21:16:17 +0000 (14:16 -0700)]
[arm64] Remove an old special case that's not needed anymore.

Debug info generation & codegen now steps onto the correct line.

4 years ago[cmake] restrict object library dependency generation to PUBLIC libraries
Stephen Neuendorffer [Mon, 4 May 2020 21:08:23 +0000 (14:08 -0700)]
[cmake] restrict object library dependency generation to PUBLIC libraries

Previous patch broken flang, which has some yet-to-be resolved cyclic
dependencies.   This patch fixes the breakage by restricting the dependencies
which are generated to public libraries, which is probably more sensible anyway.

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

4 years ago[lldb/DataFormatters] Delete GetStringPrinterEscapingHelper
Vedant Kumar [Thu, 9 Apr 2020 23:53:58 +0000 (16:53 -0700)]
[lldb/DataFormatters] Delete GetStringPrinterEscapingHelper

Summary:
Languages can have different ways of formatting special characters.
E.g. when debugging C++ code a string might look like "\b", but when
debugging Swift code the same string would look like "\u{8}".

To make this work, plugins override GetStringPrinterEscapingHelper.
However, because there's a large amount of subtly divergent work done in
each override, we end up with large amounts of duplicated code. And all
the memory smashers fixed in one copy of the logic (see D73860) don't
get fixed in the others.

IMO the GetStringPrinterEscapingHelper is overly general and hard to
use. I propose deleting it and replacing it with an EscapeStyle enum,
which can be set as needed by each plugin.

A fix for some swift-lldb memory smashers falls out fairly naturally
from this deletion (https://github.com/apple/llvm-project/pull/1046). As
the swift logic becomes really tiny, I propose moving it upstream as
part of this change. I've added unit tests to cover it.

rdar://61419673

Reviewers: JDevlieghere, davide

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

4 years agoRevert "[lldb/Expression] Make Language() const, NFC"
Vedant Kumar [Mon, 4 May 2020 21:03:22 +0000 (14:03 -0700)]
Revert "[lldb/Expression] Make Language() const, NFC"

This reverts commit 88d9e4326f48041056c4db3506d30574c6e1d83c. Revert an
accidental commit.

4 years ago[lldb/Expression] Make Language() const, NFC
Vedant Kumar [Mon, 4 May 2020 19:59:39 +0000 (12:59 -0700)]
[lldb/Expression] Make Language() const, NFC

Allow Language() to be called from const methods within UserExpression.

4 years ago[Verifier] Constrain where DILocations may be nested
Vedant Kumar [Fri, 1 May 2020 04:38:11 +0000 (21:38 -0700)]
[Verifier] Constrain where DILocations may be nested

Summary:
Constrain which metadata nodes are allowed to be, or contain,
DILocations. This ensures that logic for updating DILocations in a
Module is complete.

Currently, !llvm.loop metadata is the only odd duck which contains
nested DILocations. This has caused problems in the past: some passes
forgot to visit the nested locations, leading to subtly broken debug
info and late verification failures.

If there's a compelling reason for some future metadata to nest
DILocations, we'll need to introduce a generic API for updating the
locations attached to an Instruction before relaxing this check.

Reviewers: aprantl, dsanders

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[LLDB] Fix overloaded operator new cases in TestCppOperators.py which currently work...
shafik [Mon, 4 May 2020 20:46:31 +0000 (13:46 -0700)]
[LLDB] Fix overloaded operator new cases in TestCppOperators.py which currently work by accident

The overloaded new operator in TestCppOperators.py are working by accident because of how
we currently deal with artificial methods.

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

4 years ago[ARM] Complex LSR test showing inefficient codegen. NFC
David Green [Mon, 4 May 2020 17:14:30 +0000 (18:14 +0100)]
[ARM] Complex LSR test showing inefficient codegen. NFC

4 years agoTry to make `duplicate_os_log_reports.cpp` more reliable.
Dan Liew [Mon, 4 May 2020 20:47:00 +0000 (13:47 -0700)]
Try to make `duplicate_os_log_reports.cpp` more reliable.

It looks like some bots are failing with os log not giving any
output. This might be due to the system under test being heavy
load so the 2 minute window might not be large enough. This
patch makes the window larger in the hope that this test will
be more reliable.

rdar://problem/62141527

4 years agoRevert "[SveEmitter] Add builtins for svdupq and svdupq_lane"
Sander de Smalen [Mon, 4 May 2020 20:31:45 +0000 (21:31 +0100)]
Revert "[SveEmitter] Add builtins for svdupq and svdupq_lane"

It seems this patch broke some buildbots, so reverting until I
have had a chance to investigate.

This reverts commit 6b90a6887d25e3375bb916a3ed09f7ccec819d0c.

4 years agoReject operations between vectors and enum types.
Erich Keane [Mon, 4 May 2020 20:09:28 +0000 (13:09 -0700)]
Reject operations between vectors and enum types.

There are some lookup oddities with these as reported in PR45780, and
GCC doesn't support these behaviors at all.  To be more consistent with
GCC and prevent the crashes caused by our lookup issues, nip the problem
in the bud and prohibit enums here.

4 years ago[lit] Disable test on Windows
Julian Lettner [Mon, 4 May 2020 20:06:56 +0000 (13:06 -0700)]
[lit] Disable test on Windows

abhinavgaba reported that that the custom-result-category.py test hangs
on a Windows build bot [1].  Disable it for now.

[1] https://reviews.llvm.org/D78164#2018178

4 years ago[JITLink] Fix missing ADDITIONAL_HEADER_DIRS for the LLVMJITLink component.
Lang Hames [Mon, 4 May 2020 19:13:26 +0000 (12:13 -0700)]
[JITLink] Fix missing ADDITIONAL_HEADER_DIRS for the LLVMJITLink component.

Also adds target_link_libraries.

Thanks to @jcmac for spotting this.

4 years ago[JITLink] Fix a typo in a comment.
Lang Hames [Mon, 4 May 2020 19:12:40 +0000 (12:12 -0700)]
[JITLink] Fix a typo in a comment.

Thanks to @jcmac for pointing this out.

4 years agoRevert "[MLIR] Adjust libMLIR building to more closely follow libClang"
Stephen Neuendorffer [Mon, 4 May 2020 19:38:45 +0000 (12:38 -0700)]
Revert "[MLIR] Adjust libMLIR building to more closely follow libClang"

This reverts commit 4f0f436749c264c16eb226c9b9b132e07e3650a6.

This seems to show some compile dependence problems, and also breaks flang.

4 years ago[SveEmitter] Add builtins for svdupq and svdupq_lane
Sander de Smalen [Mon, 4 May 2020 19:17:57 +0000 (20:17 +0100)]
[SveEmitter] Add builtins for svdupq and svdupq_lane

* svdupq builtins that duplicate scalars to every quadword of a vector
  are defined using builtins for svld1rq (load and replicate quadword).
* svdupq builtins that duplicate boolean values to fill a predicate vector
  are defined using `svcmpne`.

Reviewers: SjoerdMeijer, efriedma, ctetreau

Reviewed By: efriedma

Tags: #clang

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

4 years ago[ARM] Fix tail call validity checking for varargs calls.
Eli Friedman [Thu, 30 Apr 2020 00:44:11 +0000 (17:44 -0700)]
[ARM] Fix tail call validity checking for varargs calls.

If a varargs function is calling a non-varargs function, or vice versa,
make sure we use the correct "varargs" bit for each.

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

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

4 years ago[x86] add tests for concat of casts; NFC
Sanjay Patel [Mon, 4 May 2020 19:09:10 +0000 (15:09 -0400)]
[x86] add tests for concat of casts; NFC

4 years agoDescriptive symbol names for machine basic block sections.
Snehasish Kumar [Mon, 4 May 2020 19:02:57 +0000 (19:02 +0000)]
Descriptive symbol names for machine basic block sections.

Today symbol names generated for machine basic block sections use a
unary encoding to reduce bloat. This is essential when every basic block
in the binary is assigned a symbol however with basic block clusters
(rG05192e585ce175b55f2a26b83b4ed7882785c8e6) when we only need to
generate a few non-temporary symbols we can assign more descriptive
names making them more user friendly. With this change -

Cold cluster section for function foo is named "foo.cold"
Exception cluster section for function foo is named "foo.eh"
Other cluster sections identified by their ids are named "foo.ID"
Using this format works well with existing tools. It will demangle as
expected and works with existing symbolizers, profilers and debuggers
out of the box.

$ c++filt _Z3foov.cold
foo() [clone .cold]

$ c++filt _Z3foov.eh
foo() [clone .eh]

$c++filt _Z3foov.1234
foo() [clone 1234]

Tests for basicblock-sections are updated with some cleanup where
appropriate.

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

4 years ago[flang] Fix x87 binary->decimal
peter klausler [Mon, 4 May 2020 18:41:39 +0000 (11:41 -0700)]
[flang] Fix x87 binary->decimal

Summary:
Fix decimal formatting of 80-bit x87 values; the calculation ofnearest neighbor values failed to account for the explicitmost significant bit in that format.

Replace MultiplyByRounded with MultiplyBy in binary->decimal conversions,
since rounding won't happen and the name was misleading; then remove
dead code, and migrate LoseLeastSignificantDigit() from one source file
to another where it's still needed.

Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby

Reviewed By: tskeith

Subscribers: llvm-commits, flang-commits

Tags: #flang, #llvm

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

4 years ago[llvm-objdump][ARM] Print inline relocations when dumping ARM data
Fangrui Song [Sat, 2 May 2020 05:52:42 +0000 (22:52 -0700)]
[llvm-objdump][ARM] Print inline relocations when dumping ARM data

Fixes PR44357

For ARM ELF, regions covered by data mapping symbols `$d` are dumped as `.byte`, `.short` or `.word` but inline relocations are not printed. This patch merges its loop into the normal instruction printing loop so that inline relocations are printed.

Reviewed By: nickdesaulniers

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

4 years ago[SveEmitter] Add builtins for Int & FP reductions
Sander de Smalen [Mon, 4 May 2020 16:58:49 +0000 (17:58 +0100)]
[SveEmitter] Add builtins for Int & FP reductions

This patch adds integer builtins for:
- svaddv, svandv, sveorv,
  svmaxv, svminv, svorv.

And FP builtins for:
- svadda, svaddv, svmaxv, svmaxnmv,
  svminv, svminnmv

4 years ago[MLIR] Adjust libMLIR building to more closely follow libClang
Valentin Churavy [Thu, 23 Apr 2020 23:41:14 +0000 (16:41 -0700)]
[MLIR] Adjust libMLIR building to more closely follow libClang

- Exports MLIR targets to be used out-of-tree.
- mimicks `add_clang_library` and `add_flang_library`.
- Fixes libMLIR.so

After https://reviews.llvm.org/D77515 libMLIR.so was no longer containing
any object files. We originally had a cludge there that made it work with
the static initalizers and when switchting away from that to the way the
clang shlib does it, I noticed that MLIR doesn't create a `obj.{name}` target,
and doesn't export it's targets to `lib/cmake/mlir`.

This is due to MLIR using `add_llvm_library` under the hood, which adds
the target to `llvmexports`.

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

[MLIR] Fix libMLIR.so and LLVM_LINK_LLVM_DYLIB

Primarily, this patch moves all mlir references to LLVM libraries into
either LLVM_LINK_COMPONENTS or LINK_COMPONENTS.  This enables magic in
the llvm cmake files to automatically replace reference to LLVM components
with references to libLLVM.so when necessary.  Among other things, this
completes fixing libMLIR.so, which has been broken for some configurations
since D77515.

Unlike previously, the pattern is now that mlir libraries should almost
always use add_mlir_library.  Previously, some libraries still used
add_llvm_library.  However, this confuses the export of targets for use
out of tree because libraries specified with add_llvm_library are exported
by LLVM.  Instead users which don't need/can't be linked into libMLIR.so
can specify EXCLUDE_FROM_LIBMLIR

A common error mode is linking with LLVM libraries outside of LINK_COMPONENTS.
This almost always results in symbol confusion or multiply defined options
in LLVM when the same object file is included as a static library and
as part of libLLVM.so.  To catch these errors more directly, there's now
mlir_check_all_link_libraries.

To simplify usage of add_mlir_library, we assume that all mlir
libraries depend on LLVMSupport, so it's not necessary to separately specify
it.

tested with:
BUILD_SHARED_LIBS=on,
BUILD_SHARED_LIBS=off + LLVM_BUILD_LLVM_DYLIB,
BUILD_SHARED_LIBS=off + LLVM_BUILD_LLVM_DYLIB + LLVM_LINK_LLVM_DYLIB.

By: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Differential Revision: https://reviews.llvm.org/D79067

[MLIR] Move from using target_link_libraries to LINK_LIBS

This allows us to correctly generate dependencies for derived targets,
such as targets which are created for object libraries.

By: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Differential Revision: https://reviews.llvm.org/D79243

Three commits have been squashed to avoid intermediate build breakage.

4 years ago[libc] Include object files from alias entrypoints also in entrypoint libraries.
Siva Chandra Reddy [Thu, 30 Apr 2020 17:46:49 +0000 (10:46 -0700)]
[libc] Include object files from alias entrypoints also in entrypoint libraries.

Reviewers: abrachet

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

4 years agoA test commit as a new contributor to verify commit access is OK.
Denys Petrov [Mon, 4 May 2020 18:36:18 +0000 (21:36 +0300)]
A test commit as a new contributor to verify commit access is OK.

4 years ago[PowerPC][AIX][NFC] Remove spills and reloads from arg passing test.
Sean Fertile [Fri, 1 May 2020 17:40:52 +0000 (13:40 -0400)]
[PowerPC][AIX][NFC] Remove spills and reloads from arg passing test.

4 years ago[ARM] isHardwareLoopProfitable debug messages. NFC
David Green [Sat, 2 May 2020 21:29:57 +0000 (22:29 +0100)]
[ARM] isHardwareLoopProfitable debug messages. NFC

4 years ago[DebugInfo][CodeView] Include namespace into emitted globals
Alexandre Ganea [Mon, 4 May 2020 17:13:19 +0000 (13:13 -0400)]
[DebugInfo][CodeView] Include namespace into emitted globals

Before this patch, global variables didn't have their namespace prepended in the Codeview debug symbol stream. This prevented Visual Studio from displaying them in the debugger (they appeared as 'unspecified error')

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

4 years ago[libc++] Always enable local submodule visibility in the test suite
Louis Dionne [Mon, 4 May 2020 17:01:39 +0000 (13:01 -0400)]
[libc++] Always enable local submodule visibility in the test suite

When building with modules, always enable local submodule visibility.
It used to be disabled on Apple platforms, but it seems like we want
to use the same flags on Apple and Linux now (see https://reviews.llvm.org/D74892).

4 years ago[lldb/test] Fix wrong target command failure message on Windows
Med Ismail Bennani [Mon, 4 May 2020 17:17:10 +0000 (19:17 +0200)]
[lldb/test] Fix wrong target command failure message on Windows

This patch fixes the test failure happening on Windows introduced by
`015117411e11458f9816ba4359246132164a4297`.

Since the failure message comes from the OS, the test needs to support both
UNIX and Windows messages.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years agoTest commit. Modified comment to add a period at the end.
Zarko [Mon, 4 May 2020 17:06:21 +0000 (13:06 -0400)]
Test commit. Modified comment to add a period at the end.

4 years ago[llvm][dfsan][NFC] Factor out fcn initialization
Zola Bridges [Sat, 2 May 2020 23:53:34 +0000 (16:53 -0700)]
[llvm][dfsan][NFC] Factor out fcn initialization

Summary:
Moving these function initializations into separate functions makes it easier
to read the runOnModule function. There is also precedent in the sanitizer code:
asan has a function ModuleAddressSanitizer::initializeCallbacks(Module &M). I
thought it made sense to break the initializations into two sets. One for the
compiler runtime functions and one for the event callbacks.

Tested with: check-all

Reviewed By: morehouse

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

4 years ago[libc++] NFC: Remove unnecessary scope
Louis Dionne [Mon, 4 May 2020 16:31:17 +0000 (12:31 -0400)]
[libc++] NFC: Remove unnecessary scope

The double-braces were initially to escape Python string formatting, but
that string isn't sent through Python string formatting.

4 years agoLet clang print registered targets for --version
Yaxun (Sam) Liu [Thu, 30 Apr 2020 21:41:54 +0000 (17:41 -0400)]
Let clang print registered targets for --version

We need a way to know supported targets by clang since
people may use clang as assembler and they want to
choose the clang which supports their target.

This patch let clang print registered targets when
--version option is passed to clang.

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

4 years ago[libc++] Translate the modules-support Lit feature to the DSL
Louis Dionne [Fri, 17 Apr 2020 18:04:04 +0000 (14:04 -0400)]
[libc++] Translate the modules-support Lit feature to the DSL

4 years ago[AMDGPU] fix copies between 32 and 16 bit
Stanislav Mekhanoshin [Wed, 29 Apr 2020 20:00:51 +0000 (13:00 -0700)]
[AMDGPU] fix copies between 32 and 16 bit

This a hack to fix illegal 32 to 16 bit copies.
The problem is when we make 16 bit subregs legal it creates
a huge amount of failures which can only be resolved at once
without a temporary hack like this.

The next step is to change operands, instruction definitions
and patterns until this hack is not needed.

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

4 years ago[cmake] Ensure that LINK_LIBS are dependencies for object library targets
Stephen Neuendorffer [Fri, 1 May 2020 00:16:59 +0000 (17:16 -0700)]
[cmake] Ensure that LINK_LIBS are dependencies for object library targets

In MLIR, it is common for automatically generated headers to be included
in many places.  To avoid tracking these dependencies explicitly in
cmake, they are treated as part of a library which 'owns' the generated
header.  Users of the generated header link against the owning library.
However, object libraries don't actually 'link', so this dependence gets
lost.  This patch adds an explicit dependence for these generated headers
when creating object library targets to ensure that generated headers
are appropriately generated

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

4 years ago[libc++] NFC: Remove outdated #if comment
Louis Dionne [Mon, 4 May 2020 15:39:16 +0000 (11:39 -0400)]
[libc++] NFC: Remove outdated #if comment

4 years ago[SVE] Remove invalid usage of getNumElements in Instructions
Christopher Tetreault [Mon, 4 May 2020 15:29:08 +0000 (08:29 -0700)]
[SVE] Remove invalid usage of getNumElements in Instructions

Summary:
Remove invalid usage of VectorType::getNumElements in
ShuffleVectorInst::isValidOperands identified by test case
llvm::Analysis/ConstantFolding/vscale-shufflevector.ll. The tested
conditions hold for both fixed width and scalable vectors; use
getElementCount().

Reviewers: efriedma, sdesmalen, c-rhodes, spatel

Reviewed By: sdesmalen

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

Tags: #llvm

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

4 years ago[lldb/Host] Improve error messages on unowned read files
Med Ismail Bennani [Thu, 23 Apr 2020 13:43:54 +0000 (15:43 +0200)]
[lldb/Host] Improve error messages on unowned read files

When trying to read a core file that is not owned by the user running lldb
and that doesn't have read permission on the file, lldb shows a misleading
error message:

```
Unable to find process plug-in for core file
```

This is due to the fact that currently, lldb doesn't check the file
ownership. And when trying to to open and read a core file, the syscall
fails, which prevents a process to be created.

Since lldb already have a portable `open` syscall interface, lets take
advantage of that and delegate the error handling to the syscall
itself. This way, no matter if the file exists or if the user has proper
ownership, lldb will always try to open the file, and behave accordingly
to the error code returned.

rdar://42630030

https://reviews.llvm.org/D78712

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years ago[mlir][Linalg] Mostly NFC - Refactor Linalg patterns and transformations.
Nicolas Vasilache [Sat, 2 May 2020 05:03:37 +0000 (01:03 -0400)]
[mlir][Linalg] Mostly NFC - Refactor Linalg patterns and transformations.

Linalg transformations are currently exposed as DRRs.
Unfortunately RewriterGen does not play well with the line of work on named linalg ops which require variadic operands and results.
Additionally, DRR is arguably not the right abstraction to expose compositions of such patterns that don't rely on SSA use-def semantics.

This revision abandons DRRs and exposes manually written C++ patterns.

Refactorings and cleanups are performed to uniformize APIs.
This refactoring will allow replacing the currently manually specified Linalg named ops.

A collateral victim of this refactoring is the `tileAndFuse` DRR, and the one associated test, which will be revived at a later time.

Lastly, the following 2 tests do not add value and are altered:
- a dot_perm tile + interchange test does not test anything new and is removed
- a dot tile + lower to loops does not need 2-D tiling and is trimmed.

4 years ago[ELF] Don't advance sh_offset for an empty section whose PT_LOAD is removed (due...
Fangrui Song [Fri, 1 May 2020 16:50:37 +0000 (09:50 -0700)]
[ELF] Don't advance sh_offset for an empty section whose PT_LOAD is removed (due to p_memsz=0)

removeEmptyPTLoad() removes empty (p_memsz=0) PT_LOAD segments.  In
assignFileOffsets(), setFileOffset() unnecessarily advances file offsets
for containing empty sections.

This is exposed by arm Linux kernel's multi_v5_defconfig
(see https://bugs.llvm.org/show_bug.cgi?id=45632)

```
ld.lld (max-page-size=65536):
  [34] .init.data        PROGBITS        c0c24000 c34000 0128ac 00  WA  0   0 4096
  [35] .text_itcm        PROGBITS        fffe0000 c50000 000000 00  WA  0   0  1
  [36] .data_dtcm        PROGBITS        fffe8000 c58000 000000 00  WA  0   0  1
  [37] .data             PROGBITS        c0c38000 c58000 0647a0 00  WA  0   0 32

arm-linux-gnueabi-ld (max-page-size=65536):
  [23] .init.data        PROGBITS        c0c12000 c22000 0128ac 00  WA  0   0 4096
  [24] .text_itcm        PROGBITS        fffe0000 ca2558 000000 00   W  0   0  1
  [25] .data_dtcm        PROGBITS        fffe8000 ca2558 000000 00   W  0   0  1
  [26] .data             PROGBITS        c0c26000 c36000 0647a0 00  WA  0   0 32
```

This patch clears OutputSection::ptLoad if ptLoad is removed by
removeEmptyPTLoad(). Conceptually this removes "dangling" references.

Reviewed By: psmith

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

4 years ago[libc++] Translate compiler-identification Lit features to the new DSL
Louis Dionne [Fri, 17 Apr 2020 18:00:39 +0000 (14:00 -0400)]
[libc++] Translate compiler-identification Lit features to the new DSL

4 years ago[flang] Fixed a crash
Pete Steinfeld [Sat, 2 May 2020 03:47:59 +0000 (20:47 -0700)]
[flang] Fixed a crash

Summary:
I found a small test case that caused a crash when derived type
definitions have parameters without definitions.

Reviewers: tskeith, klausler, DavidTruby

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoFix LABEL match for test case for D72841 #pragma float_control
Melanie Blower [Mon, 4 May 2020 14:25:23 +0000 (07:25 -0700)]
Fix LABEL match for test case for D72841 #pragma float_control

4 years ago[InstCombine] Fold (mul(abs(x),abs(x))) -> (mul(x,x)) (PR39476)
Simon Pilgrim [Mon, 4 May 2020 14:21:52 +0000 (15:21 +0100)]
[InstCombine] Fold (mul(abs(x),abs(x))) -> (mul(x,x)) (PR39476)

This patch adds support for discarding integer absolutes (abs + nabs variants) from self-multiplications.

ABS Alive2: http://volta.cs.utah.edu:8080/z/rwcc8W
NABS Alive2: http://volta.cs.utah.edu:8080/z/jZXUwQ

This is an InstCombine version of D79304 - I'm not sure yet if we'll need that after this.

Reviewed By: @lebedev.ri and @xbolva00

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

4 years ago[X86][SSE] Move some VZEXT_MOVL combines into combineTargetShuffle. NFC.
Simon Pilgrim [Mon, 4 May 2020 14:03:50 +0000 (15:03 +0100)]
[X86][SSE] Move some VZEXT_MOVL combines into combineTargetShuffle. NFC.

Minor cleanup of combineShuffle by moving some of the low hanging fruit (load + scalar_to_vector folds).

4 years ago[libc++] NFC: Print Lit available features in sorted order
Louis Dionne [Mon, 4 May 2020 14:11:49 +0000 (10:11 -0400)]
[libc++] NFC: Print Lit available features in sorted order

This makes it easier to diff them between bot runs.

4 years ago[MLIR] Add complex numbers to standard dialect
Frederik Gossen [Mon, 4 May 2020 12:19:04 +0000 (12:19 +0000)]
[MLIR] Add complex numbers to standard dialect

Add `CreateComplexOp`, `ReOp`, and `ImOp` to the standard dialect.
This is the first step to support complex numbers.

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

4 years ago[COFF] Avoid allocating temporary vectors during ICF
Reid Kleckner [Sat, 2 May 2020 20:28:56 +0000 (13:28 -0700)]
[COFF] Avoid allocating temporary vectors during ICF

Heap profiling with ETW shows that LLD performs 4,053,721 heap
allocations over its lifetime, and ~800,000 of them come from
assocEquals. These vectors are created just to do a comparison, so fuse
the comparison into the loop and avoid the allocation.

ICF is overall a small portion of the time spent linking, and I did not
measure overall throughput improvements from this change above the noise
threshold. However, these show up in the heap profiler, and the work is
done, so we might as well land it if the code is clear enough.

Reviewed By: hans

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

4 years ago[SelectionDAGBuilder] Stop setting alignment to one for hidden sret values
Alex Richardson [Fri, 29 Mar 2019 12:13:56 +0000 (12:13 +0000)]
[SelectionDAGBuilder] Stop setting alignment to one for hidden sret values

We allocated a suitably aligned frame index so we know that all the values
have ABI alignment.
For MIPS this avoids using pair of lwl + lwr instructions instead of a
single lw. I found this when compiling CHERI pure capability code where
we can't use the lwl/lwr unaligned loads/stores and and were to falling
back to a byte load + shift + or sequence.

This should save a few instructions for MIPS and possibly other backends
that don't have fast unaligned loads/stores.
It also improves code generation for CodeGen/X86/pr34653.ll and
CodeGen/WebAssembly/offset.ll since they can now use aligned loads.

Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D78999

4 years ago[MIPS] Add a baseline test showing current inefficient hidden sret lowering
Alex Richardson [Fri, 29 Mar 2019 12:06:40 +0000 (12:06 +0000)]
[MIPS] Add a baseline test showing current inefficient hidden sret lowering

SelectionDAGBuilder currently doesn't propagate the known alignment of
the sret parameter. This is inefficient for MIPS and highly inefficient for
our out-of-tree CHERI-extended MIPS since we don't have lwl/lwr so fall back
to byte loads for align == 1.

4 years ago[AMDGPU] Enable carry out ADD/SUB operations divergence driven instruction selection.
alex-t [Thu, 23 Apr 2020 17:55:36 +0000 (20:55 +0300)]
[AMDGPU] Enable carry out ADD/SUB operations divergence driven instruction selection.

Summary: This change enables all kind of carry out ISD opcodes to be selected according to the node divergence.

Reviewers: rampitec, arsenm, vpykhtin

Reviewed By: rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[lldb/DWARF] Remove dead code in DWARFDebugInfoEntry
Pavel Labath [Mon, 4 May 2020 13:18:59 +0000 (15:18 +0200)]
[lldb/DWARF] Remove dead code in DWARFDebugInfoEntry

The dumping code is not used by anyone, and is a source of
inconsistencies with the llvm dwarf parser, as dumping is implemented at
a different level (DWARFDie) there.

4 years ago[ELF] Move SHF_LINK_ORDER till OutputSection addresses are known
Peter Smith [Wed, 22 Apr 2020 19:28:52 +0000 (20:28 +0100)]
[ELF] Move SHF_LINK_ORDER till OutputSection addresses are known

Sections with the SHF_LINK_ORDER flag must be ordered in the same relative
order as the Sections they have a link to. When using a linker script an
arbitrary expression may be used for the virtual address of the
OutputSection. In some cases the virtual address does not monotonically
increase as the OutputSection index increases, so if we base the ordering
of the SHF_LINK_ORDER sections on the index then we can get the order
wrong. We fix this by moving SHF_LINK_ORDER resolution till after we have
created OutputSection virtual addresses.

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

4 years ago[libc++] Define a few Lit features using the new DSL
Louis Dionne [Sun, 3 May 2020 17:26:23 +0000 (13:26 -0400)]
[libc++] Define a few Lit features using the new DSL

This commit migrates some of the Lit features from config.py to the new
DSL. This simplifies config.py and is a first step towards defining all
the features using the DSL instead of the complex logic in config.py.

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

4 years ago[AArch64] Add NVIDIA Carmel support
Raul Tambre [Mon, 4 May 2020 10:45:35 +0000 (11:45 +0100)]
[AArch64] Add NVIDIA Carmel support

Summary:
NVIDIA's Carmel ARM64 cores are used in Tegra194 chips found in Jetson AGX Xavier, DRIVE AGX Xavier and DRIVE AGX Pegasus.

References:
* https://devblogs.nvidia.com/nvidia-jetson-agx-xavier-32-teraops-ai-robotics/#h.huq9xtg75a5e
* NVIDIA Xavier Series System-on-Chip Technical Reference Manual 1.3 (https://developer.nvidia.com/embedded/downloads#?search=Xavier%20Series%20SoC%20Technical%20Reference%20Manual)

Reviewers: sdesmalen, paquette

Reviewed By: sdesmalen

Subscribers: llvm-commits, ianshmean, kristof.beyls, hiraditya, jfb, danielkiss, cfe-commits, t.p.northover

Tags: #clang, #llvm

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

4 years agoReapply "Add support for #pragma float_control" with buildbot fixes
Melanie Blower [Fri, 1 May 2020 17:32:06 +0000 (10:32 -0700)]
Reapply "Add support for #pragma float_control" with buildbot fixes
Add support for #pragma float_control

Reviewers: rjmccall, erichkeane, sepavloff

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

This reverts commit fce82c0ed310174fe48e2402ac731b6340098389.

4 years ago[mlir] Removed tight coupling of BufferPlacement pass to Alloc and Dealloc.
Marcel Koester [Tue, 21 Apr 2020 13:12:10 +0000 (15:12 +0200)]
[mlir] Removed tight coupling of BufferPlacement pass to Alloc and Dealloc.

The current BufferPlacement implementation tries to find Alloc and Dealloc
operations in order to move them. However, this is a tight coupling to
standard-dialect ops which has been removed in this CL.

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

4 years ago[SVE][Codegen] Lower legal min & max operations
Kerry McLaughlin [Mon, 4 May 2020 10:18:50 +0000 (11:18 +0100)]
[SVE][Codegen] Lower legal min & max operations

Summary:
This patch adds AArch64ISD nodes for [S|U]MIN_PRED
and [S|U]MAX_PRED, and lowers both SVE intrinsics and
IR operations for min and max to these nodes.

There are two forms of these instructions for SVE: a predicated
form and an immediate (unpredicated) form. The patterns
which existed for the latter have been updated to match a
predicated node with an immediate and map this
to the immediate instruction.

Reviewers: sdesmalen, efriedma, dancgr, rengolin

Reviewed By: efriedma

Subscribers: huihuiz, tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits

Tags: #llvm

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

4 years ago[SLC] Allow llvm.pow(x,2.0) -> x*x etc even if no pow() lib func
Jay Foad [Thu, 30 Apr 2020 15:53:20 +0000 (16:53 +0100)]
[SLC] Allow llvm.pow(x,2.0) -> x*x etc even if no pow() lib func

optimizePow does not create any new calls to pow, so it should work
regardless of whether the pow library function is available. This allows
it to optimize the llvm.pow intrinsic on targets with no math library.

Based on a patch by Tim Renouf.

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

4 years ago[InstCombine] Add tests showing failure to fold mul(abs(x),abs(x)) -> mul(x,x) (PR39476)
Simon Pilgrim [Mon, 4 May 2020 09:23:35 +0000 (10:23 +0100)]
[InstCombine] Add tests showing failure to fold mul(abs(x),abs(x)) -> mul(x,x) (PR39476)

Includes abs() and nabs() variants

4 years ago[SCCP] Re-use pushToWorkList in pushToWorkListMsg (NFC).
Florian Hahn [Mon, 4 May 2020 09:17:24 +0000 (10:17 +0100)]
[SCCP] Re-use pushToWorkList in pushToWorkListMsg (NFC).

There's no need to duplicate the logic to push to the different
work-lists.

4 years agoFix building with GCC5 after e64f99c51a8e
Hans Wennborg [Mon, 4 May 2020 09:04:48 +0000 (11:04 +0200)]
Fix building with GCC5 after e64f99c51a8e

It was failing with:

  /work/llvm.monorepo/clang-tools-extra/clangd/ClangdServer.cpp: In lambda function:
  /work/llvm.monorepo/clang-tools-extra/clangd/ClangdServer.cpp:374:75:
  error: could not convert ‘(const char*)""’ from ‘const char*’ to ‘llvm::StringLiteral’
                                                  trace::Metric::Distribution);
                                                                             ^

4 years agoPrecommit test updates for D68231.
Jay Foad [Mon, 4 May 2020 08:26:56 +0000 (09:26 +0100)]
Precommit test updates for D68231.

4 years ago[mlir][rocdl] add rocdl.barier op.
Wen-Heng (Jack) Chung [Mon, 4 May 2020 08:32:16 +0000 (10:32 +0200)]
[mlir][rocdl] add rocdl.barier op.

- Add rocdl.barrier op.
- Lower gpu.barier to rocdl.barrier in -convert-gpu-to-rocdl.

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

4 years ago[mlir][vector] add tests for type_cast taking non-zero addrspace
Wen-Heng (Jack) Chung [Fri, 1 May 2020 10:15:57 +0000 (12:15 +0200)]
[mlir][vector] add tests for type_cast taking non-zero addrspace

Add tests for vector.type_cast that takes memrefs on non-zero
addrspaces.

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

4 years ago[VE][NFC] formatting VEISD enum
Simon Moll [Mon, 4 May 2020 07:50:27 +0000 (09:50 +0200)]
[VE][NFC] formatting VEISD enum

4 years ago[llvm-dwarfdump][Stats] Clean up
Djordje Todorovic [Thu, 23 Apr 2020 10:14:13 +0000 (12:14 +0200)]
[llvm-dwarfdump][Stats] Clean up

This addresses:
  -Clean up the source code
  -Refactor the JSON fields
  -Fix the test cases
  -Improve the docs for the stats output

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

4 years ago[X86] Simplify some code in combineTruncatedArithmetic. NFC
Craig Topper [Mon, 4 May 2020 06:53:08 +0000 (23:53 -0700)]
[X86] Simplify some code in combineTruncatedArithmetic. NFC

We haven't promoted AND/OR/XOR to vXi64 types for a while. So
there's no reason to use isOperationLegalOrPromote. So we can
just use isOperationLegal by merging with ADD handling.

4 years ago[X86] Custom legalize v16i64->v16i8 truncate with avx512.
Craig Topper [Mon, 4 May 2020 05:35:32 +0000 (22:35 -0700)]
[X86] Custom legalize v16i64->v16i8 truncate with avx512.

Default legalization will create two v8i64 truncs to v8i32, concat
them to v16i32, and then truncate the rest of the way to v16i8.

Instead we can truncate directly from v8i64 to v8i8 in the lower
half of an xmm. Then concat the two halves to use vpunpcklqdq.
This is the same number of uops, but the dependency chain through
the uops is better since the halves are merged at the end.

I had to had SimplifyDemandedBits support for VTRUNC to prevent
a regression on vector-trunc-math.ll. combineTruncatedArithmetic
no longer gets a chance to shrink vXi64 mul so we were producing
the v8i64 multiply sequence using multiple PMULUDQs. With the
demanded bits fix we are able to prune out the extra ops leaving
just two PMULUDQs, one for each v8i64 half. This is twice the
width of the 2 v8i32 PMULLDs we had before, but PMULUDQ is 1
uop and PMULLD is 2. We also save some truncates. It's probably
worth using PMULUDQ even when PMULLQ is available since the latter
is 3 uops, but that will require a different change.

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

4 years agoMake Polly tests dependencies explicit
serge-sans-paille [Mon, 4 May 2020 06:06:39 +0000 (08:06 +0200)]
Make Polly tests dependencies explicit

Due to libPolly now using the component infrastructure, it no longer carries all
dependencies as it used to do.

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

4 years ago[llvm-objcopy] Avoid invalid Sec.Offset after D79229
Fangrui Song [Mon, 4 May 2020 04:54:28 +0000 (21:54 -0700)]
[llvm-objcopy] Avoid invalid Sec.Offset after D79229

To avoid undefined behavior caught by -fsanitize=undefined on binary-paddr.test

  void SectionWriter::visit(const Section &Sec) {
    if (Sec.Type != SHT_NOBITS)
      // Sec.Contents is empty while Sec.Offset may be out of bound
      llvm::copy(Sec.Contents, Out.getBufferStart() + Sec.Offset);
  }

4 years ago[Attributor][NFC] Replace the nested AAMap with a key pair
Johannes Doerfert [Wed, 22 Apr 2020 02:34:39 +0000 (21:34 -0500)]
[Attributor][NFC] Replace the nested AAMap with a key pair

No functional change is intended.

---

Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):

Before:
```
calls to allocation functions: 512375 (362871/s)
temporary memory allocations: 98746 (69933/s)
peak heap memory consumption: 22.54MB
peak RSS (including heaptrack overhead): 106.78MB
total memory leaked: 269.10KB
```

After:
```
calls to allocation functions: 509833 (338534/s)
temporary memory allocations: 98902 (65671/s)
peak heap memory consumption: 18.71MB
peak RSS (including heaptrack overhead): 103.00MB
total memory leaked: 269.10KB
```

Difference:
```
calls to allocation functions: -2542 (-27042/s)
temporary memory allocations: 156 (1659/s)
peak heap memory consumption: -3.83MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```