platform/upstream/llvm.git
3 years ago[llvm-objcopy] Delete --build-id-link-{dir,input,output}
Fangrui Song [Mon, 15 Feb 2021 19:17:32 +0000 (11:17 -0800)]
[llvm-objcopy] Delete --build-id-link-{dir,input,output}

The few options are niche. They solved a problem which was traditionally solved
with more shell commands (`llvm-readelf -n` fetches the Build ID. Then
`ln` is used to hard link the file to a directory derived from the Build ID.)

Due to limitation, they are no longer used by Fuchsia and they don't appear to
be used elsewhere (checked with Google Search and Debian Code Search). So delete
them without a transition period.

Announcement: https://lists.llvm.org/pipermail/llvm-dev/2021-February/148446.html

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

3 years ago[OpenMP] Delay more diagnostics of potentially non-emitted code
Johannes Doerfert [Tue, 2 Feb 2021 17:17:44 +0000 (11:17 -0600)]
[OpenMP] Delay more diagnostics of potentially non-emitted code

Even code in target and declare target regions might not be emitted.
With this patch we delay more diagnostics and use laziness and linkage
to determine if a function is emitted (for the device). Note that we
still eagerly emit diagnostics for target regions, unfortunately, see
the TODO for the reason.

This hopefully fixes PR48933.

Reviewed By: JonChesterfield

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

3 years ago[OpenMP] Attribute target diagnostics properly
Johannes Doerfert [Fri, 29 Jan 2021 08:42:20 +0000 (02:42 -0600)]
[OpenMP] Attribute target diagnostics properly

Type errors in function declarations were not (always) diagnosed prior
to this patch. Furthermore, certain remarks did not get associated
properly which caused them to be emitted multiple times.

Reviewed By: JonChesterfield

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

3 years ago[OpenMP][NFC] Pre-commit test changes regarding PR48933
Johannes Doerfert [Tue, 2 Feb 2021 23:24:53 +0000 (17:24 -0600)]
[OpenMP][NFC] Pre-commit test changes regarding PR48933

This will highlight the effective changes in subsequent commits.

Reviewed By: ABataev

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

3 years agoSupport emitting complex expressions that include entry values
Adrian Prantl [Fri, 12 Feb 2021 00:07:19 +0000 (16:07 -0800)]
Support emitting complex expressions that include entry values

This patch enables AsmPrinter support for complex expression with
entry values. It shouldn't AsmPrinter's call whether these are safe or
not but the pass who introduces the DW_OP_LLVM_entry_value. This patch
on its own has no effect on clang.

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

3 years ago[CMake] Delete LLVM_RUNTIME_BUILD_ID_LINK_TARGETS
Fangrui Song [Mon, 15 Feb 2021 19:06:23 +0000 (11:06 -0800)]
[CMake] Delete LLVM_RUNTIME_BUILD_ID_LINK_TARGETS

Announcement: https://lists.llvm.org/pipermail/llvm-dev/2021-February/148446.html

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

3 years ago[mlir] Add clone method to ShapedType
Jacques Pienaar [Mon, 15 Feb 2021 19:04:16 +0000 (11:04 -0800)]
[mlir] Add clone method to ShapedType

Allow clients to create a new ShapedType of the same "container" type
but with different element or shape. First use case is when refining
shape during shape inference without needing to consider which
ShapedType is being refined.

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

3 years ago[clangd] Delay binding LSP methods until initialize. NFC
Sam McCall [Fri, 12 Feb 2021 15:23:53 +0000 (16:23 +0100)]
[clangd] Delay binding LSP methods until initialize. NFC

This is NFC because the MessageHandler refused to dispatch to them until the
server is initialized anyway.

This is a more natural time to bind them - it's when they become callable, and
it's when client capabalities are available and server ones can be set.

One module-lifecycle function will be responsible for all three.

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

3 years ago[DAG] visitVSELECT - move OpLHS == LHS into inner if() in USUBSAT matching. NFCI.
Simon Pilgrim [Mon, 15 Feb 2021 18:27:00 +0000 (18:27 +0000)]
[DAG] visitVSELECT - move OpLHS == LHS into inner if() in USUBSAT matching. NFCI.

This will be necessary for the update of D25987 where we'll need to match OpLHS against other ops.

3 years ago[NFC] Remove spurious ';' on return line in python code
Mircea Trofin [Mon, 15 Feb 2021 16:41:26 +0000 (08:41 -0800)]
[NFC] Remove spurious ';' on return line in python code

3 years ago[AArch64] Move machine bundle unpacking to PreEmit2 phase.
Florian Hahn [Mon, 15 Feb 2021 16:10:43 +0000 (16:10 +0000)]
[AArch64] Move machine bundle unpacking to PreEmit2 phase.

This patch adjusts the placement of the bundle unpacking to just before
code emission. In particular, this means bundle unpacking happens AFTER
the machine outliner. With the previous position, the machine outliner
may outline parts of a bundle, which breaks them up.

This is an issue for BLR_RVMARKER handling, as illustrated by the
rvmarker-pseudo-expansion-and-outlining.mir test case. The machine
outliner should not break up the bundles created during pseudo
expansion.

This should fix PR49082.

Reviewed By: SjoerdMeijer

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

3 years ago[LangRef] Increase size of title underline for experimental.vector.reverse
Caroline Concatto [Mon, 15 Feb 2021 14:31:32 +0000 (14:31 +0000)]
[LangRef] Increase size of title underline for experimental.vector.reverse

3 years ago[ARM] Add some basic Min/Max costs
David Green [Mon, 15 Feb 2021 15:06:19 +0000 (15:06 +0000)]
[ARM] Add some basic Min/Max costs

This adds basic MVE costs for SMIN/SMAX/UMIN/UMAX, as well as MINNUM and
MAXNUM representing fmin and fmax. It tightens up the costs, not using a
ICmp+Select cost.

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

3 years agoMake shape.is_broadcastable/shape.cstr_broadcastable nary
Tres Popp [Wed, 10 Feb 2021 09:24:32 +0000 (10:24 +0100)]
Make shape.is_broadcastable/shape.cstr_broadcastable nary

This corresponds with the previous work to make shape.broadcast nary.
Additionally, simplify the ConvertShapeConstraints pass. It now doesn't
lower an implicit shape.is_broadcastable. This is still the same in
combination with shape-to-standard when the 2 passes are used in either
order.

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

3 years ago[debuginfo-tests] Delete unused/duplicate imports
James Henderson [Tue, 9 Feb 2021 14:24:18 +0000 (14:24 +0000)]
[debuginfo-tests] Delete unused/duplicate imports

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

Reviewed by: aprantl

3 years ago[CostModel]Add cost model for experimental.vector.reverse
Caroline Concatto [Wed, 27 Jan 2021 15:59:27 +0000 (15:59 +0000)]
[CostModel]Add cost model for experimental.vector.reverse

This patch uses the function getShuffleCost with SK_Reverse to compute the cost
for experimental.vector.reverse.
For scalable vector type, it adds a table will the legal types on
AArch64TTIImpl::getShuffleCost to not assert in BasicTTIImpl::getShuffleCost,
and for fixed vector, it relies on the existing cost model in BasicTTIImpl.

Depends on D94883

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

3 years ago[debuginfo-tests] Remove some unused config variables
James Henderson [Tue, 9 Feb 2021 11:12:49 +0000 (11:12 +0000)]
[debuginfo-tests] Remove some unused config variables

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

Reviewed by: aprantl

3 years ago[debuginfo-tests] Remove explicit checks for Python 3
James Henderson [Mon, 8 Feb 2021 15:46:40 +0000 (15:46 +0000)]
[debuginfo-tests] Remove explicit checks for Python 3

LLVM has a minimum requirement of python 3.6 now, and Python is
explicitly checked for in the LLVM CMakeLists.txt, so this check is no
longer needed here.

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

Reviewed by: aprantl

3 years ago[X86] Add SSE2+SSE3 common check prefix to psubus tests
Simon Pilgrim [Mon, 15 Feb 2021 14:06:38 +0000 (14:06 +0000)]
[X86] Add SSE2+SSE3 common check prefix to psubus tests

Noticed by @pengfei on D96703

3 years ago[mlir] use new cmake targets in mlir-*-runner
Alex Zinenko [Mon, 15 Feb 2021 14:02:56 +0000 (15:02 +0100)]
[mlir] use new cmake targets in mlir-*-runner

3 years ago[llvm-nm][test] Add additional test coverage for llvm-nm options
James Henderson [Fri, 12 Feb 2021 14:23:45 +0000 (14:23 +0000)]
[llvm-nm][test] Add additional test coverage for llvm-nm options

Some of these options have a degree of incidental coverage, or are for
Mach-O only. This patch adds dedicated ELF (where applicable) coverage.

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

Reviewed by: rupprecht, Higuoxing

3 years ago[llvm-nm] Tidy up error messages
James Henderson [Fri, 12 Feb 2021 14:18:21 +0000 (14:18 +0000)]
[llvm-nm] Tidy up error messages

This adds colons to separate the file name from the message, removes a
duplicate space, and removes a trailing full stop from some messages.
These help bring the error messages into line with other tools, as well
as making all llvm-nm message more self-consistent.

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

Reviewed by: Higuoxing, rupprecht, MaskRay

3 years ago[llvm] NFC: Cleanup llvm-yaml-numeric-parser-fuzzer
Kirill Bobyrev [Mon, 15 Feb 2021 13:52:46 +0000 (14:52 +0100)]
[llvm] NFC: Cleanup llvm-yaml-numeric-parser-fuzzer

* Use static variables instead of non-trivially destructible global ones.
* Remove unused header.

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

3 years ago[LoopVectorizer] Require no-signed-zeros-fp-math=true for fmin/fmax
Kerry McLaughlin [Mon, 15 Feb 2021 10:36:40 +0000 (10:36 +0000)]
[LoopVectorizer] Require no-signed-zeros-fp-math=true for fmin/fmax

Currently, setting the `no-nans-fp-math` attribute to true will allow
loops with fmin/fmax to vectorize, though we should be requiring that
`no-signed-zeros-fp-math` is also set.

This patch adds the check for no-signed-zeros at the function level and includes
tests to make sure we don't vectorize functions with only one of the attributes
associated.

Reviewed By: spatel

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

3 years agoFix MSVC natvis visualisation of llvm::FixedVectorTyID and ScalableVectorTyID
Simon Pilgrim [Mon, 15 Feb 2021 13:20:11 +0000 (13:20 +0000)]
Fix MSVC natvis visualisation of llvm::FixedVectorTyID and ScalableVectorTyID

VectorTyID was replaced with FixedVectorTyID and ScalableVectorTyID

3 years ago[mlir] Use the interface-based translation for LLVM "intrinsic" dialects
Alex Zinenko [Fri, 12 Feb 2021 11:53:27 +0000 (12:53 +0100)]
[mlir] Use the interface-based translation for LLVM "intrinsic" dialects

Port the translation of five dialects that define LLVM IR intrinsics
(LLVMAVX512, LLVMArmNeon, LLVMArmSVE, NVVM, ROCDL) to the new dialect
interface-based mechanism. This allows us to remove individual translations
that were created for each of these dialects and just use one common
MLIR-to-LLVM-IR translation that potentially supports all dialects instead,
based on what is registered and including any combination of translatable
dialects. This removal was one of the main goals of the refactoring.

To support the addition of GPU-related metadata, the translation interface is
extended with the `amendOperation` function that allows the interface
implementation to post-process any translated operation with dialect attributes
from the dialect for which the interface is implemented regardless of the
operation's dialect. This is currently applied to "kernel" functions, but can
be used to construct other metadata in dialect-specific ways without
necessarily affecting operations.

Depends On D96591, D96504

Reviewed By: nicolasvasilache

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

3 years ago[CodeGen][SelectionDAG]Add new intrinsic experimental.vector.reverse
Caroline Concatto [Fri, 15 Jan 2021 16:46:42 +0000 (16:46 +0000)]
[CodeGen][SelectionDAG]Add new intrinsic  experimental.vector.reverse

This patch adds  a new intrinsic experimental.vector.reduce that takes a single
vector and returns a vector of matching type but with the original lane order
 reversed. For example:

```
vector.reverse(<A,B,C,D>) ==> <D,C,B,A>
```

The new intrinsic supports fixed and scalable vectors types.
The fixed-width vector relies on shufflevector to maintain existing behaviour.
Scalable vector uses the new ISD node - VECTOR_REVERSE.

This new intrinsic is one of the named shufflevector intrinsics proposed on the
mailing-list in the RFC at [1].

Patch by Paul Walker (@paulwalker-arm).

[1] https://lists.llvm.org/pipermail/llvm-dev/2020-November/146864.html

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

3 years ago[analyzer][NFC] Fix test failures for builds w/o assertions
Valeriy Savchenko [Mon, 15 Feb 2021 13:36:22 +0000 (16:36 +0300)]
[analyzer][NFC] Fix test failures for builds w/o assertions

3 years ago[ARM] Extend search for increment in load/store optimizer
David Green [Mon, 15 Feb 2021 13:17:21 +0000 (13:17 +0000)]
[ARM] Extend search for increment in load/store optimizer

Currently the findIncDecAfter will only look at the next instruction for
post-inc candidates in the load/store optimizer. This extends that to a
search through the current BB, until an instruction that modifies or
uses the increment reg is found. This allows more post-inc load/stores
and ldm/stm's to be created, especially in cases where a schedule might
move instructions further apart.

We make sure not to look any further for an SP, as that might invalidate
stack slots that are still in use.

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

3 years agoAdd Semantic check for Flang OpenMP 4.5 - 2.7.1 Do Loop restrictions.
Yashaswini [Mon, 15 Feb 2021 12:54:27 +0000 (18:24 +0530)]
Add Semantic check for Flang OpenMP 4.5 - 2.7.1  Do Loop restrictions.
Implementation of Do loop iteration variable check, Do while loop check, Do loop cycle restrictions.
Also to check whether the ordered clause is present on the loop construct if any ordered region ever
 binds to a loop region arising from the loop construct.

Files:

check-omp-structure.h
check-omp-structure.cpp
resolve-directives.cpp

Testcases:

omp-do06-positivecases.f90
omp-do06.f90
omp-do08.f90
omp-do09.f90
omp-do10.f90
omp-do11.f90
omp-do12.f90
omp-do13.f90
omp-do14.f90
omp-do15.f90
omp-do16.f90
omp-do17.f90

Reviewed by: Kiran Chandramohan @kiranchandramohan , Valentin Clement @clementval

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

3 years ago[sanitizer] [arm] Disable some LSAN tests for arm-linux-gnueabihf
Adhemerval Zanella [Mon, 15 Feb 2021 12:26:45 +0000 (09:26 -0300)]
[sanitizer] [arm] Disable some LSAN tests for arm-linux-gnueabihf

Reinstate D90628 since the fix done by D96337 does not change the outcome
of the https://bugs.llvm.org/show_bug.cgi?id=48052

3 years ago[lldb] Rename FreeBSDRemote to FreeBSD (NFC)
Michał Górny [Thu, 11 Feb 2021 23:40:52 +0000 (00:40 +0100)]
[lldb] Rename FreeBSDRemote to FreeBSD (NFC)

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

3 years ago[lldb] Remove the legacy FreeBSD plugin
Michał Górny [Thu, 11 Feb 2021 23:37:10 +0000 (00:37 +0100)]
[lldb] Remove the legacy FreeBSD plugin

The new FreeBSDRemote plugin has reached feature parity with the legacy
plugin, so we can finally remove the latter.  The new plugin will
be renamed to FreeBSD in a separate commit to avoid confusion.

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

3 years ago[X86][AVX] Regenerate PSUBUS tests for slow/fast shuffle AVX2 targets
Simon Pilgrim [Mon, 15 Feb 2021 12:00:29 +0000 (12:00 +0000)]
[X86][AVX] Regenerate PSUBUS tests for slow/fast shuffle AVX2 targets

update_llc_test_checks.py isn't reporting when we don't have a usable prefix for a particular run any more - so we lost all AVX2 testing!

3 years ago[X86][SSE] Add missing USUBSAT test coverage
Simon Pilgrim [Mon, 15 Feb 2021 11:38:08 +0000 (11:38 +0000)]
[X86][SSE] Add missing USUBSAT test coverage

Before we start removing combineSubToSubus (PR40111) - make sure we have actually have test coverage for SUB(X,TRUNC(UMIN(ZEXT(X),Y))) -> USUBSAT(X,TRUNC(UMIN(Y,C)))) patterns

3 years agoRecommit "[TTI] Unify FavorPostInc and FavorBackedgeIndex into getPreferredAddressing...
Sjoerd Meijer [Mon, 15 Feb 2021 11:06:42 +0000 (11:06 +0000)]
Recommit "[TTI] Unify FavorPostInc and FavorBackedgeIndex into getPreferredAddressingMode"

This reverts commit effc3b079927a6dd3084b4ff712ec07f926366f0, with the build
problem fixed.

3 years ago[LoopLoadElim] Pass ScalarEvolution in old pass manager. PR49141
Max Kazantsev [Mon, 15 Feb 2021 11:06:33 +0000 (18:06 +0700)]
[LoopLoadElim] Pass ScalarEvolution in old pass manager. PR49141

Loop canonicalization may end up deleting blocks from CFG. And
Scalar Evolution may still keep cached referenced to those blocks
unless updated properly.

3 years agoRevert "[TTI] Unify FavorPostInc and FavorBackedgeIndex into getPreferredAddressingMode"
Sjoerd Meijer [Mon, 15 Feb 2021 11:01:23 +0000 (11:01 +0000)]
Revert "[TTI] Unify FavorPostInc and FavorBackedgeIndex into getPreferredAddressingMode"

This reverts commit cd6de0e8de4a5fd558580be4b1a07116914fc8ed.

3 years ago[TTI] Unify FavorPostInc and FavorBackedgeIndex into getPreferredAddressingMode
Sjoerd Meijer [Fri, 12 Feb 2021 15:15:05 +0000 (15:15 +0000)]
[TTI] Unify FavorPostInc and FavorBackedgeIndex into getPreferredAddressingMode

This refactors shouldFavorPostInc() and shouldFavorBackedgeIndex() into
getPreferredAddressingMode() so that we have one interface to steer LSR in
generating the preferred addressing mode.

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

3 years ago[RISCV] Convert VSLIDE(UP|DOWN) nodes to "VL" versions (NFC)
Fraser Cormack [Thu, 11 Feb 2021 15:01:40 +0000 (15:01 +0000)]
[RISCV] Convert VSLIDE(UP|DOWN) nodes to "VL" versions (NFC)

This patch prepares the RISCV VSLIDEUP and VSLIDEDOWN custom nodes to
ones carrying additional mask and vector-length operands. This is
primarily so they can be used by both systems.

This also takes the opportunity to create some helper functions to deal
with the common task of getting the default (unmasked) VL operands.

Reviewed By: craig.topper, arcbbb

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

3 years agoRestore diagnostic handler after CodeGenAction::ExecuteAction
Marco Antognini [Mon, 8 Feb 2021 18:14:22 +0000 (18:14 +0000)]
Restore diagnostic handler after CodeGenAction::ExecuteAction

Fix dangling pointer to local variable and address some typos.

Reviewed By: xur

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

3 years agoRecommit "[LTO] Use lto::backend for code generation."
Florian Hahn [Sun, 14 Feb 2021 19:33:36 +0000 (19:33 +0000)]
Recommit "[LTO] Use lto::backend for code generation."

This version of the patch includes a fix for the cfi failures.

(undoes the revert commit 7db390cc7738a9ba0ed7d4ca59ab6ea2e69c47e9)

It also undoes reverts of follow-up patches that also needed reverting
originally:

  * [LTO] Add option enable NewPM with LTOCodeGenerator.
    (undoes revert commit 0a17664b47c153aa26a0d31b4835f26375440ec6)

  * [LTOCodeGenerator] Use lto::Config for options (NFC)."
    (undoes revert commit b0a8e41cfff717ff067bf63412d6edb0280608cd)

3 years ago[clangd] Allow modules to bind LSP methods/notifications/commands
Sam McCall [Fri, 12 Feb 2021 20:16:41 +0000 (21:16 +0100)]
[clangd] Allow modules to bind LSP methods/notifications/commands

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

3 years ago[mlir] Add error message on shape.broadcast verification failure
Tres Popp [Mon, 15 Feb 2021 09:58:25 +0000 (10:58 +0100)]
[mlir] Add error message on shape.broadcast verification failure

3 years ago[gn build] Port 5786f64a4ec8
LLVM GN Syncbot [Mon, 15 Feb 2021 09:52:10 +0000 (09:52 +0000)]
[gn build] Port 5786f64a4ec8

3 years ago[clangd] Extract binding of typed->untyped LSP handlers to LSPBinder. NFC
Sam McCall [Thu, 11 Feb 2021 21:47:58 +0000 (22:47 +0100)]
[clangd] Extract binding of typed->untyped LSP handlers to LSPBinder. NFC

The goal is to allow the LSP bindings of features to be defined outside
the ClangdLSPServer class, turning it into less of a monolith.

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

3 years ago[mlir] Support repeated delayed registration of dialect interfaces
Alex Zinenko [Mon, 15 Feb 2021 09:39:13 +0000 (10:39 +0100)]
[mlir] Support repeated delayed registration of dialect interfaces

Dialects themselves do not support repeated addition of interfaces with the
same TypeID. However, in case of delayed registration, the registry may contain
such an interface, or have the same interface registered several times due to,
e.g., dependencies. Make sure we delayed registration does not attempt to add
an interface with the same TypeID more than once.

Reviewed By: mehdi_amini

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

3 years ago[analyzer] Updated comments to reflect D85817
Deep Majumder [Mon, 15 Feb 2021 08:45:48 +0000 (11:45 +0300)]
[analyzer] Updated comments to reflect D85817

Changed DeclaratorDecl in comment to NamedDecl

Reviewed By: vsavchenko

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

3 years ago[analyzer] Fix static_cast on pointer-to-member handling
Deep Majumder [Mon, 15 Feb 2021 08:44:34 +0000 (11:44 +0300)]
[analyzer] Fix static_cast on pointer-to-member handling

This commit fixes bug #48739. The bug was caused by the way static_casts
on pointer-to-member caused the CXXBaseSpecifier list of a
MemberToPointer to grow instead of shrink.
The list is now grown by implicit casts and corresponding entries are
removed by static_casts. No-op static_casts cause no effect.

Reviewed By: vsavchenko

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

3 years agoAdd ehcont section support
Arlo Siemsen [Mon, 15 Feb 2021 01:23:40 +0000 (09:23 +0800)]
Add ehcont section support

In the future Windows will enable Control-flow Enforcement Technology (CET aka shadow stacks). To protect the path where the context is updated during exception handling, the binary is required to enumerate valid unwind entrypoints in a dedicated section which is validated when the context is being set during exception handling.

This change allows llvm to generate the section that contains the appropriate symbol references in the form expected by the msvc linker.

This feature is enabled through a new module flag, ehcontguard, which was modelled on the cfguard flag.

The change includes a test that when the module flag is enabled the section is correctly generated.

The set of exception continuation information includes returns from exceptional control flow (catchret in llvm).

In order to collect catchret we:
1) Includes an additional flag on machine basic blocks to indicate that the given block is the target of a catchret operation,
2) Introduces a new machine function pass to insert and collect symbols at the start of each block, and
3) Combines these targets with the other EHCont targets that were already being collected.

Change originally authored by Daniel Frampton <dframpto@microsoft.com>

For more details, see MSVC documentation for `/guard:ehcont`
  https://docs.microsoft.com/en-us/cpp/build/reference/guard-enable-eh-continuation-metadata

Reviewed By: pengfei

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

3 years ago[RISCV] Add i16 bswap and i8/i16 bitreverse tests to the Zbp tests. NFC
Craig Topper [Sun, 14 Feb 2021 20:53:20 +0000 (12:53 -0800)]
[RISCV] Add i16 bswap and i8/i16 bitreverse tests to the Zbp tests. NFC

Maybe we should use GREVI directly for these rather than
promoting and then shifting right.

3 years ago[Polly] Regenerate isl-noexceptions.h.
Michael Kruse [Mon, 15 Feb 2021 01:08:58 +0000 (19:08 -0600)]
[Polly] Regenerate isl-noexceptions.h.

Regenerate the C++ wrapper header from the current isl version's
headers.

The most notable change is that some dimension sizes are represented by
an isl_size (instead of unsigned), which is a signed int. Additionally,
some function may return -1 in case of an error which already had been
fixed in the past. The C++ may no return -1 instead of UINT_MAX which
caused the problems.

Some types in Polly had been changed from unsigned to isl_size
(that were not already auto) and some loops/comparision had to be
changed to avoid unsigned/signed comparison warnings.

3 years ago[X86] Convert fmin/fmax _mm_reduce_* intrinsics to emit llvm.reduction intrinsics...
Wang, Pengfei [Mon, 15 Feb 2021 00:50:59 +0000 (08:50 +0800)]
[X86] Convert fmin/fmax _mm_reduce_* intrinsics to emit llvm.reduction intrinsics (PR47506)

This is a follow up of D92940.

We have successfully converted fadd/fmul _mm_reduce_* intrinsics to
llvm.reduction + reassoc flag. We can do the same approach for fmin/fmax
too, i.e. llvm.reduction + nnan flag.

Reviewed By: spatel

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

3 years ago[AMDGPU] Add llvm.amdgcn.wqm.demote intrinsic
Carl Ritson [Sun, 14 Feb 2021 00:52:41 +0000 (09:52 +0900)]
[AMDGPU] Add llvm.amdgcn.wqm.demote intrinsic

Add intrinsic which demotes all active lanes to helper lanes.
This is used to implement demote to helper Vulkan extension.

In practice demoting a lane to helper simply means removing it
from the mask of live lanes used for WQM/WWM/Exact mode.
Where the shader does not use WQM, demotes just become kills.

Additionally add llvm.amdgcn.live.mask intrinsic to complement
demote operations. In theory llvm.amdgcn.ps.live can be used
to detect helper lanes; however, ps.live can be moved by LICM.
The movement of ps.live cannot be remedied without changing
its type signature and such a change would require ps.live
users to update as well.

Reviewed By: piotr

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

3 years ago[Polly] Invalidate passes after Scop processing in NewPM.
Michael Kruse [Sun, 14 Feb 2021 22:35:48 +0000 (16:35 -0600)]
[Polly] Invalidate passes after Scop processing in NewPM.

ScopDetection's DetectionContext holds AssertionVH for
RequiredInvariantLoads. An assertion is thrown if the handle's value is
erased and the ScopDetection is not yet invalidated. The ScopDetection
must remain valid durting the ScopPassManager. Enusure that all Scop
analyses are free'd when the ScopPass manager is done.

If IR generation has happened, also invalidate all other passes to avoid
possible issues because, like for the legacy pass manager, Polly does not
yet perfectly preserve them.

3 years ago[GlobalISel] Disable vector types in narrowScalarAddSub
Cassie Jones [Sun, 14 Feb 2021 19:42:46 +0000 (14:42 -0500)]
[GlobalISel] Disable vector types in narrowScalarAddSub

The implementation for vectors is broken and doesn't seem to be used by
anything. Explicitly remove support for them, they can be added again
later when they're properly implemented.

Reviewed By: aemerson

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

3 years ago[GlobalISel] Extract a narrowScalarAddSub method. NFC
Cassie Jones [Sun, 14 Feb 2021 19:37:55 +0000 (14:37 -0500)]
[GlobalISel] Extract a narrowScalarAddSub method. NFC

Reviewed By: aemerson

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

3 years ago[lldb] [Process/FreeBSDRemote] Fix clang-formatting on ppc commit
Michał Górny [Sun, 14 Feb 2021 21:34:25 +0000 (22:34 +0100)]
[lldb] [Process/FreeBSDRemote] Fix clang-formatting on ppc commit

3 years agoReland "[mlir] add support for verification in integration tests"
Tobias Gysi [Sun, 14 Feb 2021 19:21:47 +0000 (20:21 +0100)]
Reland "[mlir] add support for verification in integration tests"

The patch extends the runner utils by verification methods that compare two memrefs. The methods compare the content of the two memrefs and print success if the data is identical up to a small numerical error. The methods are meant to simplify the development of integration tests that compare the results against a reference implementation (cf. the updates to the linalg matmul integration tests).

Originally landed in 5fa893c (https://reviews.llvm.org/D96326) and reverted in dd719fd due to a Windows build failure.

Changes:
- Remove the max function that requires the "algorithm" header on Windows
- Eliminate the truncation warning in the float specialization of verifyElem by using a float constant

Reviewed By: Kayjukh

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

3 years ago[gn build] Port 656ead1fb7db
LLVM GN Syncbot [Sun, 14 Feb 2021 19:23:24 +0000 (19:23 +0000)]
[gn build] Port 656ead1fb7db

3 years ago[llvm/Support] Add SHA256 implementation
cynecx [Sun, 14 Feb 2021 17:31:44 +0000 (17:31 +0000)]
[llvm/Support] Add SHA256 implementation

Adds an *unaudited* SHA-256 implementation to `llvm/Support`. The ongoing lld-macho effort needs this to emit an adhoc code signature for macho files on macOS Big Sur.

Reviewed By: mehdi_amini

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

3 years ago[clang-format] Add possibility to be based on parent directory
Björn Schäpers [Fri, 29 Jan 2021 08:29:00 +0000 (09:29 +0100)]
[clang-format] Add possibility to be based on parent directory

This allows the define BasedOnStyle: InheritParentConfig and then
clang-format looks into the parent directories for their
.clang-format and takes that as a basis.

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

3 years ago[ARM] Move PhaseOrdering test to the correct place. NFC
David Green [Sun, 14 Feb 2021 18:43:39 +0000 (18:43 +0000)]
[ARM] Move PhaseOrdering test to the correct place. NFC

3 years ago[ConstraintElimination] Fix variables used for pattern matching.
Florian Hahn [Sun, 14 Feb 2021 18:06:09 +0000 (18:06 +0000)]
[ConstraintElimination] Fix variables used for pattern matching.

Re-using the matched variable in the pattern does not work as expected.
This patch fixes that by introducing a new variable for the 2nd level
match.

3 years ago[BasicAA] Merge aliasGEP code paths
Nikita Popov [Sun, 14 Feb 2021 17:51:45 +0000 (18:51 +0100)]
[BasicAA] Merge aliasGEP code paths

At this point, we can treat the case of GEP/GEP aliasing and
GEP/non-GEP aliasing in essentially the same way. The only
differences are that we need to do an additional negative GEP base
check, and that we perform a bailout on unknown sizes for the
GEP/non-GEP case (the latter exists only to limit compile-time).

This change is not quite NFC due to the peculiar effect that
the DecomposedGEP for V2 can actually be non-trivial even if V2
is not a GEP. The reason for this is that getUnderlyingObject()
can look through LCSSA phi nodes, while stripPointerCasts() doesn't.
This can lead to slightly better results if single-entry phi nodes
occur inside a loop, where looking through the phi node via aliasPhi()
would subject it to phi cycle equivalence restrictions. It would
probably make sense to adjust pointer cast stripping (for AA) to
handle this case, and ensure consistent results.

3 years ago[BasicAA] Add test for single arg phi in loop (NFC)
Nikita Popov [Sun, 14 Feb 2021 17:44:38 +0000 (18:44 +0100)]
[BasicAA] Add test for single arg phi in loop (NFC)

3 years ago[ARM] A couple of small MVE reduction tests from intrinsics. NFC
David Green [Sun, 14 Feb 2021 18:26:22 +0000 (18:26 +0000)]
[ARM] A couple of small MVE reduction tests from intrinsics. NFC

Also added a PhaseOrdering test, to make sure they are not broken by
VectorCombine cost changes.

3 years ago[AMDGPU] Limit memory scope for scratch, LDS and GDS
Tony Tye [Sat, 13 Feb 2021 08:43:48 +0000 (08:43 +0000)]
[AMDGPU] Limit memory scope for scratch, LDS and GDS

Changes for AMD GPU SIMemoryLegalizer:

- Limit the memory scope to maximum supported by the scratch, LDS and
  GDS address spaces.

- Improve assertion checking.

- Correct toSIAtomicScope argument name.

Reviewed By: rampitec

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

3 years ago[AMDGPU] Fix build breakage
Kazu Hirata [Sun, 14 Feb 2021 17:02:54 +0000 (09:02 -0800)]
[AMDGPU] Fix build breakage

3 years ago[ARM] Add some tests for MVE lane interleaving. NFC
David Green [Sun, 14 Feb 2021 16:51:18 +0000 (16:51 +0000)]
[ARM] Add some tests for MVE lane interleaving. NFC

3 years ago[llvm] Use llvm::is_contained (NFC)
Kazu Hirata [Sun, 14 Feb 2021 16:36:20 +0000 (08:36 -0800)]
[llvm] Use llvm::is_contained (NFC)

3 years ago[llvm] Fix header guards (NFC)
Kazu Hirata [Sun, 14 Feb 2021 16:36:16 +0000 (08:36 -0800)]
[llvm] Fix header guards (NFC)

Identified with llvm-header-guard.

3 years ago[Analysis] Use ListSeparator (NFC)
Kazu Hirata [Sun, 14 Feb 2021 16:36:14 +0000 (08:36 -0800)]
[Analysis] Use ListSeparator (NFC)

3 years ago[BasicAA] Avoid duplicate query for GEPs with identical offsets (NFCI)
Nikita Popov [Sat, 13 Feb 2021 22:43:57 +0000 (23:43 +0100)]
[BasicAA] Avoid duplicate query for GEPs with identical offsets (NFCI)

For two GEPs with identical offsets, we currently first perform
a base address query without size information, and then if it is
MayAlias, perform another with size information. This is pointless,
as the latter query should produce strictly better results.

This was not quite true historically due to the way that NoAlias
assumptions were handled, but that issue has since been resolved.

3 years ago[BasicAA] Use index difference to detect GEPs with identical indexes
Nikita Popov [Sun, 14 Feb 2021 14:55:53 +0000 (15:55 +0100)]
[BasicAA] Use index difference to detect GEPs with identical indexes

We currently detect GEPs that have exactly the same indexes by
comparing the Offsets and VarIndices. However, the latter implicitly
performs equality comparisons between two values, which is not
generally legal inside BasicAA, due to the possibility of comparisons
across phi cycles.

I believe that in this particular instance this actually ends up being
unproblematic, at least I wasn't able to come up with any cases that
could result in an incorrect root query result.

In the interest of being defensive, compute GetIndexDifference earlier
(which knows how to handle phi cycles properly) and use the result of
that to determine whether the offsets are identical.

3 years ago[mlir][Linalg] Fix constant detection in linalg.pad_tensor vectorization.
Nicolas Vasilache [Sun, 14 Feb 2021 15:53:13 +0000 (15:53 +0000)]
[mlir][Linalg] Fix constant detection in linalg.pad_tensor vectorization.

3 years ago[ValueTracking] Dereferenced pointers are noundef
aqjune [Sat, 13 Feb 2021 07:22:25 +0000 (16:22 +0900)]
[ValueTracking] Dereferenced pointers are noundef

This is a follow-up of D95238's LangRef update.
This patch updates `programUndefinedIfUndefOrPoison(V)` to return true if
`V` is used by any memory-accessing instruction.
Interestingly, this affected many tests in Attributors, mainly about adding noundefs.
The tests are updated using llvm/utils/update_test_checks.py. I checked that the diffs
are about updating noundefs.

Reviewed By: nikic

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

3 years ago[ASTMatchers] Clarify example in docs
Stephen Kelly [Sun, 14 Feb 2021 13:45:56 +0000 (13:45 +0000)]
[ASTMatchers] Clarify example in docs

3 years ago[InstCombine] fold fdiv with pow divisor (PR49147)
Sanjay Patel [Sun, 14 Feb 2021 13:06:15 +0000 (08:06 -0500)]
[InstCombine] fold fdiv with pow divisor (PR49147)

This is unusual in the general (non-reciprocal) case because we need
an extra instruction, but that should be better for general FP
reassociation and codegen. We conservatively check for "arcp" FMF
here as we do with existing fdiv folds, but it is not strictly
necessary to have that.

This is part of solving:
https://llvm.org/PR49147
(The powi variant potentially has a different constraint.)

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

3 years ago[InstCombine] Add nonnull(select c, null, p) tests (NFC)
Juneyoung Lee [Sun, 14 Feb 2021 13:03:15 +0000 (22:03 +0900)]
[InstCombine] Add nonnull(select c, null, p) tests (NFC)

3 years ago[LoopVectorize] Fix VPRecipeBuilder::createEdgeMask to correctly generate the mask
Juneyoung Lee [Tue, 9 Feb 2021 05:06:17 +0000 (14:06 +0900)]
[LoopVectorize] Fix VPRecipeBuilder::createEdgeMask to correctly generate the mask

This patch fixes pr48832 by correctly generating the mask when a poison value is involved.

Consider this CFG (which is a part of the input):

```
for.body:                                         ; preds = %for.cond
  br i1 true, label %cond.false, label %land.rhs

land.rhs:                                         ; preds = %for.body
  br i1 poison, label %cond.end, label %cond.false

cond.false:                                       ; preds = %for.body, %land.rhs
  br label %cond.end

cond.end:                                         ; preds = %land.rhs, %cond.false
  %cond = phi i32 [ 0, %cond.false ], [ 1, %land.rhs ]

```

The path for.body -> land.rhs -> cond.end should be taken when 'select i1 false, i1 poison, i1 false' holds (which means it's never taken); but VPRecipeBuilder::createEdgeMask was emitting 'and i1 false, poison' instead.
The former one successfully blocks poison propagation whereas the latter one doesn't, making the condition poison and thus causing the miscompilation.

SimplifyCFG has a similar bug (which didn't expose a real-world bug yet), and a patch for this is also ongoing (see https://reviews.llvm.org/D95026).

Reviewed By: bjope

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

3 years ago[Polly] Test all optimization levels.
Michael Kruse [Sun, 14 Feb 2021 06:31:10 +0000 (00:31 -0600)]
[Polly] Test all optimization levels.

3 years ago[CodeGen] Use range-based for loops (NFC)
Kazu Hirata [Sun, 14 Feb 2021 04:41:39 +0000 (20:41 -0800)]
[CodeGen] Use range-based for loops (NFC)

3 years ago[Analysis] Drop unnecessary const from return types (NFC)
Kazu Hirata [Sun, 14 Feb 2021 04:41:38 +0000 (20:41 -0800)]
[Analysis] Drop unnecessary const from return types (NFC)

Identified with readability-const-return-type.

3 years ago[TableGen] Use ListSeparator (NFC)
Kazu Hirata [Sun, 14 Feb 2021 04:41:36 +0000 (20:41 -0800)]
[TableGen] Use ListSeparator (NFC)

3 years ago[AVR] Fix a bug in 16-bit shifts
Ben Shi [Sun, 14 Feb 2021 03:54:55 +0000 (11:54 +0800)]
[AVR] Fix a bug in 16-bit shifts

Reviewed By: aykevl

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

3 years ago[gold] Add case being tested by equivalent lld test
Teresa Johnson [Sun, 14 Feb 2021 01:09:56 +0000 (17:09 -0800)]
[gold] Add case being tested by equivalent lld test

The new tests added by 1487747e990ce9f8851f3d92c3006a74134d7518 for lld
and gold plugin were largely equivalent, but the gold one was missing
one of the cases added to lld. Add that test to the gold plugin version.

3 years ago[lld] Reorder cases in test to match comments (NFC)
Teresa Johnson [Sun, 14 Feb 2021 00:32:39 +0000 (16:32 -0800)]
[lld] Reorder cases in test to match comments (NFC)

The test added in 1487747e990ce9f8851f3d92c3006a74134d7518 had a few
cases that were out of order compared to the comments. Reordered to
match.

3 years ago[LTT] Address post-review comments (NFC)
Teresa Johnson [Thu, 11 Feb 2021 03:07:51 +0000 (19:07 -0800)]
[LTT] Address post-review comments (NFC)

Implement some post-review cleanup suggestions for D96083.

3 years ago[Clang] Ensure vector predication loop metadata is always emitted when pragma is...
Malhar [Sat, 13 Feb 2021 21:57:21 +0000 (15:57 -0600)]
[Clang] Ensure vector predication loop metadata is always emitted when pragma is specified.

This patch ensures that vector predication and vectorization width
pragmas work together correctly/as expected. Specifically, this patch
fixes the issue that when vectorization_width > 1, the vector
predication behaviour (this would matter if it has NOT been disabled
explicitly by a pragma) was getting ignored, which was incorrect.

The fix here removes the dependence of vector predication on the
vectorization width. The loop metadata corresponding to clang loop
pragma vectorize_predicate is always emitted, if the pragma is
specified, even if vectorization is disabled by vectorize_width(1)
or vectorize(disable) since the option is also used for interleaving
by the LoopVectorize pass.

Reviewed By: dmgreen, Meinersbur

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

3 years agoELFObjectWriter: Simplify
Fangrui Song [Sat, 13 Feb 2021 22:52:30 +0000 (14:52 -0800)]
ELFObjectWriter: Simplify

* Delete unused ELFSymbolData::operator<
* Inline createStringTable
* Fix a comment
* Change align to return uint64_t

3 years ago[CMake][mlir] Fix mlir-linalg-ods-gen/CMakeLists.txt after D96645
Fangrui Song [Sat, 13 Feb 2021 22:16:38 +0000 (14:16 -0800)]
[CMake][mlir] Fix mlir-linalg-ods-gen/CMakeLists.txt after D96645

3 years ago[RISCV] Rename the RVVBaseAddr ComplexPattern to just BaseAddr and use it to merge...
Craig Topper [Sat, 13 Feb 2021 08:42:25 +0000 (00:42 -0800)]
[RISCV] Rename the RVVBaseAddr ComplexPattern to just BaseAddr and use it to merge some scalar load/store patterns too.

3 years agoELFObjectWriter: Delete redundant registerSymbol
Fangrui Song [Sat, 13 Feb 2021 20:01:37 +0000 (12:01 -0800)]
ELFObjectWriter: Delete redundant registerSymbol

MCELFStreamer::changeSection has registered the group signature symbol.

3 years agofix linalg ods gen cross compiling like other gen executables
daquexian [Sat, 13 Feb 2021 17:15:47 +0000 (17:15 +0000)]
fix linalg ods gen cross compiling like other gen executables

Signed-off-by: daquexian <daquexian566@gmail.com>
Reviewed By: vinograd47

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

3 years ago[lldb][test] Fix Shell/SymbolFile/symbol-binding.test
Fangrui Song [Sat, 13 Feb 2021 19:10:29 +0000 (11:10 -0800)]
[lldb][test] Fix Shell/SymbolFile/symbol-binding.test

3 years agoELFObjectWriter: Don't sort non-local symbols
Fangrui Song [Sat, 13 Feb 2021 18:32:27 +0000 (10:32 -0800)]
ELFObjectWriter: Don't sort non-local symbols

As we don't sort local symbols, don't sort non-local symbols.  This makes
non-local symbols appear in their register order, which matches GNU as. The
register order is nice in that you can write tests with interleaved CHECK
prefixes, e.g.

```
// CHECK: something about foo
.globl foo
foo:
// CHECK: something about bar
.globl bar
bar:
```

With the lexicographical order, the user needs to place lexicographical smallest
symbol first or keep CHECK prefixes in one place.

3 years ago[InstCombine] add tests for pow() divisor; NFC
Sanjay Patel [Sat, 13 Feb 2021 16:00:55 +0000 (11:00 -0500)]
[InstCombine] add tests for pow() divisor; NFC

3 years ago[pstl] Iterator types renaming: ForwardIterator -> RandomAccessIterator; for parallel...
Mikhail Dvorskiy [Sat, 13 Feb 2021 17:28:50 +0000 (20:28 +0300)]
[pstl] Iterator types renaming: ForwardIterator -> RandomAccessIterator; for parallel patterns/bricks

https://reviews.llvm.org/D96266

3 years ago[IRBuilder] Remove Align-related deprecated APIs
Nikita Popov [Sat, 13 Feb 2021 15:39:44 +0000 (16:39 +0100)]
[IRBuilder] Remove Align-related deprecated APIs

This removes IRBuilder methods accepting unsigned alignments
in favor of their Align/MaybeAlign variants. These methods have
been deprecated for more than a year at this point, so they
should be safe to remove.