platform/upstream/llvm.git
3 years ago[AArch64] Fix Copy Elemination for negative values
Tomas Matheson [Fri, 18 Dec 2020 13:29:50 +0000 (13:29 +0000)]
[AArch64] Fix Copy Elemination for negative values

Redundant Copy Elimination was eliminating a MOVi32imm -1 when it
determined that the value of the destination register is already -1.
However, it didn't take into account that the MOVi32imm zeroes the upper
32 bits (which are FFFFFFFF) and therefore cannot be eliminated.

Reviewed By: paulwalker-arm

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

3 years ago[NFC][SVE] Clean up bfloat isel patterns that emit non-bfloat instructions.
Paul Walker [Wed, 16 Dec 2020 14:58:20 +0000 (14:58 +0000)]
[NFC][SVE] Clean up bfloat isel patterns that emit non-bfloat instructions.

During isel there's no need to protect illegal types. Patch also
adds a missing unit test for tbl2 intrinsic using bfloat types.

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

3 years ago[gn build] Port e69e551e0e5
LLVM GN Syncbot [Fri, 18 Dec 2020 13:00:09 +0000 (13:00 +0000)]
[gn build] Port e69e551e0e5

3 years agoNo longer reject tag declarations in the clause-1 of a for loop.
Aaron Ballman [Fri, 18 Dec 2020 12:53:39 +0000 (07:53 -0500)]
No longer reject tag declarations in the clause-1 of a for loop.

We currently reject this valid C construct by claiming it declares a
non-local variable: for (struct { int i; } s={0}; s.i != 0; s.i--) ;

We expected all declaration in the clause-1 declaration statement to be
a local VarDecl, but there can be other declarations involved such as a
tag declaration. This fixes PR35757.

3 years ago[LLDB] Unbreak the build after recent clang changes
David Zarzycki [Fri, 18 Dec 2020 11:04:50 +0000 (06:04 -0500)]
[LLDB] Unbreak the build after recent clang changes

9e08e51a20d0d2b1c5724bb17e969d036fced4cd introduced a new enum case.

3 years agonew altera single work item barrier check
Frank Derry Wanye [Fri, 18 Dec 2020 12:49:48 +0000 (07:49 -0500)]
new altera single work item barrier check

This lint check is a part of the FLOCL (FPGA Linters for OpenCL)
project out of the Synergy Lab at Virginia Tech.

FLOCL is a set of lint checks aimed at FPGA developers who write code
in OpenCL.

The altera single work item barrier check finds OpenCL kernel functions
that call a barrier function but do not call an ID function. These
kernel functions will be treated as single work-item kernels, which
could be inefficient or lead to errors.

Based on the "Altera SDK for OpenCL: Best Practices Guide."

3 years ago[clangd] Ignore the static index refs from the dynamic index files.
Aleksandr Platonov [Fri, 18 Dec 2020 12:14:15 +0000 (15:14 +0300)]
[clangd] Ignore the static index refs from the dynamic index files.

This patch fixes the following problem:
- open a file with references to the symbol `Foo`
- remove all references to `Foo` (from the dynamic index).
- `MergedIndex::refs()` result will contain positions of removed references (from the static index).

The idea of this patch is to keep a set of files which were used during index build inside the index.
Thus at processing the static index references we can check if the file of processing reference is a part of the dynamic index or not.

Reviewed By: sammccall

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

3 years ago[lldb/test] Reduce boilerplate in lldb-server tests
Pavel Labath [Thu, 10 Dec 2020 14:52:00 +0000 (15:52 +0100)]
[lldb/test] Reduce boilerplate in lldb-server tests

Nearly all of our lldb-server tests have two flavours (lldb-server and
debugserver). Each of them is tagged with an appropriate decorator, and
each of them starts with a call to a matching "init" method. The init
calls are mandatory, and it's not possible to meaningfully combine them
with a different decorator.

This patch leverages the existing decorators to also tag the tests with
the appropriate debug server tag, similar to how we do with debug info
flavours. This allows us to make the "init" calls from inside the common
setUp method.

3 years ago[SVE][CodeGen] Vector + immediate addressing mode for masked gather/scatter
Kerry McLaughlin [Fri, 18 Dec 2020 11:04:41 +0000 (11:04 +0000)]
[SVE][CodeGen] Vector + immediate addressing mode for masked gather/scatter

This patch extends LowerMGATHER/MSCATTER to make use of the vector + reg/immediate
addressing modes for scalable masked gathers & scatters.

selectGatherScatterAddrMode checks if the base pointer is null, in which case
we can swap the base pointer and the index, e.g.
     getelementptr nullptr, <vscale x N x T> (splat(%offset)) + %indices)
  -> getelementptr %offset, <vscale x N x T> %indices

Reviewed By: david-arm

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

3 years ago[X86][AVX] Replace extract_subvector(broadcast(), 0) folds with generic SimplifyDeman...
Simon Pilgrim [Fri, 18 Dec 2020 01:01:39 +0000 (01:01 +0000)]
[X86][AVX] Replace extract_subvector(broadcast(), 0) folds with generic SimplifyDemandedVectorEltsForTargetNode handling.

Simplifies a few more cases, notably shuffle demanded elts cases.

3 years ago[AMDGPU][NFC] Remove unused Hi16Elt definition
Carl Ritson [Fri, 18 Dec 2020 11:05:46 +0000 (20:05 +0900)]
[AMDGPU][NFC] Remove unused Hi16Elt definition

3 years ago[AArch64] Add support for the SPE-EEF feature
Lucas Prates [Fri, 20 Nov 2020 16:07:26 +0000 (16:07 +0000)]
[AArch64] Add support for the SPE-EEF feature

This is an addition to the existing Statistical Profiling extension, which
introduces an extra system register that is enabled by the new 'spe-eef'
subtarget feature.

Patch written by Simon Tatham.

Reviewed By: ostannard

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

3 years ago[AArch64] Add support for the Branch Record Buffer extension
Lucas Prates [Thu, 19 Nov 2020 15:57:15 +0000 (15:57 +0000)]
[AArch64] Add support for the Branch Record Buffer extension

This introduces asm support for the Branch Record Buffer extension, through
the new 'brbe' subtarget feature. It consists of a new set of system registers
that enable the handling of branch records.

Patch written by Simon Tatham.

Reviewed By: ostannard

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

3 years ago[AMDGPU][NFC] Document high parameter of f16 interp intrinsics
Carl Ritson [Fri, 18 Dec 2020 10:56:16 +0000 (19:56 +0900)]
[AMDGPU][NFC] Document high parameter of f16 interp intrinsics

3 years ago[TTI] Add supportsScalableVectors target hook
Cullen Rhodes [Tue, 8 Dec 2020 17:40:13 +0000 (17:40 +0000)]
[TTI] Add supportsScalableVectors target hook

This is split off from D91718 and adds a new target hook
supportsScalableVectors that can be queried to check if scalable vectors
are supported by the backend. For AArch64 this returns true if SVE is
enabled.

Reviewed By: david-arm

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

3 years ago[clangd] Add hot-reload of compile_commands.json and compile_flags.txt
Sam McCall [Fri, 4 Dec 2020 08:09:03 +0000 (09:09 +0100)]
[clangd] Add hot-reload of compile_commands.json and compile_flags.txt

When querying the CDB, we stat the underlying file to check it hasn't changed.
We don't do this every time, but only if we didn't check within 5 seconds.

This behavior only exists for compile_commands.json and compile_flags.txt.
The CDB plugin system doesn't expose enough information to handle others.

Slight behavior change: we now only look for `build/compile_commands.json`
rather than trying every CDB strategy under `build` subdirectories.

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

3 years agoAdd intrinsics for saturating float to int casts
Bjorn Pettersson [Thu, 17 Dec 2020 20:33:32 +0000 (21:33 +0100)]
Add intrinsics for saturating float to int casts

This patch adds support for the fptoui.sat and fptosi.sat intrinsics,
which provide basically the same functionality as the existing fptoui
and fptosi instructions, but will saturate (or return 0 for NaN) on
values unrepresentable in the target type, instead of returning
poison. Related mailing list discussion can be found at:
https://groups.google.com/d/msg/llvm-dev/cgDFaBmCnDQ/CZAIMj4IBAAJ

The intrinsics have overloaded source and result type and support
vector operands:

    i32 @llvm.fptoui.sat.i32.f32(float %f)
    i100 @llvm.fptoui.sat.i100.f64(double %f)
    <4 x i32> @llvm.fptoui.sat.v4i32.v4f16(half %f)
    // etc

On the SelectionDAG layer two new ISD opcodes are added,
FP_TO_UINT_SAT and FP_TO_SINT_SAT. These opcodes have two operands
and one result. The second operand is an integer constant specifying
the scalar saturation width. The idea here is that initially the
second operand and the scalar width of the result type are the same,
but they may change during type legalization. For example:

    i19 @llvm.fptsi.sat.i19.f32(float %f)
    // builds
    i19 fp_to_sint_sat f, 19
    // type legalizes (through integer result promotion)
    i32 fp_to_sint_sat f, 19

I went for this approach, because saturated conversion does not
compose well. There is no good way of "adjusting" a saturating
conversion to i32 into one to i19 short of saturating twice.
Specifying the saturation width separately allows directly saturating
to the correct width.

There are two baseline expansions for the fp_to_xint_sat opcodes. If
the integer bounds can be exactly represented in the float type and
fminnum/fmaxnum are legal, we can expand to something like:

    f = fmaxnum f, FP(MIN)
    f = fminnum f, FP(MAX)
    i = fptoxi f
    i = select f uo f, 0, i # unnecessary if unsigned as 0 = MIN

If the bounds cannot be exactly represented, we expand to something
like this instead:

    i = fptoxi f
    i = select f ult FP(MIN), MIN, i
    i = select f ogt FP(MAX), MAX, i
    i = select f uo f, 0, i # unnecessary if unsigned as 0 = MIN

It should be noted that this expansion assumes a non-trapping fptoxi.

Initial tests are for AArch64, x86_64 and ARM. This exercises all of
the scalar and vector legalization. ARM is included to test float
softening.

Original patch by @nikic and @ebevhan (based on D54696).

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

3 years ago[IndVars] A test for adding trunc instructions to unwind blocks
Yevgeny Rouban [Fri, 18 Dec 2020 10:03:05 +0000 (17:03 +0700)]
[IndVars] A test for adding trunc instructions to unwind blocks

Differential Revision: https://reviews.llvm.org/D93521
Reviewed By: skatkov

3 years ago[flang][driver] Add support for `-fsyntax-only`
Andrzej Warzynski [Tue, 8 Dec 2020 16:27:46 +0000 (16:27 +0000)]
[flang][driver] Add support for `-fsyntax-only`

The behaviour triggered with this flag is consistent with `-fparse-only`
in `flang` (i.e. the throwaway driver). This new spelling is consistent
with Clang and gfortran, and was proposed and agreed on for the new
driver in [1].

This patch also adds some minimal logic to communicate whether the
semantic checks have failed or not. When semantic checks fail, a
frontend driver error is generated. The return code from the frontend
driver is then determined by checking the driver diagnostics - the
presence of driver errors means that the compilation has failed. This
logic is consistent with `clang -cc1`.

[1] http://lists.llvm.org/pipermail/flang-dev/2020-November/000588.html

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

3 years ago[clang][cli] Port CodeGenOpts simple string flags to new option parsing system
Jan Svoboda [Fri, 18 Dec 2020 09:15:08 +0000 (10:15 +0100)]
[clang][cli] Port CodeGenOpts simple string flags to new option parsing system

Depends on D84668

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

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

3 years ago[libcxx] Fix the preexisting directory_iterator code for windows
Martin Storsjö [Wed, 4 Nov 2020 14:48:00 +0000 (16:48 +0200)]
[libcxx] Fix the preexisting directory_iterator code for windows

The directory_iterator.cpp file did contain an incomplete,
non-working implementation for windows.

Change it to use the wchar version of the APIs.

Don't set the windows specific errors from GetLastError() as code
in the generic category; remap the errors to the std::errc values.

Error out cleanly on empty paths.

Invoke FindFirstFile on <directoryname>/* to actually list the
entries of the directory.

If the first entry retured by FindFirstFile is to be skipped (e.g.
being "." or ".."), call advance() (which calls FindNextFile and loops)
which doesn't return until a valid entry is found (or the end is
reached).

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

3 years ago[libcxx] Convert paths to/from the right narrow code page for narrow strings on windows
Martin Storsjö [Tue, 27 Oct 2020 11:30:34 +0000 (13:30 +0200)]
[libcxx] Convert paths to/from the right narrow code page for narrow strings on windows

On windows, the narrow, char based paths normally don't use utf8, but
can use many different native code pages, and this is what system
functions that operate on files, taking such paths/file names, interpret
them as.

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

3 years ago[libcxx] Reorder the two u8path functions, to make the following diff more readable...
Martin Storsjö [Wed, 4 Nov 2020 22:21:30 +0000 (00:21 +0200)]
[libcxx] Reorder the two u8path functions, to make the following diff more readable. NFC.

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

3 years ago[libcxx] Make filesystem::path::value_type wchar_t on windows
Martin Storsjö [Tue, 27 Oct 2020 11:09:08 +0000 (13:09 +0200)]
[libcxx] Make filesystem::path::value_type wchar_t on windows

Also set the preferred separator to backslash.

libc++ doesn't compile successfully for windows prior to this change,
and this change on its own isn't enough to make it compile successfully
either, but is the first stepping stone towards making it work correctly.

Most of operations.cpp will need to be touched, both for calling
functions that take wchar paths, but also for using other windows
specific functions instead of the posix functions used so far; that is
handled in later commits.

Changing parts of operations.cpp to generalize the string type handling
in code that doesn't touch system functions.

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

3 years agoMake Expr::HasSideEffect more precise for instantiation-dependent
Richard Smith [Fri, 18 Dec 2020 08:55:19 +0000 (00:55 -0800)]
Make Expr::HasSideEffect more precise for instantiation-dependent
expressions.

Fixes a regression in the clang-tidy test suite from making DeclRefExprs
referring to dependent declarations be instantiation-dependent.

3 years ago[c++20] P1907R1: Support for generalized non-type template arguments of scalar type.
Richard Smith [Sat, 7 Nov 2020 02:14:41 +0000 (18:14 -0800)]
[c++20] P1907R1: Support for generalized non-type template arguments of scalar type.

3 years ago[clang][cli] Port FrontendOpts simple string based options to new option parsing...
Jan Svoboda [Fri, 18 Dec 2020 08:59:17 +0000 (09:59 +0100)]
[clang][cli] Port FrontendOpts simple string based options to new option parsing system

Depends on D84189

Reviewed By: dexonsmith

Original patch by Daniel Grumberg.

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

3 years ago[clang][cli] Port PreprocessorOpts simple string based options to new option parsing...
Jan Svoboda [Wed, 16 Dec 2020 15:03:00 +0000 (16:03 +0100)]
[clang][cli] Port PreprocessorOpts simple string based options to new option parsing system

Depends on D84671

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

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

3 years ago[clang][cli] Port LangOpts simple string based options to new option parsing system
Jan Svoboda [Wed, 16 Dec 2020 13:26:45 +0000 (14:26 +0100)]
[clang][cli] Port LangOpts simple string based options to new option parsing system

Depends on D84670

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

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

3 years ago[clang][cli] Port TargetOpts simple string based options to new option parsing system
Jan Svoboda [Wed, 16 Dec 2020 12:17:24 +0000 (13:17 +0100)]
[clang][cli] Port TargetOpts simple string based options to new option parsing system

Depends on D84190

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

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

3 years ago[InlineCost] Implement cost-benefit-based inliner
Kazu Hirata [Fri, 18 Dec 2020 08:37:24 +0000 (00:37 -0800)]
[InlineCost] Implement cost-benefit-based inliner

This patch adds an alternative cost metric for the inliner to take
into account both the cost (i.e. size) and cycle count savings into
account.

Without this patch, we decide to inline a given call site if the size
of inlining the call site is below the threshold that is computed
according to the hotness of the call site.

This patch adds a new cost metric, turned off by default, to take over
the handling of hot call sites.  Specifically, with the new cost
metric, we decide to inline a given call site if the ratio of cycle
savings to size exceeds a threshold.  The cycle savings are computed
from call site costs, parameter propagation, folded conditional
branches, etc, all weighted by their respective profile counts.  The
size is primarily the callee size, but we subtract call site costs and
the size of basic blocks that are never executed.

The new cost metric implicitly takes advantage of the machine function
splitter recently introduced by Snehasish Kumar, which dramatically
reduces the cost of duplicating (e.g. inlining) cold basic blocks by
placing cold basic blocks of hot functions in the .text.split
section.

We evaluated the new cost metric on clang bootstrap and SPECInt 2017.

For clang bootstrap, we observe 0.69% runtime improvement.

For SPECInt we report the change in IntRate the C/C++ benchmarks.  All
benchmarks apart from perlbench and omnetpp improve, on average by
0.21% with the max for mcf at 1.96%.

Benchmark               % Change
500.perlbench_r         -0.45
502.gcc_r                0.13
505.mcf_r                1.96
520.omnetpp_r           -0.28
523.xalancbmk_r          0.49
525.x264_r               0.00
531.deepsjeng_r          0.00
541.leela_r              0.35
557.xz_r                 0.21

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

3 years ago[clang][cli] Port HeaderSearch simple string options to new option parsing system
Jan Svoboda [Wed, 16 Dec 2020 12:28:28 +0000 (13:28 +0100)]
[clang][cli] Port HeaderSearch simple string options to new option parsing system

Depends on D84669

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

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

3 years ago[libc][NFC] Use `#include <math.h>` in utils/FPUtil/ManipulationFunctions.h.
Siva Chandra Reddy [Fri, 18 Dec 2020 07:40:18 +0000 (23:40 -0800)]
[libc][NFC] Use `#include <math.h>` in utils/FPUtil/ManipulationFunctions.h.

This reverts commit 352cba2441c6c4e00f067c9c68358cc0a6a5fffb.
"add back math.h #include utils/FPUtil/ManipulationFunctions.h".

Using `<math.h>` correct so downstream setup should be fixed.

3 years ago[clang][cli] Convert Analyzer option string based options to new option parsing system
Jan Svoboda [Wed, 16 Dec 2020 12:14:50 +0000 (13:14 +0100)]
[clang][cli] Convert Analyzer option string based options to new option parsing system

Depends on D84185

Reviewed By: dexonsmith

Original patch by Daniel Grumberg.

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

3 years agoFollowing up on PR48517, fix handling of template arguments that refer
Richard Smith [Wed, 16 Dec 2020 21:51:56 +0000 (13:51 -0800)]
Following up on PR48517, fix handling of template arguments that refer
to dependent declarations.

Treat an id-expression that names a local variable in a templated
function as being instantiation-dependent.

This addresses a language defect whereby a reference to a dependent
declaration can be formed without any construct being value-dependent.
Fixing that through value-dependence turns out to be problematic, so
instead this patch takes the approach (proposed on the core reflector)
of allowing the use of pointers or references to (but not values of)
dependent declarations inside value-dependent expressions, and instead
treating template arguments as dependent if they evaluate to a constant
involving such dependent declarations.

This ends up affecting a bunch of OpenMP tests, due to OpenMP
imprecisely handling instantiation-dependent constructs, bailing out
early instead of processing dependent constructs to the extent possible
when handling the template.

3 years ago[PowerPC] Select the D-Form load if we know its offset meets the requirement
QingShan Zhang [Fri, 18 Dec 2020 07:27:26 +0000 (07:27 +0000)]
[PowerPC] Select the D-Form load if we know its offset meets the requirement

The LD/STD likewise instruction are selected only when the alignment in
the load/store >= 4 to deal with the case that the offset might not be
known(i.e. relocations). That means we have to select the X-Form load
for %0 = load i64, i64* %arrayidx, align 2 In fact, we can still select
the D-Form load if the offset is known. So, we only query the load/store
alignment when we don't know if the offset is a multiple of 4.

Reviewed By: jji, Nemanjai

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

3 years agoEnsure that we transform types into the current instantiation even if
Richard Smith [Fri, 18 Dec 2020 07:16:31 +0000 (23:16 -0800)]
Ensure that we transform types into the current instantiation even if
they're only instantiation-dependent.

3 years agoWhere possible, don't try to ask whether a template argument is
Richard Smith [Thu, 16 Jul 2020 02:38:46 +0000 (19:38 -0700)]
Where possible, don't try to ask whether a template argument is
dependent until it's been converted to match its parameter.

The type of a non-type template parameter can in general affect whether
the template argument is dependent.

Note that this is not always possible. For template arguments that name
static local variables in templates, the type of the template parameter
affects whether the argument is dependent, so the query is imprecise
until we know the parameter type. For example, in:

template<typename T> void f() {
  static const int n = 5;
  typename T::template X<n> x;
}

... we don't know whether 'n' is dependent until we know whether the
corresponding template parameter is of type 'int' or 'const int&'.

3 years agoDR2064: decltype(E) is only a dependent type if E is type-dependent, not
Richard Smith [Thu, 17 Dec 2020 22:36:26 +0000 (14:36 -0800)]
DR2064: decltype(E) is only a dependent type if E is type-dependent, not
if E is merely instantiation-dependent.

3 years ago[libc][NFC] Use ASSERT_FP_EQ to comapre NaN values in tests.
Siva Chandra Reddy [Fri, 18 Dec 2020 06:55:18 +0000 (22:55 -0800)]
[libc][NFC] Use ASSERT_FP_EQ to comapre NaN values in tests.

This is a continuation of the previous CL which did a similar change in
other tests. To elaborate a little about why we need this - under C++
compilation with headers not from LLVM libc, libraries like libc++ and
libstdc++ provide their own math.h which undefine macros like `isnan`
and provide the overloaded C++ isnan functions which return a boolean
value instead of an integer value returned by the isnan macro.

3 years ago[LLD] Rename lld port driver entry function to a consistent name
Reshabh Sharma [Fri, 18 Dec 2020 06:39:01 +0000 (12:09 +0530)]
[LLD] Rename lld port driver entry function to a consistent name

Libraries linked to the lld elf library exposes a function named main.
When debugging code linked to such libraries and intending to set a
breakpoint at main, the debugger also sets breakpoint at the main
function at lld elf driver. The possible choice was to rename it to
link but that would again clash with lld::*::link. This patch tries
to consistently rename them to linkerMain.

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

3 years ago[NFC][utils] Factor remaining APIs under FunctionTestBuilder
Mircea Trofin [Fri, 18 Dec 2020 03:01:56 +0000 (19:01 -0800)]
[NFC][utils] Factor remaining APIs under FunctionTestBuilder

Finishing the refactoring started in D93413.

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

3 years ago[IndVars] Fix adding trunc instructions to unwind blocks
Yevgeny Rouban [Fri, 18 Dec 2020 05:47:13 +0000 (12:47 +0700)]
[IndVars] Fix adding trunc instructions to unwind blocks

Truncate instruction must not be inserted before landing pads.
The insertion point is fixed.

3 years agoPR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of
Richard Smith [Fri, 18 Dec 2020 05:27:11 +0000 (21:27 -0800)]
PR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of
the nested-name-specifier when determining whether a qualified type is
instantiation-dependent.

3 years ago[lld-macho][nfc] Refactor to accommodate paired relocs
Greg McGary [Wed, 14 Oct 2020 16:49:54 +0000 (09:49 -0700)]
[lld-macho][nfc] Refactor to accommodate paired relocs

This is a refactor to pave the way for supporting paired-ADDEND for ARM64. The only paired reloc type for X86_64 is SUBTRACTOR. In a later diff, I will add SUBTRACTOR for both X86_64 and ARM64.

* s/`getImplicitAddend`/`getAddend`/ because it handles all forms of addend: implicit, explicit, paired.
* add predicate `bool isPairedReloc()`
* check range of `relInfo.r_symbolnum` is internal, unrelated to user-input, so use `assert()`, not `error()`
* minor cleanups & rearrangements in `InputFile::parseRelocations()`

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

3 years ago[IVDescriptors] Remove getConsecutiveDirection (NFC)
Kazu Hirata [Fri, 18 Dec 2020 04:19:14 +0000 (20:19 -0800)]
[IVDescriptors] Remove getConsecutiveDirection (NFC)

The last use of the function was removed on Sep 18, 2016 in commit
5f8cc0c3469ba3a7aa440b43aaababa3a6274213.

The function was later moved to llvm/lib/Analysis/IVDescriptors.cpp on
Sep 12, 2018 in commit 7e98d69847aefb1028aaa7131b508f4b4e9896ae.

3 years ago[Transforms] Use llvm::erase_if (NFC)
Kazu Hirata [Fri, 18 Dec 2020 03:53:09 +0000 (19:53 -0800)]
[Transforms] Use llvm::erase_if (NFC)

3 years ago[RISCV] Remove NoVReg to avoid compile warning messages.
Hsiangkai Wang [Fri, 18 Dec 2020 03:37:23 +0000 (11:37 +0800)]
[RISCV] Remove NoVReg to avoid compile warning messages.

3 years agoFix clang-ppc64le-rhel buildbot build error
Rong Xu [Fri, 18 Dec 2020 03:13:19 +0000 (19:13 -0800)]
Fix clang-ppc64le-rhel buildbot build error

ix buildbot build error due to
commit 3733463d: [IR][PGO] Add hot func attribute and use hot/cold
attribute in func section

3 years ago[flang] Fix -intrinsic-module-directory in flang script
Tim Keith [Fri, 18 Dec 2020 03:08:15 +0000 (19:08 -0800)]
[flang] Fix -intrinsic-module-directory in flang script

The flang wrapper script that was created as bin/flang in an in-tree
build did not have a correct -intrinsic-module-directory option.
It was correct for out-of-tree builds and for both kinds of installs.

The fix is to pick the correct directory based on what exists.

The script is no longer configured by cmake (just copied) so that
mechanism can be deleted from the cmake file.

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

3 years ago[IR][PGO] Add hot func attribute and use hot/cold attribute in func section
Rong Xu [Fri, 18 Dec 2020 01:30:41 +0000 (17:30 -0800)]
[IR][PGO] Add hot func attribute and use hot/cold attribute in func section

Clang FE currently has hot/cold function attribute. But we only have
cold function attribute in LLVM IR.

This patch adds support of hot function attribute to LLVM IR.  This
attribute will be used in setting function section prefix/suffix.
Currently .hot and .unlikely suffix only are added in PGO (Sample PGO)
compilation (through isFunctionHotInCallGraph and
isFunctionColdInCallGraph).

This patch changes the behavior. The new behavior is:
(1) If the user annotates a function as hot or isFunctionHotInCallGraph
    is true, this function will be marked as hot. Otherwise,
(2) If the user annotates a function as cold or
    isFunctionColdInCallGraph is true, this function will be marked as
    cold.

The changes are:
(1) user annotated function attribute will used in setting function
    section prefix/suffix.
(2) hot attribute overwrites profile count based hotness.
(3) profile count based hotness overwrite user annotated cold attribute.

The intention for these changes is to provide the user a way to mark
certain function as hot in cases where training input is hard to cover
all the hot functions.

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

3 years ago[RISCV] Define vsadd/vsaddu/vssub/vssubu intrinsics.
Monk Chiang [Thu, 17 Dec 2020 05:45:52 +0000 (13:45 +0800)]
[RISCV] Define vsadd/vsaddu/vssub/vssubu intrinsics.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Co-Authored-by: Monk Chiang <monk.chiang@sifive.com>
Reviewed By: craig.topper

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

3 years ago[DAGCombiner] Improve shift by select of constant
Layton Kifer [Fri, 18 Dec 2020 02:21:42 +0000 (02:21 +0000)]
[DAGCombiner] Improve shift by select of constant

Clean up a TODO, to support folding a shift of a constant by a
select of constants, on targets with different shift operand sizes.

Reviewed By: RKSimon, lebedev.ri

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

3 years ago[clangd] Print .clang-tidy configuration parsing errors using [ev]?log.
Nathan James [Fri, 18 Dec 2020 02:07:26 +0000 (02:07 +0000)]
[clangd] Print .clang-tidy configuration parsing errors using [ev]?log.

Currently warnings when parsing .clang-tidy are printed directly to errs.
This is less than ideal as there is no synchronisation printing to errs, leading to potential races.

Reviewed By: sammccall

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

3 years ago[lld-macho] Implement option: -undefined TREATMENT
Greg McGary [Mon, 14 Dec 2020 03:31:33 +0000 (19:31 -0800)]
[lld-macho] Implement option: -undefined TREATMENT

TREATMENT can be `error`, `warning`, `suppress`, or `dynamic_lookup`
The `dymanic_lookup` remains unimplemented for now.

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

3 years ago[IRSim][IROutliner] Adding InstVisitor to disallow certain operations.
Andrew Litteken [Mon, 31 Aug 2020 19:55:38 +0000 (14:55 -0500)]
[IRSim][IROutliner] Adding InstVisitor to disallow certain operations.

This adds a custom InstVisitor to return false on instructions that
should not be allowed to be outlined.  These match the illegal
instructions in the IRInstructionMapper with exception of the addition
of the llvm.assume intrinsic.

Tests all the tests marked: illegal-*-.ll with a test for each kind of
instruction that has been marked as illegal.

Reviewers: jroelofs, paquette

Differential Revisions: https://reviews.llvm.org/D86976

3 years ago[mlir] Remove the MutableDictionaryAttr class
River Riddle [Fri, 18 Dec 2020 01:10:12 +0000 (17:10 -0800)]
[mlir] Remove the MutableDictionaryAttr class

This class used to serve a few useful purposes:
* Allowed containing a null DictionaryAttr
* Provided some simple mutable API around a DictionaryAttr

The first of which is no longer an issue now that there is much better caching support for attributes in general, and a cache in the context for empty dictionaries. The second results in more trouble than it's worth because it mutates the internal dictionary on every action, leading to a potentially large number of dictionary copies. NamedAttrList is a much better alternative for the second use case, and should be modified as needed to better fit it's usage as a DictionaryAttrBuilder.

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

3 years ago[RISCV] Define vlse/vsse intrinsics.
Zakk Chen [Thu, 17 Dec 2020 05:59:09 +0000 (21:59 -0800)]
[RISCV] Define vlse/vsse intrinsics.

Define vlse/vsse intrinsics and lower to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>
Reviewed By: craig.topper

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

3 years agoRevert "[sanitizer-common] Force pickup of llvm-symbolizer from new binaries."
Mitch Phillips [Fri, 18 Dec 2020 00:09:43 +0000 (16:09 -0800)]
Revert "[sanitizer-common] Force pickup of llvm-symbolizer from new binaries."

This reverts commit 66ee0d3d84a6ea04e895249aef2ea8a812664728.

Broke the bots, reverting for full fix.

3 years agoRevert "[sanitizer-common] Pickup llvm-symbolizer from $OUT/bin IFF exists."
Mitch Phillips [Fri, 18 Dec 2020 00:09:28 +0000 (16:09 -0800)]
Revert "[sanitizer-common] Pickup llvm-symbolizer from $OUT/bin IFF exists."

This reverts commit 30d292ddbb7ec84b422738cf52ee0cf49b0369f3.

Broke the bots, reverting for full fix.

3 years ago[mlir][sparse] scalarize reductions in for-loops during sparse codegen
Aart Bik [Thu, 17 Dec 2020 23:42:23 +0000 (15:42 -0800)]
[mlir][sparse] scalarize reductions in for-loops during sparse codegen

Reductions in innermost loops become harder for the backend to disambiguate
after bufferization into memrefs, resulting in less efficient load-update-store
cycles. By scalarizing innermost reductions, the backend is more likely to assign
a register to perform the reduction (also prepares vectorization). Even though
we could scalarize reductions for more outer loops and while-loops as well,
currently scalarization is only done for chains of innermost for-loops, where
it matters most, to avoid complicating codegen unnecessary (viz. adding lots
of yield instructions).

This CL also refactors condition simplification into the merger class,
where it belongs, so that conditions are simplified only once per loop
nest and not repeatedly as was currently done. This CL also fixes a few
minor bugs, some layout issues, and comments.

Reviewed By: penpornk

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

3 years agoRemove unneeded header include (NFC)
Mehdi Amini [Fri, 18 Dec 2020 00:09:51 +0000 (00:09 +0000)]
Remove unneeded header include (NFC)

3 years ago[mlir] Move `std.tensor_cast` -> `tensor.cast`.
Sean Silva [Wed, 16 Dec 2020 00:47:19 +0000 (16:47 -0800)]
[mlir] Move `std.tensor_cast` -> `tensor.cast`.

This is almost entirely mechanical.

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

3 years agoWorkaround around clang 5.0 bug by including SmallVector.h in LLVM.h (PR41549)
Mehdi Amini [Thu, 17 Dec 2020 23:53:19 +0000 (23:53 +0000)]
Workaround around clang 5.0 bug by including SmallVector.h in LLVM.h (PR41549)

The forward declaration for SmallVector does not play well with clang-5.

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

3 years ago[mlir][Linalg] Define a linalg.init_tensor operation.
MaheshRavishankar [Thu, 17 Dec 2020 22:42:40 +0000 (14:42 -0800)]
[mlir][Linalg] Define a linalg.init_tensor operation.

This operation is used to materialize a tensor of a particular
shape. The shape could be specified as a mix of static and dynamic
values.

The use of this operation is to be an `init` tensor for Linalg
structured operation on tensors where the bounds of the computation
depends on the shape of the output of the linalg operation. The result
of this operation will be used as the `init` tensor of such Linalg
operations. To note,

1) The values in the tensor materialized is not used. Any operation to
   which this is an init tensor is expected to overwrite the entire
   tensor.
2) The tensor is materialized only for the shape of the output and to
   make the loop bounds depend only on operands of the structured
   operation.

Based on (1) and (2) it is assumed that these operations eventually go
away since they are only used in `dim` operations that can be
canonicalized to make this operation dead. Such canonicalization are
added here too.

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

3 years ago[mlir] Add canonicalization from `tensor_cast` to `dim` op.
MaheshRavishankar [Thu, 17 Dec 2020 22:42:33 +0000 (14:42 -0800)]
[mlir] Add canonicalization from `tensor_cast` to `dim` op.

Fold a `tensor_cast` -> `dim` to take the `dim` of the original tensor.

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

3 years ago[DSE] Add test for potential caching bug (NFC)
Nikita Popov [Thu, 17 Dec 2020 22:31:31 +0000 (23:31 +0100)]
[DSE] Add test for potential caching bug (NFC)

This one would miscompile if read-clobber checks switched to using
the EarlierAccess location, but the read cache was retained.

3 years agoCodeGen: Improve generated IR for __builtin_mul_overflow(uint, uint, int)
Tom Stellard [Thu, 17 Dec 2020 18:43:00 +0000 (10:43 -0800)]
CodeGen: Improve generated IR for __builtin_mul_overflow(uint, uint, int)

Add a special case for handling __builtin_mul_overflow with unsigned
inputs and a signed output to avoid emitting the __muloti4 library
call on x86_64.  __muloti4 is not implemented in libgcc, so avoiding
this call fixes compilation of some programs that call
__builtin_mul_overflow with these arguments.

For example, this fixes the build of cpio with clang, which includes code from
gnulib that calls __builtin_mul_overflow with these argument types.

Reviewed By: vsk

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

3 years ago[VectorCombine] add tests for gep load with cast; NFC
Sanjay Patel [Thu, 17 Dec 2020 17:03:55 +0000 (12:03 -0500)]
[VectorCombine] add tests for gep load with cast; NFC

3 years ago[SimplifyCFG] Teach simplifyUnreachable() to preserve DomTree
Roman Lebedev [Thu, 17 Dec 2020 18:30:37 +0000 (21:30 +0300)]
[SimplifyCFG] Teach simplifyUnreachable() to preserve DomTree

Pretty boring, removeUnwindEdge() already known how to update DomTree,
so if we are to call it, we must first flush our own pending updates;
otherwise, we just stop predecessors from branching to us,
and for certain predecessors, stop their predecessors from
branching to them also.

3 years ago[SimplifyCFG] ConstantFoldTerminator() already knows how to preserve DomTree
Roman Lebedev [Thu, 17 Dec 2020 17:13:03 +0000 (20:13 +0300)]
[SimplifyCFG] ConstantFoldTerminator() already knows how to preserve DomTree

... so just ensure that we pass DomTreeUpdater it into it.

Fixes DomTree preservation for a number of tests,
all of which are marked as such so that they do not regress.

3 years ago[SimplifyCFG] DeleteDeadBlock() already knows how to preserve DomTree
Roman Lebedev [Thu, 17 Dec 2020 16:57:42 +0000 (19:57 +0300)]
[SimplifyCFG] DeleteDeadBlock() already knows how to preserve DomTree

... so just ensure that we pass DomTreeUpdater it into it.

Fixes DomTree preservation for a large number of tests,
all of which are marked as such so that they do not regress.

3 years agoFix -Wno-error= parsing in clang-format.
Joachim Meyer [Thu, 17 Dec 2020 15:06:56 +0000 (16:06 +0100)]
Fix -Wno-error= parsing in clang-format.

As noted in https://reviews.llvm.org/D86137#2460135 parsing of
the clang-format parameter -Wno-error=unknown fails.
This currently is done by having `-Wno-error=unknown` as an option.
In this patch this is changed to make `-Wno-error=` parse an enum into a bit set.
This way the parsing is fixed and also we can possibly add new options easily.

Reviewed By: MyDeveloperDay

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

3 years ago[libc++] Fix extern C for __sanitizer_annotate_contiguous_container() (for gcc)
Azat Khuzhin [Thu, 17 Dec 2020 21:19:50 +0000 (16:19 -0500)]
[libc++] Fix extern C for __sanitizer_annotate_contiguous_container() (for gcc)

gcc supports it only at the beginning:

    $ g++ -o /dev/null -c /tmp/test_extern.cpp
    $ cat /tmp/test_extern.cpp
    extern "C" __attribute__ ((__visibility__("default"))) int foo();

Otherwise:

    $ g++ -o /dev/null -c /tmp/test_extern.cpp
    /tmp/test_extern.cpp:1:52: error: expected unqualified-id before string constant
        1 | __attribute__ ((__visibility__("default"))) extern "C" int foo();
          |                                                    ^~~
    $ cat /tmp/test_extern.cpp
    __attribute__ ((__visibility__("default"))) extern "C" int foo();

Reviewed By: #libc, ldionne

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

3 years agolld: Replace some lld::outs()s with message()
Nico Weber [Thu, 17 Dec 2020 21:19:06 +0000 (16:19 -0500)]
lld: Replace some lld::outs()s with message()

No behavior change.

3 years ago[mlir][IR][NFC] Move context/location parameters of builtin Type::get methods to...
River Riddle [Thu, 17 Dec 2020 20:24:45 +0000 (12:24 -0800)]
[mlir][IR][NFC] Move context/location parameters of builtin Type::get methods to the start of the parameter list

This better matches the rest of the infrastructure, is much simpler, and makes it easier to move these types to being declaratively specified.

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

3 years agoRevert "Ensure SplitEdge to return the new block between the two given blocks"
Bangtian Liu [Thu, 17 Dec 2020 21:00:20 +0000 (21:00 +0000)]
Revert "Ensure SplitEdge to return the new block between the two given blocks"

This reverts commit d20e0c3444ad9ada550d9d6d1d56fd72948ae444.

3 years ago[mlir] Partially update the conversion-to-llvm document
Alex Zinenko [Thu, 17 Dec 2020 20:38:15 +0000 (21:38 +0100)]
[mlir] Partially update the conversion-to-llvm document

This document was not updated after the LLVM dialect type system had been
reimplemented and was using an outdated syntax. Rewrite the part of the
document that concerns type conversion and prepare the ground for splitting it
into a document that explains how built-in types are converted and a separate
document that explains how standard types and functions are converted, which
will better correspond to the fact that built-in types do not belong to the
standard dialect.

Reviewed By: rriddle

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

3 years agoclang-cl: Remove /Zd flag
Nico Weber [Thu, 17 Dec 2020 14:23:02 +0000 (09:23 -0500)]
clang-cl: Remove /Zd flag

cl.exe doesn't understand Zd (in either MSVC 2017 or 2019), so neiter
should we. It used to do the same as `-gline-tables-only` which is
exposed as clang-cl flag as well, so if you want this behavior, use
`gline-tables-only`. That makes it clear that it's a clang-cl-only flag
that won't work with cl.exe.

Motivated by the discussion in D92958.

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

3 years ago[gn build] Link with -Wl,--gdb-index when linking with LLD
Nico Weber [Tue, 8 Dec 2020 14:35:58 +0000 (09:35 -0500)]
[gn build] Link with -Wl,--gdb-index when linking with LLD

For full-debug-info (is_debug=true / symbol_level=2 builds), this makes
linking 15% slower, but gdb startup 1500% faster (for lld: link time
3.9s->4.4s, gdb load time >30s->2s).

For link time, I ran

    bench.py -o {noindex,index}.txt \
        sh -c 'rm out/gn/bin/lld && ninja -C out/gn lld'

and then `ministat noindex.txt index.txt`:

```
x noindex.txt
+ index.txt
    N           Min           Max        Median           Avg        Stddev
x   5      3.784461     4.0200169     3.8452811     3.8754988   0.089902595
+   5       4.32496     4.6058481     4.3361208     4.4141198    0.12288267
Difference at 95.0% confidence
0.538621 +/- 0.15702
13.8981% +/- 4.05161%
(Student's t, pooled s = 0.107663)
```

For gdb load time I loaded the crash in PR48392 with

    gdb -ex r --args ../out/gn/bin/ld64.lld.darwinnew @response.txt

and just stopped the time until the crash got displayed with a stopwatch
a few times. So the speedup there is less precise, but it's so
pronounced that that's ok (loads ~instantly with the patch, takes a very
long time without it).

Only doing this for LLD because I haven't tried it with other linkers.

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

3 years ago[OpenMP][NFC] Provide a new remark and documentation
Johannes Doerfert [Thu, 17 Dec 2020 02:29:26 +0000 (20:29 -0600)]
[OpenMP][NFC] Provide a new remark and documentation

If a GPU function is externally reachable we give up trying to find the
(unique) kernel it is called from. This can hinder optimizations. Emit a
remark and explain mitigation strategies.

Reviewed By: tianshilei1992

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

3 years ago[AttrDocs] document always_inline
Nick Desaulniers [Thu, 17 Dec 2020 20:34:01 +0000 (12:34 -0800)]
[AttrDocs] document always_inline

GNU documentaion for always_inline:
https://gcc.gnu.org/onlinedocs/gcc/Inline.html

GNU documentation for function attributes:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html

Microsoft documentation for __force_inline:
https://docs.microsoft.com/en-us/cpp/cpp/inline-functions-cpp

Reviewed By: ojeda

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

3 years ago[mlir][ArmSVE] Add documentation generation
Javier Setoain [Thu, 17 Dec 2020 20:15:41 +0000 (12:15 -0800)]
[mlir][ArmSVE] Add documentation generation

Adds missing cmake command to generate documentation for ArmSVE
Dialect.

Reviewed By: aartbik

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

3 years ago[gn build] (manually) merge f4c8b8031800
Nico Weber [Thu, 17 Dec 2020 20:09:51 +0000 (15:09 -0500)]
[gn build] (manually) merge f4c8b8031800

3 years ago[DSE] Add more tests for read clobber location (NFC)
Nikita Popov [Thu, 17 Dec 2020 19:39:46 +0000 (20:39 +0100)]
[DSE] Add more tests for read clobber location (NFC)

3 years ago[test] Factor out creation of copy of SCC Nodes into function
Arthur Eubanks [Thu, 17 Dec 2020 01:14:13 +0000 (17:14 -0800)]
[test] Factor out creation of copy of SCC Nodes into function

Reviewed By: rnk

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

3 years agoFix NDEBUG build after https://reviews.llvm.org/D93005.
Christian Sigg [Thu, 17 Dec 2020 19:35:48 +0000 (20:35 +0100)]
Fix NDEBUG build after https://reviews.llvm.org/D93005.

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

3 years ago[NFC][AMDGPU] Reorganize description of scratch handling
Tony [Thu, 17 Dec 2020 02:45:47 +0000 (02:45 +0000)]
[NFC][AMDGPU] Reorganize description of scratch handling

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

3 years ago[mlir][LLVMIR] Add 'llvm.switch' op
Brian Gesiak [Thu, 10 Dec 2020 03:37:20 +0000 (22:37 -0500)]
[mlir][LLVMIR] Add 'llvm.switch' op

The LLVM IR 'switch' instruction allows control flow to be transferred
to one of any number of branches depending on an integer control value,
or a default value if the control does not match any branch values. This patch
adds `llvm.switch` to the MLIR LLVMIR dialect, as well as translation routines
for lowering it to LLVM IR.

To store a variable number of operands for a variable number of branch
destinations, the new op makes use of the `AttrSizedOperandSegments`
trait. It stores its default branch operands as one segment, and all
remaining case branches' operands as another. It also stores pairs of
begin and end offset values to delineate the sub-range of each case branch's
operands. There's probably a better way to implement this, since the
offset computation complicates several parts of the op definition. This is the
approach I settled on because in doing so I was able to delegate to the default
op builder member functions. However, it may be preferable to instead specify
`skipDefaultBuilders` in the op's ODS, or use a completely separate
approach; feedback is welcome!

Another contentious part of this patch may be the custom printer and
parser functions for the op. Ideally I would have liked the MLIR to be
printed in this way:

```
llvm.switch %0, ^bb1(%1 : !llvm.i32) [
  1: ^bb2,
  2: ^bb3(%2, %3 : !llvm.i32, !llvm.i32)
]
```

The above would resemble how LLVM IR is formatted for the 'switch'
instruction. But I found it difficult to print and parse something like
this, whether I used the declarative assembly format or custom functions.
I also was not sure a multi-line format would be welcome -- it seems
like most MLIR ops do not use newlines. Again, I'd be happy to hear any
feedback here as well, or on any other aspect of the patch.

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

3 years ago[openmp] Remove clause from OMPKinds.def and use OMP.td info
Valentin Clement [Thu, 17 Dec 2020 19:07:29 +0000 (14:07 -0500)]
[openmp] Remove clause from OMPKinds.def and use OMP.td info

Remove the OpenMP clause information from the OMPKinds.def file and use the
information from the new OMP.td file. There is now a single source of truth for the
directives and clauses.

To avoid generate lots of specific small code from tablegen, the macros previously
used in OMPKinds.def are generated almost as identical. This can be polished and
possibly removed in a further patch.

Reviewed By: jdoerfert

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

3 years ago[WebAssembly][lld] Don't mark a file live from an undefine symbol
Derek Schuff [Thu, 17 Dec 2020 18:25:11 +0000 (10:25 -0800)]
[WebAssembly][lld] Don't mark a file live from an undefine symbol

Live symbols should only cause the files in which they are defined
to become live.

For now this is only tested in emscripten: we're continuing
to work on reducing the test case further for an lld-style
unit test.

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

3 years ago[OpenMP] Add definitions for 5.1 interop to omp.h
Hansang Bae [Thu, 17 Dec 2020 00:18:12 +0000 (18:18 -0600)]
[OpenMP] Add definitions for 5.1 interop to omp.h

3 years agoscudo: Adjust test to use correct check for primary allocations.
Peter Collingbourne [Wed, 16 Dec 2020 19:24:30 +0000 (11:24 -0800)]
scudo: Adjust test to use correct check for primary allocations.

canAllocate() does not take into account the header size so it does
not return the right answer in borderline cases. There was already
code handling this correctly in isTaggedAllocation() so split it out
into a separate function and call it from the test.

Furthermore the test was incorrect when MTE is enabled because MTE
does not pattern fill primary allocations. Fix it.

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

3 years agoAdd brief description of dialects doc section.
Richard Uhler [Thu, 17 Dec 2020 18:37:26 +0000 (18:37 +0000)]
Add brief description of dialects doc section.

Reviewed By: jpienaar

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

3 years ago[PowerPC] Rename the vector pair intrinsics and builtins to replace the _mma_ prefix...
Baptiste Saleil [Thu, 17 Dec 2020 18:18:43 +0000 (13:18 -0500)]
[PowerPC] Rename the vector pair intrinsics and builtins to replace the _mma_ prefix by _vsx_

On PPC, the vector pair instructions are independent from MMA.
This patch renames the vector pair LLVM intrinsics and Clang builtins to replace the _mma_ prefix by _vsx_ in their names.
We also move the vector pair type/intrinsic/builtin tests to their own files.

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

3 years ago[scudo][standalone] Allow the release of smaller sizes
Kostya Kortchinsky [Fri, 11 Dec 2020 22:04:47 +0000 (14:04 -0800)]
[scudo][standalone] Allow the release of smaller sizes

Initially we were avoiding the release of smaller size classes due to
the fact that it was an expensive operation, particularly on 32-bit
platforms. With a lot of batches, and given that there are a lot of
blocks per page, this was a lengthy operation with little results.

There has been some improvements since then to the 32-bit release,
and we still have some criterias preventing us from wasting time
(eg, 9x% free blocks in the class size, etc).

Allowing to release blocks < 128 bytes helps in situations where a lot
of small chunks would not have been reclaimed if not for a forced
reclaiming.

Additionally change some `CHECK` to `DCHECK` and rearrange a bit the
code.

I didn't experience any regressions in my benchmarks.

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

3 years agoAdd call site location getter to C API
George [Thu, 17 Dec 2020 17:27:17 +0000 (09:27 -0800)]
Add call site location getter to C API

Reviewed By: ftynse

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

3 years ago[gn build] Port dae34463e3e
LLVM GN Syncbot [Thu, 17 Dec 2020 17:28:45 +0000 (17:28 +0000)]
[gn build] Port dae34463e3e

3 years ago[IRSim][IROutliner] Adding the extraction basics for the IROutliner.
Andrew Litteken [Tue, 15 Sep 2020 23:05:38 +0000 (18:05 -0500)]
[IRSim][IROutliner] Adding the extraction basics for the IROutliner.

Extracting the similar regions is the first step in the IROutliner.

Using the IRSimilarityIdentifier, we collect the SimilarityGroups and
sort them by how many instructions will be removed.  Each
IRSimilarityCandidate is used to define an OutlinableRegion.  Each
region is ordered by their occurrence in the Module and the regions that
are not compatible with previously outlined regions are discarded.

Each region is then extracted with the CodeExtractor into its own
function.

We test that correctly extract in:
test/Transforms/IROutliner/extraction.ll
test/Transforms/IROutliner/address-taken.ll
test/Transforms/IROutliner/outlining-same-globals.ll
test/Transforms/IROutliner/outlining-same-constants.ll
test/Transforms/IROutliner/outlining-different-structure.ll

Recommit of bf899e891387d07dfd12de195ce2a16f62afd5e0 fixing memory
leaks.

Reviewers: paquette, jroelofs, yroux

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

3 years ago[gn build] Add symbol_level to adjust debug info level
Arthur Eubanks [Wed, 9 Dec 2020 19:51:00 +0000 (11:51 -0800)]
[gn build] Add symbol_level to adjust debug info level

is_debug by default makes symbol_level = 2 and !is_debug means by
default symbol_level = 0.

Reviewed By: thakis

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