platform/upstream/llvm.git
4 years ago[lldb/API] Move SBCommandInterpreterRunOption in its own header. (NFC)
Jonas Devlieghere [Thu, 30 Apr 2020 20:28:42 +0000 (13:28 -0700)]
[lldb/API] Move SBCommandInterpreterRunOption in its own header. (NFC)

Currently, `SBCommandInterpreterRunOptions` is defined in
`SBCommandInterpreter.h`. Given that the options are always passed by
reference, a forward declaration is sufficient.

That's not the case for `SBCommandInterpreterRunResults`, which we need
for a new overload for `RunCommandInterpreter` and that returns this new
class by value. We can't include `SBCommandInterpreter.h` because
`SBCommandInterpreter::GetDebugger()` returns SBDebugger by value and
therefore needs a full definition.

This patch moves the definition of `SBCommandInterpreterRunOptions` into
a new header. In a later patch,  `SBCommandInterpreterRunResults` will
be defined in there as well, solving the aforementioned problem.

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

4 years ago[OPENMP50]Basic support for uses_allocators clause.
Alexey Bataev [Tue, 21 Apr 2020 17:21:00 +0000 (13:21 -0400)]
[OPENMP50]Basic support for uses_allocators clause.

Summary: Added parsing/sema/serialization supoprt for uses_allocators clause.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, arphaman, cfe-commits, caomhin

Tags: #clang

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

4 years ago[lldb/CommandInterpreter] Move everything into CommandInterpreterRunOptions
Jonas Devlieghere [Thu, 30 Apr 2020 20:17:48 +0000 (13:17 -0700)]
[lldb/CommandInterpreter] Move everything into CommandInterpreterRunOptions

This implements Greg's suggestion from D78825 to include "auto handle
events" and "spawn thread" in CommandInterpreterRunOptions. This change
is in preparation for adding a new overload for RunCommandInterpreter
that takes only SBCommandInterpreterRunOptions and returns
SBCommandInterpreterRunResults.

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

4 years ago[lldb/CMake] Use INSTALL_RPATH for tools and BUILD_RPATH for unittests.
Jonas Devlieghere [Thu, 30 Apr 2020 18:43:03 +0000 (11:43 -0700)]
[lldb/CMake] Use INSTALL_RPATH for tools and BUILD_RPATH for unittests.

It seems like only the unittests are building with
BUILD_WITH_INSTALL_RPATH set to OFF. Of course when I did my last change
I only ran check-lldb-unit. Not sure why this difference exists, why
would you even install the unittest?

For the LLDB framework we do need different build and install RPATHs.
Currently that logic lives downstream. I plan to upstream that in the
near future. For now I'm just trying to make it possible to run the
test.

4 years ago[clang] Disable check for system sanitizer blacklists files if -fno-sanitizer-blackli...
Sylvain Audi [Thu, 30 Apr 2020 18:52:43 +0000 (14:52 -0400)]
[clang] Disable check for system sanitizer blacklists files if -fno-sanitizer-blacklist was specified

This is to avoid checking for the validity of a file that is not used.
This also contains a minor fix for the test, as the cfi sanitizer requires -flto and -fvisibility= arguments.

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

4 years ago[libc++] Use Lit utilities instead of old libcxx utilities for str/bytes conversions
Louis Dionne [Thu, 30 Apr 2020 19:48:27 +0000 (15:48 -0400)]
[libc++] Use Lit utilities instead of old libcxx utilities for str/bytes conversions

The libcxx.util utilities don't work properly, and we should remove them
when we get rid of compiler.py. In particular, libcxx.util.to_string
appears to be completely broken.

4 years ago[VFDatabase] Testsuite for scalar functions are vector functions with VF =1
Masoud Ataei [Thu, 30 Apr 2020 19:47:21 +0000 (15:47 -0400)]
[VFDatabase] Testsuite for scalar functions are vector functions with VF =1

Fixing test suite of the committed PR: https://reviews.llvm.org/D78054.
I am proposing to remove the PowerPC target triple in the test suite.

Reviewed by: @jsji, @fpetrogalli

Tags: LLVM

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

4 years ago[WebAssmebly] Add support for defined wasm globals in MC and lld
Sam Clegg [Wed, 29 Apr 2020 20:26:27 +0000 (13:26 -0700)]
[WebAssmebly] Add support for defined wasm globals in MC and lld

This change add support for defined wasm globals in the .s format,
the MC layer, and wasm-ld

Currently there is no support custom initialization and all wasm
globals are initialized to zero.

Fixes: PR45742

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

4 years ago[libc++] Make sure platform detection works in both Python 2 and 3
Louis Dionne [Thu, 30 Apr 2020 19:30:39 +0000 (15:30 -0400)]
[libc++] Make sure platform detection works in both Python 2 and 3

19123a3e0873 was too naive -- we really want to handle both Python 2 and
Python 3, not only Python 3.

4 years ago[ms] Add new option to llvm-lib: /llvmlibempty
Eric Astor [Thu, 30 Apr 2020 19:29:52 +0000 (15:29 -0400)]
[ms] Add new option to llvm-lib: /llvmlibempty

Summary:
Add a new option (/llvmlibempty). If passed and llvm-lib does not give an error, it will create a valid output archive even if empty.

By default, llvm-lib mimicks lib.exe: if given no input files, it doesn't create its output file at all. This is incompatible with some build systems, so we add a command-line option to toggle this compatibility behavior.

Reviewed By: thakis

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

4 years ago[test] Fix ELF/linkerscript/input-archive.s w/ @ in path
Thomas Preud'homme [Wed, 29 Apr 2020 16:27:17 +0000 (17:27 +0100)]
[test] Fix ELF/linkerscript/input-archive.s w/ @ in path

Lld test ELF/linkerscript/input-archive.s fails when path contain a @
because is not accepted in unquoted token in linker scripts which leads
to the path being broken in 2 around the @. This commit quotes the path
used in the linker script created by this and similar testcases allowing
the test to pass even in the presence of an @ sign in the path.

Reviewed By: MaskRay

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

4 years ago[mlir][AffineStructures] Explicitly initialize variables to avoid use of uninitialize...
River Riddle [Thu, 30 Apr 2020 19:08:53 +0000 (12:08 -0700)]
[mlir][AffineStructures] Explicitly initialize variables to avoid use of uninitialized variable

4 years ago[OPENMP]Allow cancellation constructs in target parallel regions.
Alexey Bataev [Mon, 27 Apr 2020 15:37:35 +0000 (11:37 -0400)]
[OPENMP]Allow cancellation constructs in target parallel regions.

Summary:
omp cancellation point parallel and omp cancel parallel directives are
allowed in target paralle regions.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, caomhin, cfe-commits

Tags: #clang

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

4 years ago[libc] Add definitions of double_t and float_t to math.h.
Siva Chandra Reddy [Mon, 27 Apr 2020 20:35:21 +0000 (13:35 -0700)]
[libc] Add definitions of double_t and float_t to math.h.

This change does not handle any extensions. Only the C standard
variations are handled.

Reviewers: abrachet

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

4 years ago[libc][NFC] Rename cpp::function to cpp::Function.
Siva Chandra Reddy [Thu, 30 Apr 2020 18:08:20 +0000 (11:08 -0700)]
[libc][NFC] Rename cpp::function to cpp::Function.

Summary: Just to be consistent with other names in cpp.

Reviewers: abrachet

Subscribers: tschuett, libc-commits

Tags: #libc-project

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

4 years ago[flang] Add the header file for the conversion of FIR(MLIR) to LLVM-IR dialect
Eric Schweitz [Thu, 30 Apr 2020 15:16:08 +0000 (08:16 -0700)]
[flang] Add the header file for the conversion of FIR(MLIR) to LLVM-IR dialect

Summary:
This is the interface to the conversion pass that converts the FIR dialect (and standard dialects) of MLIR to the LLVM-IR dialect. The implementation of this bridge will be forthcoming in subsequent diffs.

The purpose of the code gen bridge is to take the IR, which will be expressed as a mix of higher-level Fortran constructs as expressed in the FIR dialect and the MLIR standard dialect, and convert the representation into the LLVM-IR dialect. At that point, the LLVM-IR dialect can be converted into LLVM IR (proper) by a standard MLIR pass.

Reviewers: jeanPerier, vjayathirtha-nv, sscalpone, jdoerfert, DavidTruby, kiranchandramohan

Reviewed By: sscalpone, kiranchandramohan

Tags: #llvm, #flang

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

4 years ago[OPENMP50]Support 'task' modifier in reduction clauses.
Alexey Bataev [Wed, 22 Apr 2020 12:14:39 +0000 (08:14 -0400)]
[OPENMP50]Support 'task' modifier in reduction clauses.

Summary:
Added basic support for 'task' modifier in the reduction clauses in
non-simd parallel and worksharing constructs.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, cfe-commits, caomhin

Tags: #clang

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

4 years ago[lldb] Also set owning module for template specializations
Raphael Isemann [Thu, 30 Apr 2020 18:38:51 +0000 (20:38 +0200)]
[lldb] Also set owning module for template specializations

Summary:
This was originally commented out as it broke the data-formatter-stl/libcxx/
tests. However this was fixed by commit ef423a3ba57045f80b0fcafce72121449a8b54d4
(Add Objective-C property accessors loaded from Clang module DWARF to lookup)
which sets the HasExternalVisibleStorage flag for the template specializations.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: abidh, JDevlieghere

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

4 years ago[X86][CostModel] Bump the cost of vpermw/vpermt2b/vperm2w
Craig Topper [Thu, 30 Apr 2020 17:52:35 +0000 (10:52 -0700)]
[X86][CostModel] Bump the cost of vpermw/vpermt2b/vperm2w

vpermw is 2 uops. vpermt2b/vpermt2w are two shuffle uops and a port 015 uop. Weirdly vpermb is a single uop.

This patch bumps the cost to 2 for these operations. Maybe should go to 3 for the vpermt2*, but I've started conservative.

I've also removed a few entries that were now the same as earlier subtargets or that I didn't think we really did. Like I don't think we extend v32i8 to v32i16, shuffle, and then truncate.

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

4 years ago[flang] Add the proposal document and rationale for the internal naming module that...
Eric Schweitz [Wed, 29 Apr 2020 14:08:17 +0000 (07:08 -0700)]
[flang] Add the proposal document and rationale for the internal naming module that was previously added.

Summary:
This document describes how uniquing of internal names is done. This
name uniquing is done to support the constraints and invariants of the FIR
dialect of MLIR.

Reviewers: jeanPerier, mehdi_amini, DavidTruby, jdoerfert, sscalpone, kiranchandramohan

Reviewed By: jeanPerier, sscalpone, kiranchandramohan

Subscribers: tskeith, kiranchandramohan, rriddle, llvm-commits

Tags: #llvm, #flang

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

4 years ago[libc++] Don't over-quote arguments to DSL tests
Louis Dionne [Thu, 30 Apr 2020 17:46:30 +0000 (13:46 -0400)]
[libc++] Don't over-quote arguments to DSL tests

On Windows, quoting with single-quotes is both unnecessary and incorrect.
If the arguments are properly handled by Lit (which they are), quoting
should not be necessary.

4 years ago[X86][SSE] Canonicalize UNARYSHUFFLE(XOR(X,-1) -> XOR(UNARYSHUFFLE(X),-1)
Simon Pilgrim [Thu, 30 Apr 2020 17:45:30 +0000 (18:45 +0100)]
[X86][SSE] Canonicalize UNARYSHUFFLE(XOR(X,-1) -> XOR(UNARYSHUFFLE(X),-1)

This pushes the NOT pattern up the DAG to help expose it for further combines (AND->ANDN in particular).

The PSHUFD/MOVDDUP 'splat' cases are the only ones I've seen in the wild so far, we can further generalize if/when we need to.

4 years ago[clangd] Render doc-comment code spans with `backticks` in plaintext mode
Sam McCall [Wed, 29 Apr 2020 23:25:18 +0000 (01:25 +0200)]
[clangd] Render doc-comment code spans with `backticks` in plaintext mode

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[libc++] Make sure we create the working directory for running config check commands
Louis Dionne [Thu, 30 Apr 2020 18:09:39 +0000 (14:09 -0400)]
[libc++] Make sure we create the working directory for running config check commands

The internal Lit shell requires the current working directory to exist.
This didn't show up locally because the directories were already created
by previous runs of the tests.

4 years ago[mlir][OpInterfaceGen] Emit the utility Trait decl as a class and not using directive
River Riddle [Thu, 30 Apr 2020 17:56:33 +0000 (10:56 -0700)]
[mlir][OpInterfaceGen] Emit the utility Trait decl as a class and not using directive

This fixes the build on MSVC where it is unable to handle template-template using directives properly.

4 years ago[lldb/CMake] Set the PYTHON_RPATH for the unit tests
Jonas Devlieghere [Thu, 30 Apr 2020 18:04:51 +0000 (11:04 -0700)]
[lldb/CMake] Set the PYTHON_RPATH for the unit tests

The API and Python script interpreter unit tests also link against
Python and therefore need to set the RPATH when applicable.

4 years ago[AMDGPU] Update DWARF proposal encodings
Scott Linder [Thu, 30 Apr 2020 18:00:09 +0000 (14:00 -0400)]
[AMDGPU] Update DWARF proposal encodings

Update the tentative encodings to avoid a conflict with a GNU extension.

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

4 years ago[clangd] Move inserted include from detail -> documentation.
Sam McCall [Wed, 29 Apr 2020 18:10:50 +0000 (20:10 +0200)]
[clangd] Move inserted include from detail -> documentation.

Summary: Many clients try to display all the detail inline, with poor results.

See https://github.com/clangd/clangd/issues/284

Reviewers: hokein

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

Tags: #clang

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

4 years ago[lldb/CMake] Don't make PYTHON_RPATH a required variable.
Jonas Devlieghere [Thu, 30 Apr 2020 17:54:03 +0000 (10:54 -0700)]
[lldb/CMake] Don't make PYTHON_RPATH a required variable.

4 years ago[debuginfo-tests] Update Python variable in lit.site.cfg.py
Jonas Devlieghere [Thu, 30 Apr 2020 17:51:40 +0000 (10:51 -0700)]
[debuginfo-tests] Update Python variable in lit.site.cfg.py

4 years ago[mlir][Linalg] Add support to lower named ops to loops.
Nicolas Vasilache [Thu, 30 Apr 2020 13:44:55 +0000 (09:44 -0400)]
[mlir][Linalg] Add support to lower named ops to loops.

This revision adds support to allow named ops to lower to loops.
Linalg.batch_matmul successfully lowers to loops and to LLVM.

In the process, this test also activates linalg to affine loops.
However padded convolutions to not lower to affine.load atm so this revision overrides the type of underlying load / store operation.

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

4 years ago[lldb] fix RPATH when linking against Python3.framework
Jonas Devlieghere [Thu, 30 Apr 2020 17:34:03 +0000 (10:34 -0700)]
[lldb] fix RPATH when linking against Python3.framework

The install name for the Python 3 framework in Xcode is relative to
the framework's location and not the dylib itself.

  @rpath/Python3.framework/Versions/3.x/Python3

This means that we need to compute the path to the Python3.framework
and use that as the RPATH instead of the usual dylib's directory.

4 years ago[lldb] Re-add deleted RUN line in module-ownership.mm
Raphael Isemann [Thu, 30 Apr 2020 17:28:23 +0000 (19:28 +0200)]
[lldb] Re-add deleted RUN line in module-ownership.mm

This was deleted in 681466f5e6412350a0b066791450e72325c2c074 by accident.

4 years ago[libc++] Use the internal Lit shell parser to run config tests
Louis Dionne [Thu, 30 Apr 2020 16:18:37 +0000 (12:18 -0400)]
[libc++] Use the internal Lit shell parser to run config tests

This makes the config tests portable across platforms.

4 years ago[Bitcode] Make attribute test more robust (NFC)
Nikita Popov [Thu, 30 Apr 2020 16:49:01 +0000 (18:49 +0200)]
[Bitcode] Make attribute test more robust (NFC)

The ID of the { nobuiltin } attribute set increases every time
a new test is added to this file. Store it in a variable instead.

4 years ago[clangd] Render code complete documentation as plaintext/markdown.
Sam McCall [Thu, 30 Apr 2020 08:49:32 +0000 (10:49 +0200)]
[clangd] Render code complete documentation as plaintext/markdown.

Summary:
Structure is parsed from the raw comment using the existing heuristics used
for hover.

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[libc++] Do not allow customizing the arch in the trunk and back-deployment scripts
Louis Dionne [Thu, 30 Apr 2020 16:55:01 +0000 (12:55 -0400)]
[libc++] Do not allow customizing the arch in the trunk and back-deployment scripts

We should eventually be able to pass an arbitrary target triple, however
for the time being, just being able to pass 64/32 is not really that
useful.

4 years ago[MLIR] Modify Partial op conversion mode to optionally track all non-legalizable...
Lucy Fox [Thu, 30 Apr 2020 16:47:19 +0000 (09:47 -0700)]
[MLIR] Modify Partial op conversion mode to optionally track all non-legalizable operations.

There are three op conversion modes: Partial, Full, and Analysis. This change modifies the Partial mode to optionally take a set of non-legalizable ops. If this parameter is specified, all ops that are not legalizable (i.e. would cause full conversion to fail) are tracked throughout the partial legalization.

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

4 years ago[BitcodeReader] Simplify raw attribute handling (NFC)
Nikita Popov [Thu, 30 Apr 2020 16:45:04 +0000 (18:45 +0200)]
[BitcodeReader] Simplify raw attribute handling (NFC)

Every new attribute we add from now on will not be supported in the
raw format, because we ran out of space. Don't bother listing each
affected attribute twice.

4 years ago[NFC] Rename *ByValOrInalloca* to *PassPointeeByValue*
Arthur Eubanks [Thu, 30 Apr 2020 01:50:17 +0000 (18:50 -0700)]
[NFC] Rename *ByValOrInalloca* to *PassPointeeByValue*

Summary: In preparation for preallocated.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Windows SEH] Fix abnormal-exits in _try
Aaron Smith [Thu, 30 Apr 2020 16:38:19 +0000 (09:38 -0700)]
[Windows SEH] Fix abnormal-exits in _try

Summary:
Per Windows SEH Spec, except _leave, all other early exits of a _try (goto/return/continue/break) are considered abnormal exits.  In those cases, the first parameter passes to its _finally funclet should be TRUE to indicate an abnormal-termination.

One way to implement abnormal exits in _try is to invoke Windows runtime _local_unwind() (MSVC approach) that will invoke _dtor funclet where abnormal-termination flag is always TRUE when calling _finally.  Obviously this approach is less optimal and is complicated to implement in Clang.

Clang today has a NormalCleanupDestSlot mechanism to dispatch multiple exits at the end of _try.  Since  _leave (or try-end fall-through) is always Indexed with 0 in that NormalCleanupDestSlot,  this fix takes the advantage of that mechanism and just passes NormalCleanupDest ID as 1st Arg to _finally.

Reviewers: rnk, eli.friedman, JosephTremoulet, asmith, efriedma

Reviewed By: efriedma

Subscribers: efriedma, cfe-commits

Tags: #clang

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

4 years ago[ELF][PPC64] Suppress toc-indirect to toc-relative relaxation if R_PPC64_TOC16_LO...
Fangrui Song [Sat, 18 Apr 2020 06:08:11 +0000 (23:08 -0700)]
[ELF][PPC64] Suppress toc-indirect to toc-relative relaxation if R_PPC64_TOC16_LO is seen

The current implementation assumes that R_PPC64_TOC16_HA is always followed
by R_PPC64_TOC16_LO_DS. This can break with R_PPC64_TOC16_LO:

  // Load the address of the TOC entry, instead of the value stored at that address
  addis 3, 2, .LC0@tloc@ha  # R_PPC64_TOC16_HA
  addi  3, 3, .LC0@tloc@l   # R_PPC64_TOC16_LO
  blr

which is used by boringssl's util/fipstools/delocate/delocate.go
https://github.com/google/boringssl/blob/master/crypto/fipsmodule/FIPS.md has some documentation.
In short, this tool converts an assembly file to avoid any potential relocations.
The distance to an input .toc is not a constant after linking, so it cannot use an `addis;ld` pair.
Instead, it jumps to a stub which loads the TOC entry address with `addis;addi`.

This patch checks the presence of R_PPC64_TOC16_LO and suppresses
toc-indirect to toc-relative relaxation if R_PPC64_TOC16_LO is seen.
This approach is conservative and loses some relaxation opportunities but is easy to implement.

  addis 3, 2, .LC0@toc@ha  # no relaxation
  addi  3, 3, .LC0@toc@l   # no relaxation
  li    9, 0
  addis 4, 2, .LC0@toc@ha  # can relax but suppressed
  ld    4, .LC0@toc@l(4)   # can relax but suppressed

Also note that interleaved R_PPC64_TOC16_HA and R_PPC64_TOC16_LO_DS is
possible and this patch accounts for that.

  addis 3, 2, .LC1@toc@ha  # can relax
  addis 4, 2, .LC2@toc@ha  # can relax
  ld    3, .LC1@toc@l(3)   # can relax
  ld    4, .LC2@toc@l(4)   # can relax

Reviewed By: #powerpc, sfertile

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

4 years agolit googletest.py: Don't raise StopIteration in generator
Hans Wennborg [Thu, 30 Apr 2020 13:03:22 +0000 (15:03 +0200)]
lit googletest.py: Don't raise StopIteration in generator

The intention here seems to be to end the generator function, but with
modern Python, raising StopIteration causes a runtime error
(https://www.python.org/dev/peps/pep-0479/).

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

4 years ago[clang-format] Fix Microsoft style for enums
Aaron Smith [Thu, 30 Apr 2020 16:11:54 +0000 (09:11 -0700)]
[clang-format] Fix Microsoft style for enums

Summary:
Before this change enums were formatted incorrectly for the Microsoft style.

[C++ Example]

    enum {
      one,
      two
    } three, four;

[Incorrectly Formatted]

    enum
    {
      one,
      two
    } three,
        four;

[Correct Format with Patch]

    enum
    {
      one,
      two
    } three, four;

Reviewers: jbcoe, MyDeveloperDay, rnk

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

4 years ago[libc++] Make the verify-support feature implicit
Louis Dionne [Mon, 27 Apr 2020 16:49:01 +0000 (12:49 -0400)]
[libc++] Make the verify-support feature implicit

Tests that require support for Clang-verify are already marked as such
explicitly by their extension, which is .verify.cpp. Requiring the use
of an explicit Lit feature is, after thought, not really helpful.

This is a change in design: we have been bitten in the past by tests not
being enabled when we thought they were. However, the issue was mostly
with file extensions being ignored. The fix for that is not to blindly
require explicit features all the time, but instead to report all files
that are in the suite but that don't match any known test format. This
can be implemented in a follow-up patch.

4 years ago[obj2yaml][test] Move tests to binary format specific subdirectories
Fangrui Song [Thu, 30 Apr 2020 04:56:51 +0000 (21:56 -0700)]
[obj2yaml][test] Move tests to binary format specific subdirectories

Similar to D70264.
Create COFF/, ELF/, MachO/, Minidump/, XCOFF/, and move tests there.

Reviewed By: grimar, jhenderson, labath

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

4 years ago[InlineCost] Addressing a very strict assert check in CostAnnotationWriter::emitInstr...
Kirill Naumov [Thu, 30 Apr 2020 15:09:51 +0000 (15:09 +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.
This is a recommit as the original commit fail due to the absence of REQUIRES: assert in the test.

Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D79107

4 years ago[X86] Extend combine-bitselect tests
Simon Pilgrim [Thu, 30 Apr 2020 15:23:53 +0000 (16:23 +0100)]
[X86] Extend combine-bitselect tests

Add AVX512VL tests and v2i64/v8i64 mask broadcast tests that match the existing v4i64 versions

4 years ago[X86] combineANDXORWithAllOnesIntoANDNP - add BROADCAST handling
Simon Pilgrim [Thu, 30 Apr 2020 14:10:25 +0000 (15:10 +0100)]
[X86] combineANDXORWithAllOnesIntoANDNP - add BROADCAST handling

Fold BROADCAST(NOT(Y)) -> BROADCAST(Y) as part of finding a NOT inversion.

4 years ago[AddressSanitizer] Instrument byval call arguments
Jann Horn [Thu, 30 Apr 2020 09:05:01 +0000 (11:05 +0200)]
[AddressSanitizer] Instrument byval call arguments

Summary:
In the LLVM IR, "call" instructions read memory for each byval operand.
For example:

```
$ cat blah.c
struct foo { void *a, *b, *c; };
struct bar { struct foo foo; };
void func1(const struct foo);
void func2(struct bar *bar) { func1(bar->foo); }
$ [...]/bin/clang -S -flto -c blah.c -O2 ; cat blah.s
[...]
define dso_local void @func2(%struct.bar* %bar) local_unnamed_addr #0 {
entry:
  %foo = getelementptr inbounds %struct.bar, %struct.bar* %bar, i64 0, i32 0
  tail call void @func1(%struct.foo* byval(%struct.foo) align 8 %foo) #2
  ret void
}
[...]
$ [...]/bin/clang -S -c blah.c -O2 ; cat blah.s
[...]
func2:                                  # @func2
[...]
        subq    $24, %rsp
[...]
        movq    16(%rdi), %rax
        movq    %rax, 16(%rsp)
        movups  (%rdi), %xmm0
        movups  %xmm0, (%rsp)
        callq   func1
        addq    $24, %rsp
[...]
        retq
```

Let ASAN instrument these hidden memory accesses.

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

Reviewers: kcc, glider

Reviewed By: glider

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
Jann Horn [Thu, 30 Apr 2020 09:05:00 +0000 (11:05 +0200)]
[AddressSanitizer] Refactor: Permit >1 interesting operands per instruction

Summary:
Refactor getInterestingMemoryOperands() so that information about the
pointer operand is returned through an array of structures instead of
passing each piece of information separately by-value.

This is in preparation for returning information about multiple pointer
operands from a single instruction.

A side effect is that, instead of repeatedly generating the same
information through isInterestingMemoryAccess(), it is now simply collected
once and then passed around; that's probably more efficient.

HWAddressSanitizer has a bunch of copypasted code from AddressSanitizer,
so these changes have to be duplicated.

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

[glider: renamed llvm::InterestingMemoryOperand::Type to OpType to fix
GCC compilation]

Reviewers: kcc, glider

Reviewed By: glider

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

4 years ago[AddressSanitizer] Split out memory intrinsic handling
Jann Horn [Thu, 30 Apr 2020 09:04:55 +0000 (11:04 +0200)]
[AddressSanitizer] Split out memory intrinsic handling

Summary:
In both AddressSanitizer and HWAddressSanitizer, we first collect
instructions whose operands should be instrumented and memory intrinsics,
then instrument them. Both during collection and when inserting
instrumentation, they are handled separately.

Collect them separately and instrument them separately. This is a bit
more straightforward, and prepares for collecting operands instead of
instructions in a future patch.

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

Reviewers: kcc, glider

Reviewed By: glider

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

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

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

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

Reviewers: kcc, glider

Reviewed By: glider

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoClean up warnings after a2c8cd18128d3529992a86998d2bea80cceafff0
Benjamin Kramer [Thu, 30 Apr 2020 15:00:18 +0000 (17:00 +0200)]
Clean up warnings after a2c8cd18128d3529992a86998d2bea80cceafff0

4 years ago[CMake] Fix cross-compiling with LLVM as CMake subproject
Sebastian Neubauer [Mon, 27 Apr 2020 09:40:31 +0000 (11:40 +0200)]
[CMake] Fix cross-compiling with LLVM as CMake subproject

When embedding LLVM as a CMake subproject, using cross-compiling does
not work at the moment. This also affects -DLLVM_OPTIMIZED_TABLEGEN=1,
which uses the same CMake infrastructure.

This patch replaces global CMake variables with the current version,
which allows cross-compilation to work in a subproject.

CMAKE_BINARY_DIR -> CMAKE_CURRENT_BINARY_DIR
CMAKE_SOURCE_DIR -> CMAKE_CURRENT_SOURCE_DIR
CMAKE_PROJECT_NAME -> PROJECT_NAME

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

4 years ago[clangd] Get rid of move semantics to unbreak windows build bots
Kadir Cetinkaya [Thu, 30 Apr 2020 14:40:56 +0000 (16:40 +0200)]
[clangd] Get rid of move semantics to unbreak windows build bots

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

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

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

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

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

Summary: This reverts commit cfb5f89b62f885a7a50b1dd49a0cb5532fc75176.

Reviewers: kcc, thejh

Subscribers:

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

SUMMARY:

emit .extern and .weak directive linkage

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

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

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

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

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

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

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

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

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

Reviewers: kcc, glider

Reviewed By: glider

Subscribers: jfb, hiraditya, llvm-commits

Tags: #llvm

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

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

This commit marks AllocLikeOp as MemAlloc in StandardOps.

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

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

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

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

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

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

Reviewed By: hubert.reinterpretcast

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

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

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

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

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

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

This patch moves these to DAGCombine's generic MatchFunnelPosNeg.

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

Reviewed By: @spatel

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

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

As discussed on D78935

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

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

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

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

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

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

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

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

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

Reviewers: efriedma, sdesmalen

Reviewed By: efriedma, sdesmalen

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

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

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

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

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

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

Reviewers: sdesmalen, efriedma, rengolin

Reviewed By: efriedma

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

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

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

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

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

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

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

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

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

Reviewed By: MyDeveloperDay, Wawha

Patch By: duncan-llvm

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

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

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

Reviewers: MyDeveloperDay

Reviewed By: MyDeveloperDay

Patch By:  duncan-llvm

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

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

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

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

where this explicit return type is required for SFINAE.

Reviewed By: krasimir, MyDeveloperDay

Patch By: johnchen902

Subscribers: krasimir, dexonsmith, cfe-commits

Tags: #clang-format, #clang

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

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

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

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

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

Reviewed By: Abpostelnicu

Subscribers: tstellar, hans, Abpostelnicu, cfe-commits

Tags: #clang, #clang-format

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

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

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

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

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

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

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

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

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

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

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

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

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

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

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

Reviewers: skatkov

Reviewed By: skatkov

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

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

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

Reviewers: clayborg, dblaikie

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

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

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

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

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

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

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

Reviewers: sammccall

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

Tags: #clang

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

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

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

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

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

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

Reviewers: skatkov, yrouban, taewookoh

Reviewed By: skatkov

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

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

Reviewers: skatkov, taewookoh, yrouban

Reviewed By: skatkov

Subscribers: hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

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

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

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

Reviewed By: Meinersbur

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

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

Reviewers: rnk

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

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

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

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

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

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

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

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

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

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

Reviewed By: grimar

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

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

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

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