platform/upstream/llvm.git
2 years ago[AArch64][SVE] Add fixed type lowering for EXTRACT_SUBVECTOR
Bradley Smith [Tue, 5 Oct 2021 12:20:58 +0000 (12:20 +0000)]
[AArch64][SVE] Add fixed type lowering for EXTRACT_SUBVECTOR

Depends on D111135

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

2 years ago[clang] p0388 array list initialization overloads
Nathan Sidwell [Fri, 21 May 2021 18:34:23 +0000 (11:34 -0700)]
[clang] p0388 array list initialization overloads

This is the second part of p0388, dealing with overloads of list
initialization to incomplete array types.  It extends the handling
added in D103088 to permit incomplete arrays.  We have to record that
the conversion involved an incomplete array, and so (re-add) a bit flag
into the standard conversion sequence object.  Comparing such
conversion sequences requires knowing (a) the number of array elements
initialized and (b) whether the initialization is of an incomplete array.

This also updates the web page to indicate p0388 is implemented (there
is no feature macro).

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

2 years ago[clang] p0388 conversion to incomplete array
Nathan Sidwell [Thu, 20 May 2021 20:31:31 +0000 (13:31 -0700)]
[clang] p0388 conversion to incomplete array

This implements the new implicit conversion sequence to an incomplete
(unbounded) array type.  It is mostly Richard Smith's work, updated to
trunk, testcases added and a few bugs fixed found in such testing.

It is not a complete implementation of p0388.

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

2 years ago[clang-tidy] Update documentation of check bugprone-unused-return-value [NFC].
Balázs Kéri [Tue, 12 Oct 2021 14:43:16 +0000 (16:43 +0200)]
[clang-tidy] Update documentation of check bugprone-unused-return-value [NFC].

The list of checked functions was incomplete in the description.

Reviewed By: aaron.ballman, steakhal

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

2 years ago[mlir][linalg] Add vector transfer lowering patters to codegen strategy.
Tobias Gysi [Tue, 12 Oct 2021 13:50:25 +0000 (13:50 +0000)]
[mlir][linalg] Add vector transfer lowering patters to codegen strategy.

Add the vector transfer patterns and introduce the max transfer rank option on the codegen strategy.

Reviewed By: nicolasvasilache

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

2 years ago[lldb/lua] Supplement Lua bindings for lldb module
Siger Yang [Tue, 12 Oct 2021 14:08:05 +0000 (22:08 +0800)]
[lldb/lua] Supplement Lua bindings for lldb module

Add necessary typemaps for Lua bindings, together with some other files.

Signed-off-by: Siger Yang <sigeryeung@gmail.com>
Reviewed By: tammela

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

2 years agoRemove 'IgnoreDestructors = true' from cppcoreguidelines-explicit-virtual-functions
Carlos Galvez [Tue, 12 Oct 2021 14:05:43 +0000 (10:05 -0400)]
Remove 'IgnoreDestructors = true' from cppcoreguidelines-explicit-virtual-functions

This requirement was introduced in the C++ Core guidelines in 2016:

https://github.com/isocpp/CppCoreGuidelines/commit/1894380d0abf4d7d49a983005647e0d41ecbf214

Then clang-tidy got updated to comply with the rule.

However in 2019 this decision was reverted:

https://github.com/isocpp/CppCoreGuidelines/commit/5fdfb20b760c5307bf86873798a146fcd7e912e6

Therefore we need to apply the correct configuration to
clang-tidy again.

This also makes this cppcoreguidelines check consistent
with the other 2 alias checks: hicpp-use-override and
modernize-use-override.

Additionally, add another RUN line to the unit test,
to make sure cppcoreguidelines-explicit-virtual-functions
is tested.

2 years ago[PowerPC] Allow MMA built-ins to accept restrict and volatile qualified pointers
Ahsan Saghir [Mon, 13 Sep 2021 01:48:48 +0000 (20:48 -0500)]
[PowerPC] Allow MMA built-ins to accept restrict and volatile qualified pointers

This patch allows MMA built-ins on PowerPC to accept restrict
and volatile qualified pointers.

Reviewed By: #powerpc, nemanjai

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

2 years agoAdd self to .mailmap
Hans Wennborg [Tue, 12 Oct 2021 13:51:01 +0000 (15:51 +0200)]
Add self to .mailmap

2 years ago[lldb/lua] Force Lua version to be 5.3
Siger Yang [Tue, 12 Oct 2021 13:02:21 +0000 (21:02 +0800)]
[lldb/lua] Force Lua version to be 5.3

Due to CMake cache, find_package in FindLuaAndSwig.cmake
will be ignored. This commit adds EXACT and REQUIRED flags
to it and removes find_package in Lua ScriptInterpreter.

Signed-off-by: Siger Yang <sigeryeung@gmail.com>
Reviewed By: tammela, JDevlieghere

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

2 years ago[mlir][Vector][Bigfix] Fix vector transfer to store lowering to insert a proper...
Nicolas Vasilache [Tue, 12 Oct 2021 13:27:41 +0000 (13:27 +0000)]
[mlir][Vector][Bigfix] Fix vector transfer to  store lowering to insert a proper ExtractOp

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

2 years ago[lldb] [gdb-remote] Fix displaying i387_ext & vec regs with gdbserver
Michał Górny [Fri, 20 Aug 2021 10:11:45 +0000 (12:11 +0200)]
[lldb] [gdb-remote] Fix displaying i387_ext & vec regs with gdbserver

Adjust the encoding and format applied to i387_ext and vec* type
registers from gdbserver to match lldb-server.  Both types are now
displayed as vector of uint8 instead of float and integer formats used
before.  Additionally, this fixes display of STi registers when they do
not carry floating-point data (they are also used to hold MMX vectors).

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

2 years ago[clang] Omit most AttributedStatements from the CFG
Nico Weber [Mon, 11 Oct 2021 18:19:21 +0000 (14:19 -0400)]
[clang] Omit most AttributedStatements from the CFG

`[[clang::fallthrough]]` has meaning for the CFG, but all other
StmtAttrs we currently have don't. So omit them, as AttributedStatements
with children cause several issues and there's no benefit in including
them.

Fixes PR52103 and PR49454. See PR52103 for details.

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

2 years agomlir][Vector] Fix spuriously disabled test.
Nicolas Vasilache [Tue, 12 Oct 2021 12:56:40 +0000 (12:56 +0000)]
mlir][Vector] Fix spuriously disabled test.

2 years ago[mlir][Linalg] Refactor and improve vectorization to add support for reduction into...
Nicolas Vasilache [Tue, 12 Oct 2021 12:39:26 +0000 (12:39 +0000)]
[mlir][Linalg] Refactor and improve vectorization to add support for reduction into 0-d tensors.

This revision takes advantage of the recently added support for 0-d transfers and vector.multi_reduction that return a scalar.

Reviewed By: pifon2a

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

2 years ago[mlir][tensor] Add some folders for insert/extract slice ops
Lei Zhang [Tue, 12 Oct 2021 12:35:16 +0000 (08:35 -0400)]
[mlir][tensor] Add some folders for insert/extract slice ops

* Fold extract_slice immediately after insert_slice.
* Fold overlapping insert_slice.

Reviewed By: ThomasRaoux

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

2 years ago[mlir][Vector] NFC - Add test to exercise lowering of vector.transfer to scf
Nicolas Vasilache [Tue, 12 Oct 2021 12:35:55 +0000 (12:35 +0000)]
[mlir][Vector] NFC - Add test to exercise lowering of vector.transfer to scf

This revision also renames and moves some tests around.

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

2 years ago[X86] Fix implicit MathsExtras.h header dependency
Simon Pilgrim [Tue, 12 Oct 2021 12:23:02 +0000 (13:23 +0100)]
[X86] Fix implicit MathsExtras.h header dependency

2 years ago[mlir][Vector] Add support for lowering 0-d transfers to load/store.
Nicolas Vasilache [Tue, 12 Oct 2021 12:26:30 +0000 (12:26 +0000)]
[mlir][Vector] Add support for lowering 0-d transfers to load/store.

Reviewed By: pifon2a

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

2 years ago[LoopVectorize] Classify pointer induction updates as scalar only if they have one use
Kerry McLaughlin [Mon, 11 Oct 2021 10:06:36 +0000 (11:06 +0100)]
[LoopVectorize] Classify pointer induction updates as scalar only if they have one use

collectLoopScalars collects pointer induction updates in ScalarPtrs, assuming
that the instruction will be scalar after vectorization. This may crash later
in VPReplicateRecipe::execute() if there there is another user of the instruction
other than the Phi node which needs to be widened.

This changes collectLoopScalars so that if there are any other users of
Update other than a Phi node, it is not added to ScalarPtrs.

Reviewed By: david-arm, fhahn

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

2 years ago[mlir][Vector] Allow a 0-d for for vector transfer ops.
Nicolas Vasilache [Tue, 12 Oct 2021 11:37:55 +0000 (11:37 +0000)]
[mlir][Vector] Allow a 0-d for for vector transfer ops.

This revision updates the op semantics, printer, parser and verifier to allow 0-d transfers.
Until 0-d vectors are available, such transfers have a special form that transits through vector<1xt>.
This is a stepping stone towards the longer term work of adding 0-d vectors and will help significantly reduce corner cases in vectorization.

Transformations and lowerings do not yet support this form, extensions will follow.

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

2 years ago[mlir][Linalg] NFC - Refactor vector.broadcast op verification logic and make it...
Nicolas Vasilache [Tue, 12 Oct 2021 11:04:11 +0000 (11:04 +0000)]
[mlir][Linalg] NFC - Refactor vector.broadcast op verification logic and make it available as a precondition in Linalg vectorization.

Reviewed By: pifon2a

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

2 years ago[LoopPeel] Use any_of & contains instead of for & find.
Florian Hahn [Tue, 12 Oct 2021 11:13:45 +0000 (12:13 +0100)]
[LoopPeel] Use any_of & contains instead of for & find.

Using contains was suggested in D108114, but I forgot to include it when
landing the patch.

2 years ago[mlir][Vector] Let vector.multi_reduction reduce down to a scalar.
Nicolas Vasilache [Tue, 12 Oct 2021 10:30:10 +0000 (10:30 +0000)]
[mlir][Vector] Let vector.multi_reduction reduce down to a scalar.

vector.multi_reduction currently does not allow reducing down to a scalar.
This creates corner cases that are hard to handle during vectorization.
This revision extends the semantics and adds the proper transforms, lowerings and canonicalizations to allow lowering out of vector.multi_reduction to other abstractions all the way to LLVM.

In a future, where we will also allow 0-d vectors, scalars will still be relevant: 0-d vector and scalars are not equivalent on all hardware.

In the process, splice out the implementation patterns related to vector.multi_reduce into a new file.

Reviewed By: pifon2a

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

2 years ago[mlir][OpenMP] OpenMP Synchronization Hints stored as IntegerAttr
Shraiysh Vaishay [Tue, 12 Oct 2021 10:47:30 +0000 (10:47 +0000)]
[mlir][OpenMP] OpenMP Synchronization Hints stored as IntegerAttr

`hint-expression` is an IntegerAttr, because it can be a combination of multiple values from the enum `omp_sync_hint_t` (Section 2.17.12 of OpenMP 5.0)

Reviewed By: ftynse, kiranchandramohan

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

2 years ago[gn build] Port f4c1258d5633
LLVM GN Syncbot [Tue, 12 Oct 2021 10:50:41 +0000 (10:50 +0000)]
[gn build] Port f4c1258d5633

2 years ago[FuncSpec] Allow ConstExprs that are function pointers
Sjoerd Meijer [Tue, 12 Oct 2021 10:03:34 +0000 (11:03 +0100)]
[FuncSpec] Allow ConstExprs that are function pointers

This is a follow up of D110529 that disallowed constexprs. That change
introduced a regression as this also disallowed constexprs that are function
pointers, which is actually one of the motivating use cases that we do want to
support.

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

2 years ago[LoopPeel] Peel if it turns invariant loads dereferenceable.
Florian Hahn [Tue, 12 Oct 2021 10:10:40 +0000 (11:10 +0100)]
[LoopPeel] Peel if it turns invariant loads dereferenceable.

This patch adds a new cost heuristic that allows peeling a single
iteration off read-only loops, if the loop contains a load that

    1. is feeding an exit condition,
    2. dominates the latch,
    3. is not already known to be dereferenceable,
    4. and has a loop invariant address.

If all non-latch exits are terminated with unreachable, such loads
in the loop are guaranteed to be dereferenceable after peeling,
enabling hoisting/CSE'ing them.

This enables vectorization of loops with certain runtime-checks, like
multiple calls to `std::vector::at` if the vector is passed as pointer.

Reviewed By: mkazantsev

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

2 years ago[clang][deps] Prune unused header search paths
Jan Svoboda [Tue, 12 Oct 2021 10:23:38 +0000 (12:23 +0200)]
[clang][deps] Prune unused header search paths

To reduce the number of explicit builds of a single module, we can try to squash multiple occurrences of the module with different command-lines (and context hashes) by removing benign command-line options. The greatest contributors to benign differences between command-lines are the header search paths.

In this patch, the lookup cache in `HeaderSearch` is used to identify paths that were actually used when implicitly building the module during scanning. This information is serialized into the unhashed control block of the implicitly-built PCM. The dependency scanner then loads this and may use it to prune the header search paths before computing the context hash of the module and generating the command-line.

We could also prune the header search paths when serializing `HeaderSearchOptions` into the PCM. That way, we could do it only once instead of every load of the PCM file by dependency scanner. However, that would result in a PCM file whose contents don't produce the same context hash as the original build, which is probably highly surprising.

There is an alternative approach to storing extra information into the PCM: wire up preprocessor callbacks to capture the used header search paths on-the-fly during preprocessing of modularized headers (similar to what we currently do for the main source file and textual headers). Right now, that's not compatible with the fact that we do an actual implicit build producing PCM files during dependency scanning. The second run of dependency scanner loads the PCM from the first run, skipping the preprocessing altogether, which would result in different results between runs. We can revisit this approach when we stop building implicitly during dependency scanning.

Depends on D102923.

Reviewed By: dexonsmith

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

2 years ago[gn build] (manually) port f4c1258d5633
Nico Weber [Tue, 12 Oct 2021 10:34:34 +0000 (06:34 -0400)]
[gn build] (manually) port f4c1258d5633

2 years ago[mlir] Allow to use vformat utility with MLIR classes
Vladislav Vinogradov [Mon, 11 Oct 2021 14:02:03 +0000 (17:02 +0300)]
[mlir] Allow to use vformat utility with MLIR classes

Make `raw_ostream operator<<` follow const correctness semantic,
since it is a requirement of FormatVariadic implementation.

Reviewed By: rriddle

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

2 years ago[RISCV][Clang] Fix RISCV vector header comment.
jacquesguan [Tue, 12 Oct 2021 09:54:40 +0000 (09:54 +0000)]
[RISCV][Clang] Fix RISCV vector header comment.

Reviewed By: khchen

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

2 years ago[clang][lex] Remark on search path usage
Jan Svoboda [Tue, 12 Oct 2021 07:34:43 +0000 (09:34 +0200)]
[clang][lex] Remark on search path usage

For dependency scanning, it would be useful to collect header search paths (provided on command-line via `-I` and friends) that were actually used during preprocessing. This patch adds that feature to `HeaderSearch` along with a new remark that reports such paths as they get used.

Previous version of this patch tried to use the existing `LookupFileCache` to report used paths via `HitIdx`. That doesn't work for `ComputeUserEntryUsage` (which is intended to be called *after* preprocessing), because it indexes used search paths by the file name. This means the values get overwritten when the code contains `#include_next`.

Note that `HeaderSearch` doesn't use `HeaderSearchOptions::UserEntries` directly. Instead, `InitHeaderSearch` pre-processes them (adds platform-specific paths, removes duplicates, removes paths that don't exist) and creates `DirectoryLookup` instances. This means we need a mechanism for translating between those two. It's not possible to go from `DirectoryLookup` back to the original `HeaderSearch`, so `InitHeaderSearch` now tracks the relationships explicitly.

Depends on D111557.

Reviewed By: dexonsmith

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

2 years ago[libc++] Add an option to disable wide character support in libc++
Louis Dionne [Mon, 23 Aug 2021 19:32:36 +0000 (15:32 -0400)]
[libc++] Add an option to disable wide character support in libc++

Some embedded platforms do not wish to support the C library functionality
for handling wchar_t because they have no use for it. It makes sense for
libc++ to work properly on those platforms, so this commit adds a carve-out
of functionality for wchar_t.

Unfortunately, unlike some other carve-outs (e.g. random device), this
patch touches several parts of the library. However, despite the wide
impact of this patch, I still think it is important to support this
configuration since it makes it much simpler to port libc++ to some
embedded platforms.

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

2 years ago[mlir] Make ConversionTarget dynamic legality callbacks composable
Caitlyn Cano [Thu, 1 Jul 2021 20:41:51 +0000 (20:41 +0000)]
[mlir] Make ConversionTarget dynamic legality callbacks composable

* Change callback signature `bool(Operation *)` -> `Optional<bool>(Operation *)`
* addDynamicallyLegalOp add callback to the chain
* If callback returned empty `Optional` next callback in chain will be called

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

2 years ago[ELF][test] Add testing for dynamic TLS relocations in .debug_info
Andrew Ng [Thu, 7 Oct 2021 16:57:57 +0000 (17:57 +0100)]
[ELF][test] Add testing for dynamic TLS relocations in .debug_info

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

2 years ago[OpenCL] Add atomic_half type builtins
Sven van Haastregt [Tue, 12 Oct 2021 09:45:30 +0000 (10:45 +0100)]
[OpenCL] Add atomic_half type builtins

Add atomic_half types and builtins operating on the types from the
cl_ext_float_atomics extension.

Patch by Haonan Yang.

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

2 years ago[flang][OpenMP] Added test case for OpenMP 5.0 specification based semantic checks...
Nimish Mishra [Tue, 12 Oct 2021 09:41:29 +0000 (15:11 +0530)]
[flang][OpenMP] Added test case for OpenMP 5.0 specification based semantic checks for parallel sections construct

Parallel sections directive borrows the semantic checks from both sections directive and parallel directive. Semantic checks for both are merged in main branch; this test case is added to make sure correct semantic checks upon merging the two.

Reviewed By: kiranchandramohan

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

2 years ago[mlir] Fix AsmPrinter for types with sub elements
Vladislav Vinogradov [Mon, 11 Oct 2021 11:52:06 +0000 (14:52 +0300)]
[mlir] Fix AsmPrinter for types with sub elements

Call `printType(subElemType)` instead of `os << subElemType` for them.
It allows to handle type aliases inside complex types.

As a side effect, fixed `test.int` parsing.

Reviewed By: rriddle

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

2 years ago[mlir] Clean up boolean flags usage in LIT tests
Vladislav Vinogradov [Mon, 20 Sep 2021 14:35:57 +0000 (17:35 +0300)]
[mlir] Clean up boolean flags usage in LIT tests

* Call `llvm_canonicalize_cmake_booleans` for all CMake options,
  which are propagated to `lit.local.cfg` files.
* Use Python native boolean values instead of strings for such options.

This fixes the cases, when CMake variables have values other than `ON` (like `TRUE`).
This might happen due to IDE integration or due to CMake preset usage.

Reviewed By: ftynse

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

2 years ago[SelectionDAG] Fix typo in VPLoadStoreSDNode
Roger Ferrer Ibanez [Tue, 12 Oct 2021 08:27:01 +0000 (10:27 +0200)]
[SelectionDAG] Fix typo in VPLoadStoreSDNode

There is no code that uses this base class yet, hence the typo went
unnoticed when this class was added in D105871

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

2 years ago[flang] Add runtime interface for GET_ENVIRONMENT_VARIABLE
Diana Picus [Wed, 6 Oct 2021 10:56:10 +0000 (10:56 +0000)]
[flang] Add runtime interface for GET_ENVIRONMENT_VARIABLE

Split into 2 entry points, one for the length and one for the value.

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

2 years agoPre-commit pre-inc-disable.ll to avoid dead code
Qiu Chaofan [Tue, 12 Oct 2021 08:03:17 +0000 (16:03 +0800)]
Pre-commit pre-inc-disable.ll to avoid dead code

The case was added in 728e139, testing it outputs lxsibzx instead of
lbzux. Here we need some minimal update to avoid DCE in future patches.

2 years ago[clang][modules] Default `SourceLocation` parameter in `HeaderSearch::lookupModule`
Jan Svoboda [Tue, 12 Oct 2021 07:55:40 +0000 (09:55 +0200)]
[clang][modules] Default `SourceLocation` parameter in `HeaderSearch::lookupModule`

This fixes an LLDB build failure where the `ImportLoc` argument is missing: https://lab.llvm.org/buildbot#builders/68/builds/19975

This change also makes it possible to drop `SourceLocation()` in `Preprocessor::getCurrentModule`.

2 years ago[docs] List support for Armv9-A, Armv9.1-A and Armv9.2-A in LLVM and Clang
Victor Campos [Tue, 12 Oct 2021 07:41:07 +0000 (08:41 +0100)]
[docs] List support for Armv9-A, Armv9.1-A and Armv9.2-A in LLVM and Clang

Reviewed By: pratlucas

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

2 years ago[clang][modules] NFC: Propagate import `SourceLocation` into `HeaderSearch::lookupModule`
Jan Svoboda [Tue, 12 Oct 2021 07:04:37 +0000 (09:04 +0200)]
[clang][modules] NFC: Propagate import `SourceLocation` into `HeaderSearch::lookupModule`

This patch propagates the import `SourceLocation` into `HeaderSearch::lookupModule`. This enables remarks on search path usage (implemented in D102923) to point to the source code that initiated header search.

Reviewed By: dexonsmith

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

2 years ago[fir][NFC] Add two negative tests for needExternalNameMangling
Valentin Clement [Tue, 12 Oct 2021 07:24:58 +0000 (09:24 +0200)]
[fir][NFC] Add two negative tests for needExternalNameMangling

Add two test for needExternalNameMangling.
- One varibale in a function
- One namelist in a module

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

2 years ago[RISCV] Rename assembler mnemonic of unordered floating-point reductions for v1.0...
jacquesguan [Tue, 12 Oct 2021 06:46:46 +0000 (06:46 +0000)]
[RISCV] Rename assembler mnemonic of unordered floating-point reductions for v1.0-rc change

Rename vfredsum and vfwredsum to vfredusum and vfwredusum. Add aliases for vfredsum and vfwredsum.

Reviewed By: luismarques, HsiangKai, khchen, frasercrmck, kito-cheng, craig.topper

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

2 years ago[ORC] More attempts to work around compiler failures.
Lang Hames [Tue, 12 Oct 2021 05:32:07 +0000 (22:32 -0700)]
[ORC] More attempts to work around compiler failures.

Commit 731f991cdc4 seems to have helped, but did not catch all instances (see
https://lab.llvm.org/buildbot/#/builders/193/builds/104). Switch more inner
structs to C++98 initializers to work around the issue. Add FIXMEs to revisit
in the future.

2 years ago[ORC] Attempt to work around compile failure on some bots.
Lang Hames [Tue, 12 Oct 2021 05:19:46 +0000 (22:19 -0700)]
[ORC] Attempt to work around compile failure on some bots.

See e.g. https://lab.llvm.org/buildbot/#/builders/193/builds/98.

I think this failure is related to a C++ standard defect, 1397 --"Class
completeness in non-static data member initializers" [1]. If so, moving
to C++98 initialization should work around the issue.

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1397

2 years ago[Clang][Attr] rename btf_tag to btf_decl_tag
Yonghong Song [Mon, 11 Oct 2021 23:37:36 +0000 (16:37 -0700)]
[Clang][Attr] rename btf_tag to btf_decl_tag

Current btf_tag is applied to declaration only.
Per discussion in https://reviews.llvm.org/D111199,
we plan to introduce btf_type_tag attribute for types.
So rename btf_tag to btf_decl_tag to make it easily
differentiable from btf_type_tag.

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

2 years ago[NFC][LangRef] Update description for FuncFlags
modimo [Tue, 12 Oct 2021 05:03:32 +0000 (22:03 -0700)]
[NFC][LangRef] Update description for FuncFlags

Add the additional flags from D36850 as well as noInline/alwaysInline from previous changes.

Reviewed By: tejohnson

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

2 years ago[ORC] Add more explicit narrowing casts.
Lang Hames [Tue, 12 Oct 2021 04:59:22 +0000 (21:59 -0700)]
[ORC] Add more explicit narrowing casts.

This should fix the buildbot failure at
https://lab.llvm.org/buildbot/#/builders/187/builds/2140

2 years ago[gn build] Port 962a2479b57f
LLVM GN Syncbot [Tue, 12 Oct 2021 04:51:58 +0000 (04:51 +0000)]
[gn build] Port 962a2479b57f

2 years ago[ORC] Fix a typo in a variable name.
Lang Hames [Tue, 12 Oct 2021 04:50:46 +0000 (21:50 -0700)]
[ORC] Fix a typo in a variable name.

2 years agoRe-apply e50aea58d59, "Major JITLinkMemoryManager refactor". with fixes.
Lang Hames [Tue, 12 Oct 2021 03:55:30 +0000 (20:55 -0700)]
Re-apply e50aea58d59, "Major JITLinkMemoryManager refactor". with fixes.

Adds explicit narrowing casts to JITLinkMemoryManager.cpp.

Honors -slab-address option in llvm-jitlink.cpp, which was accidentally
dropped in the refactor.

This effectively reverts commit 6641d29b70993bce6dbd7e0e0f1040753d38842f.

2 years ago[CFE][Codegen] Remove CodeGenFunction::InitTempAlloca()
hsmahesha [Tue, 12 Oct 2021 04:34:06 +0000 (10:04 +0530)]
[CFE][Codegen] Remove CodeGenFunction::InitTempAlloca()

Sequel patch to https://reviews.llvm.org/D111316

Finally, remove the defintion of CodeGenFunction::InitTempAlloca().

Reviewed By: rjmccall

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

2 years agoBPF: rename BTF_KIND_TAG to BTF_KIND_DECL_TAG
Yonghong Song [Tue, 12 Oct 2021 00:11:22 +0000 (17:11 -0700)]
BPF: rename BTF_KIND_TAG to BTF_KIND_DECL_TAG

Per discussion in https://reviews.llvm.org/D111199,
the existing btf_tag attribute will be renamed to
btf_decl_tag. This patch updated BTF backend to
use btf_decl_tag attribute name and also
renamed BTF_KIND_TAG to BTF_KIND_DECL_TAG.

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

2 years ago[CFE][Codegen][In-progress] Remove CodeGenFunction::InitTempAlloca()
hsmahesha [Tue, 12 Oct 2021 04:31:31 +0000 (10:01 +0530)]
[CFE][Codegen][In-progress] Remove CodeGenFunction::InitTempAlloca()

Sequel patch to https://reviews.llvm.org/D111293.

Remove call to CodeGenFunction::InitTempAlloca() from OpenMP related
codegen part.

Also remove the metadata `!llvm.access.group` from the updated lit
tests.

Reviewed By: rjmccall

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

2 years ago[AMDGPU] Remove dead frame indices after sgpr spill.
hsmahesha [Tue, 12 Oct 2021 04:28:34 +0000 (09:58 +0530)]
[AMDGPU] Remove dead frame indices after sgpr spill.

All those frame indices which are dead after sgpr spill should be removed from
the function frame. Othewise, there is a side effect such as re-mapping of free
frame index ids by the later pass(es) like "stack slot coloring" which in turn
could mess-up with the book keeping of "frame index to VGPR lane".

Reviewed By: cdevadas

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

2 years ago[NFC][Attr] rename attribute btf_tag to btf_decl_tag
Yonghong Song [Mon, 11 Oct 2021 23:51:42 +0000 (16:51 -0700)]
[NFC][Attr] rename attribute btf_tag to btf_decl_tag

Per discussion in https://reviews.llvm.org/D111199,
the existing btf_tag attribute will be renamed to
btf_decl_tag. This patch mostly updated the Bitcode and
DebugInfo test cases with new attribute name.

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

2 years ago[llvm-jitlink] Fix a broken warning.
Lang Hames [Tue, 12 Oct 2021 03:53:15 +0000 (20:53 -0700)]
[llvm-jitlink] Fix a broken warning.

This warning should only be issued if -slab-page-size has not been used.

2 years ago[X86][ISel] Lowering llvm.thread.pointer
Freddy Ye [Tue, 12 Oct 2021 01:57:26 +0000 (09:57 +0800)]
[X86][ISel] Lowering llvm.thread.pointer

Reviewed By: pengfei

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

2 years ago[RISCV] Define _m intrinsics as builtins, instead of macros.
Hsiangkai Wang [Wed, 29 Sep 2021 07:34:57 +0000 (15:34 +0800)]
[RISCV] Define _m intrinsics as builtins, instead of macros.

In the original design, we levarage _mt intrinsics to define macros for
_m intrinsics. Such as,

```
__builtin_rvv_vadd_vv_i8m1_mt((vbool8_t)(op0), (vint8m1_t)(op1), (vint8m1_t)(op2), (vint8m1_t)(op3), (size_t)(op4), (size_t)VE_TAIL_AGNOSTIC)
```

However, we could not define generic interface for mask intrinsics any
more due to clang_builtin_alias only accepts clang builtins as its
argument.

In the example,

```
 __rvv_overloaded
 __attribute__((clang_builtin_alias(__builtin_rvv_vadd_vv_i8m1_mt)))
  vint8m1_t vadd(vbool8_t op0, vint8m1_t op1, vint8m1_t op2, vint8m1_t
  op3, size_t op4, size_t op5);
```

op5 is the tail policy argument. When users want to use vadd generic
interface for masked vector add, they need to specify tail policy in the
previous design. In this patch, we define _m intrinsics as clang
builtins to solve the problem.

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

2 years agoRevert "[JITLink][ORC] Major JITLinkMemoryManager refactor."
Lang Hames [Tue, 12 Oct 2021 02:23:41 +0000 (19:23 -0700)]
Revert "[JITLink][ORC] Major JITLinkMemoryManager refactor."

This reverts commit e50aea58d59c8cfae807a7fee21c4227472c0678 while I
investigate bot failures.

2 years ago[JITLink][ORC] Major JITLinkMemoryManager refactor.
Lang Hames [Mon, 11 Oct 2021 00:39:24 +0000 (17:39 -0700)]
[JITLink][ORC] Major JITLinkMemoryManager refactor.

This commit substantially refactors the JITLinkMemoryManager API to: (1) add
asynchronous versions of key operations, (2) give memory manager implementations
full control over link graph address layout, (3) enable more efficient tracking
of allocated memory, and (4) support "allocation actions" and finalize-lifetime
memory.

Together these changes provide a more usable API, and enable more powerful and
efficient memory manager implementations.

To support these changes the JITLinkMemoryManager::Allocation inner class has
been split into two new classes: InFlightAllocation, and FinalizedAllocation.
The allocate method returns an InFlightAllocation that tracks memory (both
working and executor memory) prior to finalization. The finalize method returns
a FinalizedAllocation object, and the InFlightAllocation is discarded. Breaking
Allocation into InFlightAllocation and FinalizedAllocation allows
InFlightAllocation subclassses to be written more naturally, and FinalizedAlloc
to be implemented and used efficiently (see (3) below).

In addition to the memory manager changes this commit also introduces a new
MemProt type to represent memory protections (MemProt replaces use of
sys::Memory::ProtectionFlags in JITLink), and a new MemDeallocPolicy type that
can be used to indicate when a section should be deallocated (see (4) below).

Plugin/pass writers who were using sys::Memory::ProtectionFlags will have to
switch to MemProt -- this should be straightworward. Clients with out-of-tree
memory managers will need to update their implementations. Clients using
in-tree memory managers should mostly be able to ignore it.

Major features:

(1) More asynchrony:

The allocate and deallocate methods are now asynchronous by default, with
synchronous convenience wrappers supplied. The asynchronous versions allow
clients (including JITLink) to request and deallocate memory without blocking.

(2) Improved control over graph address layout:

Instead of a SegmentRequestMap, JITLinkMemoryManager::allocate now takes a
reference to the LinkGraph to be allocated. The memory manager is responsible
for calculating the memory requirements for the graph, and laying out the graph
(setting working and executor memory addresses) within the allocated memory.
This gives memory managers full control over JIT'd memory layout. For clients
that don't need or want this degree of control the new "BasicLayout" utility can
be used to get a segment-based view of the graph, similar to the one provided by
SegmentRequestMap. Once segment addresses are assigned the BasicLayout::apply
method can be used to automatically lay out the graph.

(3) Efficient tracking of allocated memory.

The FinalizedAlloc type is a wrapper for an ExecutorAddr and requires only
64-bits to store in the controller. The meaning of the address held by the
FinalizedAlloc is left up to the memory manager implementation, but the
FinalizedAlloc type enforces a requirement that deallocate be called on any
non-default values prior to destruction. The deallocate method takes a
vector<FinalizedAlloc>, allowing for bulk deallocation of many allocations in a
single call.

Memory manager implementations will typically store the address of some
allocation metadata in the executor in the FinalizedAlloc, as holding this
metadata in the executor is often cheaper and may allow for clean deallocation
even in failure cases where the connection with the controller is lost.

(4) Support for "allocation actions" and finalize-lifetime memory.

Allocation actions are pairs (finalize_act, deallocate_act) of JITTargetAddress
triples (fn, arg_buffer_addr, arg_buffer_size), that can be attached to a
finalize request. At finalization time, after memory protections have been
applied, each of the "finalize_act" elements will be called in order (skipping
any elements whose fn value is zero) as

((char*(*)(const char *, size_t))fn)((const char *)arg_buffer_addr,
                                     (size_t)arg_buffer_size);

At deallocation time the deallocate elements will be run in reverse order (again
skipping any elements where fn is zero).

The returned char * should be null to indicate success, or a non-null
heap-allocated string error message to indicate failure.

These actions allow finalization and deallocation to be extended to include
operations like registering and deregistering eh-frames, TLS sections,
initializer and deinitializers, and language metadata sections. Previously these
operations required separate callWrapper invocations. Compared to callWrapper
invocations, actions require no extra IPC/RPC, reducing costs and eliminating
a potential source of errors.

Finalize lifetime memory can be used to support finalize actions: Sections with
finalize lifetime should be destroyed by memory managers immediately after
finalization actions have been run. Finalize memory can be used to support
finalize actions (e.g. with extra-metadata, or synthesized finalize actions)
without incurring permanent memory overhead.

2 years ago[Driver] Re-enable aarch64-cpus.c test for arm64-apple.
Ahmed Bougacha [Tue, 12 Oct 2021 01:31:01 +0000 (18:31 -0700)]
[Driver] Re-enable aarch64-cpus.c test for arm64-apple.

"darwin" is ambiguous.  When there isn't a better source
of truth (e.g., SDKs), the driver will either interpret it
as "iOS" when cross-compiling to a different architecture,
or "the host" when not.  That's now the case on AS Macs.

Update the test to more explicitly test the OS.
aarch64-mac-cpus.c already tests the mac-specific driver logic.

2 years agoReland "[clang][Fuchsia] Support availability attr on Fuchsia"
Haowei Wu [Tue, 12 Oct 2021 00:44:09 +0000 (17:44 -0700)]
Reland "[clang][Fuchsia] Support availability attr on Fuchsia"

This reland commit 1131b1eb3509b47d30a36ea9b42367ab1d7373a2, which
adds support to __attribute__((availability)) annotation for Fuchsia
platform. This patch also adds '-ffuchsia-api-level' to allow specify
Fuchsia API level from the command line.

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

2 years ago[libc++][docs] Mark LWG3447 as complete
Joe Loser [Tue, 12 Oct 2021 01:40:14 +0000 (21:40 -0400)]
[libc++][docs] Mark LWG3447 as complete

Mark LWG3447 as complete since it was not an issue since the original
implementation of `take_view` from
0f4b41e038537ab2ab6fa2aa048e55c28a03ab68. Currently, `take_view`'s
deduction guide does not constrain the range on the `range` concept.

Reviewed By: ldionne, Mordante, #libc

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

2 years agoRevert "[clang][Fuchsia] Support availability attr on Fuchsia"
Haowei Wu [Tue, 12 Oct 2021 00:32:38 +0000 (17:32 -0700)]
Revert "[clang][Fuchsia] Support availability attr on Fuchsia"

This reverts commit 1131b1eb3509b47d30a36ea9b42367ab1d7373a2, which
breaks several llvm bots.

2 years agoLLVM_ATTRIBUTE_NODEBUG: GCC 4.0 apparently had ((nodebug)) but removed it.
Chris Lattner [Tue, 12 Oct 2021 00:26:30 +0000 (17:26 -0700)]
LLVM_ATTRIBUTE_NODEBUG: GCC 4.0 apparently had ((nodebug)) but removed it.

This should fix a bunch of warnings on the flang-aarch64-latest-gcc builder.

2 years agoPR52139: Properly handle more kinds of declaration when checking for
Richard Smith [Mon, 11 Oct 2021 23:16:32 +0000 (16:16 -0700)]
PR52139: Properly handle more kinds of declaration when checking for
usage of an abstract class type within itself.

We were missing handling for deduction guides (which would assert),
friend declarations, and variable templates. We were mishandling inline
variables and other variables defined inside the class definition.

These diagnostics should be downgraded to warnings, or perhaps removed
entirely, once we implement P0929R2.

2 years agoRevert "Remove checks for old gcc versions for LLVM_ATTRIBUTE_*"
Arthur Eubanks [Mon, 11 Oct 2021 23:36:35 +0000 (16:36 -0700)]
Revert "Remove checks for old gcc versions for LLVM_ATTRIBUTE_*"

This reverts commit f5b524530ab4d9e13279ac23e67f3bac8edb4e76.

Breaks bots, e.g. https://lab.llvm.org/buildbot/#/builders/169/builds/3147

2 years agoRemove checks for old gcc versions for LLVM_ATTRIBUTE_*
Arthur Eubanks [Mon, 11 Oct 2021 21:45:34 +0000 (14:45 -0700)]
Remove checks for old gcc versions for LLVM_ATTRIBUTE_*

According to [1] we only support gcc 5.1+. So these checks for older gcc versions are not supported.

[1] https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library

Reviewed By: MaskRay

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

2 years ago[RISCV][test] Add more tests of immediate materialisation
Ben Shi [Mon, 11 Oct 2021 13:48:25 +0000 (13:48 +0000)]
[RISCV][test] Add more tests of immediate materialisation

Reviewed By: craig.topper

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

2 years ago[AArch64][GlobalISel] Fix combiner assertion in matchConstantOp().
Amara Emerson [Mon, 11 Oct 2021 21:19:41 +0000 (14:19 -0700)]
[AArch64][GlobalISel] Fix combiner assertion in matchConstantOp().

We shouldn't call APInt::getSExtValue() on a >64b value.

2 years agoRevert "[Clang] Ignore BTFTag attr if used as a type attribute"
Yonghong Song [Mon, 11 Oct 2021 22:34:26 +0000 (15:34 -0700)]
Revert "[Clang] Ignore BTFTag attr if used as a type attribute"

This reverts commit b875343873a584965daf507d73ff1fe71eab1953.

Per discussion in https://reviews.llvm.org/D111199, instead to make
existing btf_tag attribute as a type-or-decl attribute, we will
make existing btf_tag attribute as a decl only attribute, and
introduce btf_type_tag as a type only attribute. This will make
it easy for cases like typedef where an attribute may be applied
as either a type attribute or a decl attribute.

2 years ago[clang][Fuchsia] Support availability attr on Fuchsia
Haowei Wu [Mon, 27 Sep 2021 20:47:08 +0000 (13:47 -0700)]
[clang][Fuchsia] Support availability attr on Fuchsia

This patch adds support to __attribute__((availability)) annotation for
Fuchsia platform. This patch also adds '-ffuchsia-api-level' to allow
specify Fuchsia API level from the command line.

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

2 years ago[TwoAddressInstructionPass] Improve the SrcRegMap and DstRegMap computation
Guozhi Wei [Mon, 11 Oct 2021 22:28:31 +0000 (15:28 -0700)]
[TwoAddressInstructionPass] Improve the SrcRegMap and DstRegMap computation

This patch contains following enhancements to SrcRegMap and DstRegMap:

  1 In findOnlyInterestingUse not only check if the Reg is two address usage,
    but also check after commutation can it be two address usage.

  2 If a physical register is clobbered, remove SrcRegMap entries that are
    mapped to it.

  3 In processTiedPairs, when create a new COPY instruction, add a SrcRegMap
    entry only when the COPY instruction is coalescable. (The COPY src is
    killed)

With these enhancements isProfitableToCommute can do better commute decision,
and finally more register copies are removed.

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

2 years ago[mlir] Restrict to requiring traits when using InferTensorType trait.
Jacques Pienaar [Mon, 11 Oct 2021 21:56:28 +0000 (14:56 -0700)]
[mlir] Restrict to requiring traits when using InferTensorType trait.

Avoids running into segfaults accidentally.

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

2 years ago[GlobalISel] Regenerate some MIR tests with CHECK-NEXT for another patch.
Amara Emerson [Mon, 11 Oct 2021 21:40:02 +0000 (14:40 -0700)]
[GlobalISel] Regenerate some MIR tests with CHECK-NEXT for another patch.

2 years ago[AIX] Unsupported newly added AMDGPU clang test
Jinsong Ji [Mon, 11 Oct 2021 21:33:50 +0000 (21:33 +0000)]
[AIX] Unsupported newly added AMDGPU clang test

2 years ago[LoopSimplifyCFG] Do not require MSSA. Continue to preserve if available.
Alina Sbirlea [Mon, 11 Oct 2021 20:45:57 +0000 (13:45 -0700)]
[LoopSimplifyCFG] Do not require MSSA. Continue to preserve if available.

LoopSimplifyCFG does not need MSSA, but should preserve it if it's available.

This is a legacy PM change, aimed to denoise the test changes in D109958.

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

2 years ago[ORC] Propagate errors to handlers when sendMessage fails.
Lang Hames [Mon, 11 Oct 2021 20:42:39 +0000 (13:42 -0700)]
[ORC] Propagate errors to handlers when sendMessage fails.

In SimpleRemoteEPC, calls to from callWrapperAsync to sendMessage may fail.
The handlers may or may not be sent failure messages by handleDisconnect,
depending on when that method is run. This patch adds a check for an un-failed
handler, and if it finds one sends it a failure message.

2 years ago[ORC] Destroy FinalizeErr if there is a serialization error.
Lang Hames [Mon, 11 Oct 2021 20:42:21 +0000 (13:42 -0700)]
[ORC] Destroy FinalizeErr if there is a serialization error.

If there is a serialization error then FinalizeErr should never be set, so we
can use cantFail rather than consumeError here.

2 years ago[ORC] Propagate out-of-band errors in callAsync.
Lang Hames [Mon, 11 Oct 2021 19:34:08 +0000 (12:34 -0700)]
[ORC] Propagate out-of-band errors in callAsync.

Returned out-of-band errors should be wrapped as llvm::Errors and passed to the
SendDeserializedResult function. Failure to do this results in an assertion when
we try to deserialize from the WrapperFunctionResult while it's in the
out-of-band error state.

2 years ago[IVUsers] Check for preheader instead of loop simplify form
Nikita Popov [Sat, 9 Oct 2021 14:51:52 +0000 (16:51 +0200)]
[IVUsers] Check for preheader instead of loop simplify form

IVUsers currently makes sure that all loops dominating a user are
in loop simplify form, because SCEVExpander needs a preheader to
insert into. However, loop simplify form requires much more than
that. In particular, it requires dedicated exits, which means that
exits need to be found and walked. For large functions with many
nested loops, this can result in pathological compile-time explosion.

Fix this by only checking the property we're actually interested in,
which is incidentally cheap to check.

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

2 years ago[ARM] Be more explicit about disabling CombineBaseUpdate for MVE.
David Green [Mon, 11 Oct 2021 20:51:45 +0000 (21:51 +0100)]
[ARM] Be more explicit about disabling CombineBaseUpdate for MVE.

This shouldn't be called for non-neon targets at the moment in either
case, but it is good to be expliit about the CombineBaseUpdate being a
NEON function, not expecting to be run under MVE.

2 years ago[KnownBits] Introduce `countMaxActiveBits()` and use it in a few places
Roman Lebedev [Mon, 11 Oct 2021 20:27:12 +0000 (23:27 +0300)]
[KnownBits] Introduce `countMaxActiveBits()` and use it in a few places

2 years ago[LCG] Don't skip invalidation of LazyCallGraph if CFG analyses are preserved
Arthur Eubanks [Wed, 6 Oct 2021 21:32:08 +0000 (14:32 -0700)]
[LCG] Don't skip invalidation of LazyCallGraph if CFG analyses are preserved

The CFG being changed and the overall call graph are not related, we can introduce/remove calls without changing the CFG.

Resolves one of the issues in PR51946.

Reviewed By: asbirlea

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

2 years ago[InstCombine] fold signbit check of X | (X -1)
Sanjay Patel [Mon, 11 Oct 2021 19:21:51 +0000 (15:21 -0400)]
[InstCombine] fold signbit check of X | (X -1)

There may be some other patterns like this or a generalization,
but this is an example that I noticed would definitely regress
with a planned follow-up to D111410.

https://alive2.llvm.org/ce/z/GVpQDb

2 years ago[InstCombine] add signbit check for or'd operands; NFC
Sanjay Patel [Mon, 11 Oct 2021 18:42:12 +0000 (14:42 -0400)]
[InstCombine] add signbit check for or'd operands; NFC

2 years ago[SCCP] Properly report changes when changing a pointer argument
Arthur Eubanks [Wed, 6 Oct 2021 21:43:59 +0000 (14:43 -0700)]
[SCCP] Properly report changes when changing a pointer argument

Fixes one of the issues in PR51946.

Reviewed By: asbirlea

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

2 years ago[TypeSwitch/Compiler.h] Provide a LLVM_NODEBUG macro and use it in TypeSwitch.h
Chris Lattner [Mon, 11 Oct 2021 04:21:27 +0000 (21:21 -0700)]
[TypeSwitch/Compiler.h] Provide a LLVM_NODEBUG macro and use it in TypeSwitch.h

TypeSwitch.h is used pervasively in MLIR and often has dozens of types switched
over.  It uses "zero cost" variadic templates to implement the dispatching
mechanism... which isn't zero cost in debug builds, and which causes a massive
problem for actually debugging things that use it - you get dozens of nonsense
frames in the debugger for simple things like a visitor.

Fix this by marking the key method in TypeSwitch as nodebug + alwaysinline.
This resolves LLVM PR49301

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

2 years ago[mlir][ODS] Support result type inference in custom assembly format
Daniel Resnick [Thu, 7 Oct 2021 00:50:38 +0000 (18:50 -0600)]
[mlir][ODS] Support result type inference in custom assembly format

Operations that have the InferTypeOpInterface trait can now omit the return
types in their custom assembly formats.

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

2 years agoAdd release note about `TypeLoc` matchers.
James King [Mon, 11 Oct 2021 19:56:10 +0000 (19:56 +0000)]
Add release note about `TypeLoc` matchers.

Reviewed By: ymandel, aaron.ballman

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

2 years agoAddGlobalAnnotations for function with or without function body.
Chris Bieneman [Mon, 11 Oct 2021 17:31:02 +0000 (12:31 -0500)]
AddGlobalAnnotations for function with or without function body.

When AnnotateAttr is on a function, AddGlobalAnnotations is only called
in CodeGenModule::EmitGlobalFunctionDefinition which means AnnotateAttr
on function declaration without function body will be ignored.
The patch will move AddGlobalAnnotations  to
CodeGenModule::SetFunctionAttributes, so with or without function body,
the AnnotateAttr will get code gen for a function.

It'll help case when AnnotateAttr is on external function, and the
AnnotateAttr will be consumed in IR level.

For example, a pass to collect num of uses for functions with
__attribute((annotate("count_use"))) after optimizations,
As long as there's __attribute((annotate("count_use"))), function with
or without function body should be counted.

Reviewed By: aaron.ballman

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

Patch by:  python3kgae (Xiang Li)

2 years ago[PHIElimination] Fix accounting for undef uses when updating LiveVariables
Jay Foad [Mon, 11 Oct 2021 15:02:40 +0000 (16:02 +0100)]
[PHIElimination] Fix accounting for undef uses when updating LiveVariables

PHI elimination updates LiveVariables info as described here:

    // We only need to update the LiveVariables kill of SrcReg if this was the
    // last PHI use of SrcReg to be lowered on this CFG edge and it is not live
    // out of the predecessor. We can also ignore undef sources.

Unfortunately if the last use also happened to be an undef use then it
would fail to update the LiveVariables at all. Fix this by not counting
undef uses in the VRegPHIUse map.

Thanks to Mikael Holmén for the test case!

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

2 years ago[AMDGPU] Fix copying a machine operand
Jay Foad [Mon, 11 Oct 2021 14:11:36 +0000 (15:11 +0100)]
[AMDGPU] Fix copying a machine operand

Without this I get:

*** Bad machine code: Instruction has operand with wrong parent set ***
- function:    available_externally_test
- basic block: %bb.0  (0x7dad598)
- instruction: %0:r600_treg32_x = MOV 1, 0, 0, 0, $alu_literal_x, 0, 0, 0, -1, 1, $pred_sel_off, @available_externally, 0

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

2 years ago[NFC][X86][Codegen] Add semi-negative PAVG chain test (PR52131)
Roman Lebedev [Mon, 11 Oct 2021 19:13:18 +0000 (22:13 +0300)]
[NFC][X86][Codegen] Add semi-negative PAVG chain test (PR52131)