platform/upstream/llvm.git
20 months ago[Pipeline] Remove -enable-no-rerun-simplification-pipeline flag
Arthur Eubanks [Wed, 15 Feb 2023 19:19:48 +0000 (11:19 -0800)]
[Pipeline] Remove -enable-no-rerun-simplification-pipeline flag

This has been on without complaint for a while.

Reviewed By: asbirlea

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

20 months ago[libc][bazel] add string to float targets
Michael Jones [Wed, 15 Feb 2023 22:26:30 +0000 (14:26 -0800)]
[libc][bazel] add string to float targets

This patch adds atof, strtof, strtod, and strtold to the bazel build, as
well as their tests.

Reviewed By: sivachandra

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

20 months ago[lldb] Replace SB swig interfaces with API headers
Alex Langford [Fri, 27 Jan 2023 01:33:33 +0000 (17:33 -0800)]
[lldb] Replace SB swig interfaces with API headers

Instead of maintaining separate swig interface files, we can use the API
headers directly. They implement the exact same C++ APIs and we can
conditionally include the python extensions as needed. To remove the
swig extensions from the API headers when building the LLDB
framework, we can use the unifdef tool when it is available. Otherwise
we just copy them as-is.

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

20 months ago[libc++] Add regression test for std::hash implementation in ABI v1
Louis Dionne [Wed, 15 Feb 2023 15:49:45 +0000 (10:49 -0500)]
[libc++] Add regression test for std::hash implementation in ABI v1

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

20 months ago[mlir][linalg][tensor] Delete duplicate tests and fix typo in filename
Hanhan Wang [Thu, 16 Feb 2023 01:38:46 +0000 (17:38 -0800)]
[mlir][linalg][tensor] Delete duplicate tests and fix typo in filename

These two files contain the identical tests. The commit deletes one of
the files, and fix a typo in filename for the other one.

Reviewed By: chelini

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

20 months agoRemove Renderscript LLDB
Yi Kong [Tue, 14 Feb 2023 06:55:57 +0000 (14:55 +0800)]
Remove Renderscript LLDB

Renderscript is deprecated from Android, we no longer support LLDB for
Renderscript.

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

20 months ago[RISCV] Accept zicsr and zifencei command line options
Philip Reames [Thu, 16 Feb 2023 18:27:52 +0000 (10:27 -0800)]
[RISCV] Accept zicsr and zifencei command line options

This change adds the definition of the two extensions, but does not either a) make any instruction conditional on them or b) enabled the extensions by default. (The *instructions* do remain enabled by default per ISA version 2.0 which is our current default.)

This is meant to be a building block towards something like https://reviews.llvm.org/D141666, and in the meantime, address one of the most surprising of the current user experience warts. The current behavior of rejecting the extensions at the command line despite emitting code which appears to use them is surprising to anyone not deeply versed in the details of this situation.

Between versions 2.0 and 2.1 of the base I specification, a backwards incompatible change was made to remove selected instructions and CSRs from the base ISA. These instructions were grouped into a set of new extensions (these), but were no longer required by the base ISA. This change is described in “Preface to Document Version 20190608-Base-Ratified” from the specification document.

As LLVM currently implements only version 2.0 of the base specification, accepting these extensions at the command line introduces a configuration which doesn't actually match any spec version. It's a pretty harmless variant since the 2.0 extension definitions, to my knowledge, exactly match the text from the 2.0 I text before they were moved into standalone extensions in 2.1 of I. (The version numbering in that sentence is a tad confusing to say the least. Hopefully I got it right.)

It is worth noting that we already have numerous examples of accepting extensions in the march string which didn't exist in version of the spec document corresponding to our current base I version, so this doesn't set any new precedent.

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

20 months ago[libunwind][PowerPC] Fix saving/restoring VSX registers on LE systems
Nemanja Ivanovic [Thu, 16 Feb 2023 18:37:31 +0000 (13:37 -0500)]
[libunwind][PowerPC] Fix saving/restoring VSX registers on LE systems

Currently, libunwind just uses stxvd2x/lxvd2x to save/restore
VSX registers respectively. This puts the registers in
doubleword-reversed order into memory on little endian systems.
If both the save and restore are done the same way, this
isn't a problem. However if the unwinder is just restoring
a callee-saved register, it will restore it in the wrong
order (since function prologues save them in the correct order).
This patch adds the necessary swaps before the saves and after
the restores.

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

20 months ago[libc] Implement htonl and htons
Raman Tenneti [Thu, 16 Feb 2023 17:56:36 +0000 (09:56 -0800)]
[libc] Implement htonl and htons

Per spec:
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/htonl.html
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/htons.html

Also adds UInt16Type and UInt32Type to spec.td

Co-authored-by: Jeff Bailey <jbailey@google.com>
Reviewed By: sivachandra, jeffbailey, rtenneti

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

20 months ago[Hexagon] Fix number of arguments in call to DAG.getNode for VINSERTW0
Krzysztof Parzyszek [Wed, 15 Feb 2023 21:59:54 +0000 (13:59 -0800)]
[Hexagon] Fix number of arguments in call to DAG.getNode for VINSERTW0

HexagonISD::VINSERTW0 takes two inputs, but only one was provided.

20 months ago[HLSL] add log library functions
Joshua Batista [Thu, 16 Feb 2023 17:28:33 +0000 (09:28 -0800)]
[HLSL] add log library functions

This change exposes the log library functions for HLSL,excluding long, int, and long long doubles. The log functions are supported for all scalar, vector, and matrix types.
Long and long long double support is missing in this patch because those types
don't exist in HLSL. Int is missing because the log functions only work on floating type arguments.

The full documentation of the HLSL log functions are available here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-log
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-log2
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-log10

Reviewed By: python3kgae

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

20 months agoRevert "[RISCV][MC] Add support for experimental zfa extension (FLI instruction not...
Philip Reames [Thu, 16 Feb 2023 17:30:14 +0000 (09:30 -0800)]
Revert "[RISCV][MC] Add support for experimental zfa extension (FLI instruction not included)"

This reverts commit f6fa5a66d8a8190002d3eb542e4b5a99deb53004.  Several buildbots are failing.  An example:
https://lab.llvm.org/buildbot#builders/196/builds/26601

20 months agoAMDGPU: Add a regression test case for D143963
Jay Foad [Thu, 16 Feb 2023 17:09:26 +0000 (17:09 +0000)]
AMDGPU: Add a regression test case for D143963

20 months agoRevert "AMDGPU: Override getNegatedExpression constant handling"
Jay Foad [Thu, 16 Feb 2023 17:05:33 +0000 (17:05 +0000)]
Revert "AMDGPU: Override getNegatedExpression constant handling"

This reverts commit 11c3cead23783e65fb30e673d62771352078ff05.

It was causing infinite loops in the DAG combiner.

20 months agoRevert "[LowerTypeTests] Support generating Armv6-M jump tables."
Simon Tatham [Thu, 16 Feb 2023 17:05:43 +0000 (17:05 +0000)]
Revert "[LowerTypeTests] Support generating Armv6-M jump tables."

This reverts commit f6ddf7781471b71243fa3c3ae7c93073f95c7dff.

Eight buildbots reported that the two test files changed by that
commit had started failing. The buildbots in question all had in
common that they build with a very restricted `LLVM_TARGETS_TO_BUILD`,
such as only X86 or AArch64 or Hexagon. I didn't notice this before
commit because my own build has the full default set of targets, and
in that circumstance, the tests pass.

I assume the problem has something to do with the attempt to query
TargetTransformInfo: if you can't make a valid TTI for the target
triple then you can't ask it what kind of inline assembler you should
be emitting, and so `opt` without the Arm backend can't get the Arm
cases of these tests right.

I don't have time to fix this until next week, so I'll revert the
change for now to keep the buildbots happy.

20 months ago[AMDGPU] Add another G_UNMERGE_VALUES legalization test case
Jay Foad [Thu, 16 Feb 2023 16:41:25 +0000 (16:41 +0000)]
[AMDGPU] Add another G_UNMERGE_VALUES legalization test case

20 months ago[libc] Support running tests for Pigweed
Alex Brachet [Thu, 16 Feb 2023 16:38:19 +0000 (16:38 +0000)]
[libc] Support running tests for Pigweed

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

20 months ago[AMDGPU] Regenerate check lines to enable updating for D144050.
Florian Hahn [Thu, 16 Feb 2023 16:38:15 +0000 (16:38 +0000)]
[AMDGPU] Regenerate check lines to enable updating for D144050.

20 months ago[XCore] Adapt Clang tests to opaque pointers.
Nigel Perks [Wed, 15 Feb 2023 14:44:57 +0000 (14:44 +0000)]
[XCore] Adapt Clang tests to opaque pointers.

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

20 months ago[flang] Always incorporate parent types' special generic bindings
Peter Klausler [Thu, 16 Feb 2023 00:39:14 +0000 (16:39 -0800)]
[flang] Always incorporate parent types' special generic bindings

The runtime type information table generator was broken when dealing
with an extension derived type that didn't include a special generic
procedure binding for ASSIGNMENT(=) or user-defined I/O, but one of
whose ancestor types did.  Ensure that the runtime derived type info
tables have complete subtables for all of these special bindings,
and respect any overrides that may have been defined.

Motivating example:
  type parent
   contains
    procedure :: dtWrite => dtWrite1
    generic :: write(formatted) => dtWrite
  end type
  type, extends(parent) :: extended
   contains
    procedure :: dtWrite => dtWrite2
  end type

The runtime derived type information table for "extended" must include
a special generic procedure entry for "write(formatted)" that points
to "dtWrite2" even though "extend" has no generic procedure for
"write(formatted)".

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

20 months ago[LSR] Add test case which shows additional LSR with D144050.
Florian Hahn [Thu, 16 Feb 2023 16:12:07 +0000 (16:12 +0000)]
[LSR] Add test case which shows additional LSR with D144050.

20 months ago[Libomptarget] Check errors when synchronizing the async queue
Joseph Huber [Thu, 16 Feb 2023 15:51:21 +0000 (09:51 -0600)]
[Libomptarget] Check errors when synchronizing the async queue

Currently when we synchronize the asynchronous queue for the plugins, we
ignore the return value. This is problematic because we will continue on
like nothing happened if the kernel fails.

Fixes https://github.com/llvm/llvm-project/issues/60814

Reviewed By: jdoerfert

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

20 months ago[RISCV][MC] Add support for experimental zfa extension (FLI instruction not included)
Jun Sha (Joshua) [Thu, 16 Feb 2023 15:51:34 +0000 (07:51 -0800)]
[RISCV][MC] Add support for experimental zfa extension (FLI instruction not included)

This implements experimental support for the RISCV Zfa extension as specified here: https://github.com/riscv/riscv-isa-manual/releases/download/draft-20221119-5234c63/riscv-spec.pdf, Ch. 25. This extension has not been ratified. Once ratified, it'll move out of experimental status.

This change adds assembly support for all instructions except load-immediate instructions (fli.s/fli.d/fli.h).  Assembly support for that instruction and codegen support will follow in separate patches.

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

20 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 16 Feb 2023 15:53:59 +0000 (16:53 +0100)]
[Clang] Convert some tests to opaque pointers (NFC)

20 months ago[Clang] Regenerate check lines (NFC)
Nikita Popov [Thu, 16 Feb 2023 15:49:30 +0000 (16:49 +0100)]
[Clang] Regenerate check lines (NFC)

Convert test to use update_cc_test_checks.

20 months agoRevert "[RISCV][MC] Add support for experimental zfa extension(FLI instruction not...
Philip Reames [Thu, 16 Feb 2023 15:22:51 +0000 (07:22 -0800)]
Revert "[RISCV][MC] Add support for experimental zfa extension(FLI instruction not included)"

This reverts commit 54c136e6c630966255293d42c882eab116437834. It was submitted without an appropriate patch description.  Will reapply shortly.

20 months agoRevert "Update: [RISCV][MC] Add support for experimental zfa extension(FLI instructio...
Philip Reames [Thu, 16 Feb 2023 15:22:46 +0000 (07:22 -0800)]
Revert "Update: [RISCV][MC] Add support for experimental zfa extension(FLI instruction not included)"

This reverts commit 321cd52ba2647259f58b0d38cdb62528a9ded9a1. It was submitted without an appropriate patch description.  Will reapply shortly.

20 months agoRevert "[RISCV][CodeGen] Add codegen pattern for experimental zfa extension (FLI...
Philip Reames [Thu, 16 Feb 2023 15:22:15 +0000 (07:22 -0800)]
Revert "[RISCV][CodeGen] Add codegen pattern for experimental zfa extension (FLI and FCVTMOD not included)"

This reverts commit fc6d517e2f335c2ab2b14a34eb747a4703aca7e4.  It was submitted without an appropriate patch description.  Will reapply shortly.

20 months ago[LSR] Improve filtered uses in NarrowSearchSpaceByPickingWinnerRegs
David Green [Thu, 16 Feb 2023 15:48:12 +0000 (15:48 +0000)]
[LSR] Improve filtered uses in NarrowSearchSpaceByPickingWinnerRegs

NarrowSearchSpaceByPickingWinnerRegs has an aggressive filtering method to
reduce the complexity of the search space down by picking a best formula with
the highest number of reuses and assuming it will yield profitable reuse. In
certain cases we can find a best formula like {X+30,+,1} and later check a
formula like {X,+,1} with the same number of Uses. On some architectures it
can be better to pick {X,+,1}, especially if an offset of 30 can be used as a
legal addressing mode, but -30 cannot. That happens under Thumb1 code, which
has fairly limited addressing modes. This patch adds a check to see if it can
pick the simpler formula, if it looks more profitable.

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

20 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 16 Feb 2023 15:37:20 +0000 (16:37 +0100)]
[Clang] Convert some tests to opaque pointers (NFC)

20 months ago[LowerTypeTests] Support generating Armv6-M jump tables.
Simon Tatham [Thu, 16 Feb 2023 15:34:33 +0000 (15:34 +0000)]
[LowerTypeTests] Support generating Armv6-M jump tables.

The LowerTypeTests pass emits a jump table in the form of an
`inlineasm` IR node containing a string representation of some
assembly. It tests the target triple to see what architecture it
should be generating assembly for. But that's not good enough for
`Triple::thumb`, because the 32-bit PC-relative `b.w` branch
instruction isn't available in all supported architecture versions. In
particular, Armv6-M doesn't support that instruction (although the
similar Armv8-M Baseline does).

Most of this patch is concerned with working out whether the
compilation target is Armv6-M or not, which I'm doing by going through
all the functions in the module, retrieving a TargetTransformInfo for
each one, and querying it via a new method I've added to check its
SubtargetInfo. If any function's TTI indicates that it's targeting an
architecture supporting B.W, then we assume we're also allowed to use
B.W in the jump table.

The Armv6-M compatible jump table format requires a temporary
register, and therefore also has to use the stack in order to restore
that register.

Another consequence of this change is that jump tables on Arm/Thumb
are no longer always the same size. In particular, on an architecture
that supports Arm and Thumb-1 but not Thumb-2, the Arm and Thumb
tables are different sizes from //each other//. As a consequence,
``getJumpTableEntrySize`` can no longer base its answer on the target
triple's architecture: it has to take into account the decision that
``selectJumpTableArmEncoding`` made, which meant I had to move that
function to an earlier point in the code and store its answer in the
``LowerTypeTestsModule`` class.

Reviewed By: lenary

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

20 months agollvm-tblgen: Apply IWYU partially
NAKAMURA Takumi [Thu, 16 Feb 2023 15:28:07 +0000 (00:28 +0900)]
llvm-tblgen: Apply IWYU partially

20 months ago[flang] lower hlfir.matmul into fir runtime call
Tom Eccles [Tue, 14 Feb 2023 18:09:35 +0000 (18:09 +0000)]
[flang] lower hlfir.matmul into fir runtime call

We can't test lowering calls with hlfir.expr arguments yet because this
hits a not yet implemented: "get shape form HLFIR expr without producer
holding the shape".

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

20 months ago[flang] lower matmul intrinsic to hlfir.matmul operation
Tom Eccles [Tue, 14 Feb 2023 12:04:52 +0000 (12:04 +0000)]
[flang] lower matmul intrinsic to hlfir.matmul operation

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

20 months ago[flang] add hlfir.matmul operation
Tom Eccles [Mon, 13 Feb 2023 18:04:46 +0000 (18:04 +0000)]
[flang] add hlfir.matmul operation

Add a HLFIR operation for the MATMUL transformational intrinsic,
according to the design set out in flang/doc/HighLevelFIR.md

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

20 months ago[mlir][MemRef] NFC - Add debug information to MultiBuffer.cpp
Nicolas Vasilache [Thu, 16 Feb 2023 15:02:21 +0000 (07:02 -0800)]
[mlir][MemRef] NFC - Add debug information to MultiBuffer.cpp

20 months ago[mlir][bufferization] Fix bug in findValueInReverseUseDefChain
Matthias Springer [Thu, 16 Feb 2023 15:05:58 +0000 (16:05 +0100)]
[mlir][bufferization] Fix bug in findValueInReverseUseDefChain

`alwaysIncludeLeaves` was not respected by all code paths.

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

20 months ago[DataLayout] Use separate vectors to store alignment (NFC)
Nikita Popov [Wed, 2 Dec 2020 20:31:22 +0000 (21:31 +0100)]
[DataLayout] Use separate vectors to store alignment (NFC)

Instead of storing alignment for integers, floats, vectors and
structs in a single vector with a type tag, store them in
separate vectors instead. This makes the alignment lookup faster,
as we don't have to scan over irrelevant alignment entries.

20 months ago[mlir] PromoteBuffersToStackPass - Copy attributes of original AllocOp
Maya Amrami [Thu, 2 Feb 2023 15:21:51 +0000 (17:21 +0200)]
[mlir] PromoteBuffersToStackPass - Copy attributes of original AllocOp

Reviewed By: nicolasvasilache

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

20 months ago[mlir][llvm] Use before def debug intrinsic import
Christian Ulmann [Thu, 16 Feb 2023 14:44:05 +0000 (15:44 +0100)]
[mlir][llvm] Use before def debug intrinsic import

This commit adds special handling for the debug intrinsic value
handling. LLVM allows to relax the def before use property for debug
intrinsics, so this property cannot be assumed for metadata values.

Reviewed By: gysit

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

20 months ago[Clang] Convert some tests to opaque pointers (NFC)
Nikita Popov [Thu, 16 Feb 2023 14:30:35 +0000 (15:30 +0100)]
[Clang] Convert some tests to opaque pointers (NFC)

20 months ago[ConstraintSystem] Use sparse representation for constraints. (NFC)
Florian Hahn [Thu, 16 Feb 2023 14:44:49 +0000 (14:44 +0000)]
[ConstraintSystem] Use sparse representation for constraints. (NFC)

Update ConstraintSystem to use a sparse representation for entries in a
row. Most rows only contain a small number of variables, so the sparse
representation can result in significant speedups.

For a large test case from D135915, it halves the time spent in
ConstraintElimination.

To ensure this returns the same results as the old implementation in all
cases, I built a large set of projects with an extra assertion that it
produces the same result as the old implementation.

20 months ago[ARM] Add Thumb LSR codegen tests. NFC
David Green [Thu, 16 Feb 2023 14:24:51 +0000 (14:24 +0000)]
[ARM] Add Thumb LSR codegen tests. NFC

This is the same routine generated in two different ways that ends up with
different orders to loads. The first currently does better than the second
with ordered loads, but needn't if the filtering in LSR is improved.

20 months ago[flang][hlfir] Array constructor lowering [part 2/4]
Jean Perier [Thu, 16 Feb 2023 14:20:34 +0000 (15:20 +0100)]
[flang][hlfir] Array constructor lowering [part 2/4]

This patch adds the lowering strategy that lowers an array constructor
to an hlfir.elemental (without creating any temporary yet in lowering).
This will allow more high level array expression optimization to elide
the array constructor temporary when possible, but this is only doable
for a restricted although common form of array constructors:
"[(pure_scalar_expr(i),i=lower,upper,stride)]".

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

20 months ago[flang][hlfir] Array constructor lowering [part 1/4]
Jean Perier [Thu, 16 Feb 2023 14:18:42 +0000 (15:18 +0100)]
[flang][hlfir] Array constructor lowering [part 1/4]

This is the first and biggest chunk that introduces support for
array constructor to HLFIR.

This patch:
- adds a new ConvertArrayConstructor.cpp that centralizes the
  code dealing with array constructor lowering.
- introduces a framework to lower array constructor according to
  different strategies: A common analysis of the array constructor is
  done, and based on that, a lowering startegy is selected and driven
  through the ac-values of the array constructor. See
  ConvertArrayConstructor.cpp comments for more details.
- implements the first strategy that creates a temporary inlined and
  updates it with inlined code. This strategy can only be used if the
  temporary can be pre-allocated (i.e: the extents and length parameters
  can be pre-computed without evaluating any ac-values), and if all the
  ac-value expressions are scalars.

For the sake of simplicity, characters and derived type will be enabled
once all the strategies are added.

Reviewed By: clementval, PeteSteinfeld

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

20 months ago[Flang][OpenMP] Added parser support for device_type clause
Akash Banerjee [Thu, 16 Feb 2023 13:42:47 +0000 (13:42 +0000)]
[Flang][OpenMP] Added parser support for device_type clause

This patch adds parser suppert for the device_type clause used by the Declare Target directive.

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

20 months ago[flang] Use derivedType from toAddedum to get updated components
Valentin Clement [Thu, 16 Feb 2023 13:53:47 +0000 (14:53 +0100)]
[flang] Use derivedType from toAddedum to get updated components

When the rhs is polymorphic and allocated during assignment, the
derivedType might have change from the one set in `toDerived`.
Use the one set in the addendum so it is always up to date.

This can happen in cases like the one shown below:

```
type :: t1
end type t1

type, extends(t1) :: t2
  integer, allocatable :: i(:)
end type

subroutine assign(t)
  class(t2), intent(in) :: t
  class(t1), allocatable :: cp

  cp = t
end subroutine
```

Reviewed By: jeanPerier

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

20 months ago[mlir][Linalg] Add a transform dialect op to rewrite ops to destination passing style.
Nicolas Vasilache [Wed, 15 Feb 2023 17:23:52 +0000 (09:23 -0800)]
[mlir][Linalg] Add a transform dialect op to rewrite ops to destination passing style.

A new transform dialect op is introduced to perform the rewrite.
The test pass option is now obsolete and is removed in favor of the transform.

In the process I realized the tensor.pad nofold attribute was not taken into account
and added support to emit a bufferization.alloc_tensor + linalg.copy.

Reviewed By: springerm

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

20 months agoAdd a lowering for memref.dealloc with unranked memrefs.
Johannes Reifferscheid [Thu, 16 Feb 2023 13:17:28 +0000 (14:17 +0100)]
Add a lowering for memref.dealloc with unranked memrefs.

This is permitted by the op, but the current lowering generates invalid IR.

Reviewed By: springerm

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

20 months ago[SME2][AArch64] Add multi-single multiply-add long long intrinsics
Kerry McLaughlin [Thu, 16 Feb 2023 11:58:32 +0000 (11:58 +0000)]
[SME2][AArch64] Add multi-single multiply-add long long intrinsics

Adds intrinsics for the following SME2 instructions:
 - smlall (1, 2 & 4 vectors)
 - umlall (1, 2 & 4 vectors)
 - smlsll (1, 2 & 4 vectors)
 - umlsll (1, 2 & 4 vectors)
 - sumlall (2 & 4 vectors)
 - usmlall (1, 2 & 4 vectors)

NOTE: These intrinsics are still in development and are subject to future changes.

Reviewed By: david-arm

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

20 months ago[flang] Add TODO instead of crashing on assert
Valentin Clement [Thu, 16 Feb 2023 13:05:03 +0000 (14:05 +0100)]
[flang] Add TODO instead of crashing on assert

Current code are crashing on the assert `assert(seqTy && "must be an array");`.

Add a TODO instead until the support is in.

Reviewed By: jeanPerier

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

20 months ago[libc++] LWG 3857: allow `string_view` conversion when only traits vary
Joe Loser [Tue, 14 Feb 2023 03:16:50 +0000 (20:16 -0700)]
[libc++] LWG 3857: allow `string_view` conversion when only traits vary

The `basic_string_view` constructor accepting a contiguous range rejects
converting between `basic_string_view` even when only the trait types vary.
This prevents conversions for converting from `basic_string_view<C, T1>` and
`basic_string<C, T1, A>` to `basic_string_view<C, T2>`.  Recently, this
constructor was made `explicit`, so there's no reason to really forbid this
conversion anymore.

Relax the restriction that the trait types need to match in this constructor.

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

20 months ago[clang] Fix a bug that allowed some overflowing octal escape sequences
Sergei Barannikov [Wed, 15 Feb 2023 14:04:37 +0000 (17:04 +0300)]
[clang] Fix a bug that allowed some overflowing octal escape sequences

Reviewed By: cor3ntin

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

20 months ago[MachineCombiner][NFC] Rename `MinInstr` to `TraceEnsemble`
Anton Sidorenko [Tue, 14 Feb 2023 10:30:59 +0000 (13:30 +0300)]
[MachineCombiner][NFC] Rename `MinInstr` to `TraceEnsemble`

We are about to allow different trace strategies for MachineCombiner. Make
the name of the ensemble strategy-neutral.

Depends on D140540

Reviewed By: spatel

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

20 months ago[LV] Move invalid cost remark code to separate function (NFC).
Florian Hahn [Thu, 16 Feb 2023 11:28:18 +0000 (11:28 +0000)]
[LV] Move invalid cost remark code to separate function (NFC).

The code only needs access to INvalidCosts, ORE and TheLoop, so it can
easily be moved into a helper to make selectVectorizationFactor more
compact.

Reviewed By: sdesmalen

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

20 months ago[mlir][llvm] Rename void debug type to null
Christian Ulmann [Thu, 16 Feb 2023 10:36:34 +0000 (11:36 +0100)]
[mlir][llvm] Rename void debug type to null

This commit renames the "di_void_result_type" to "di_null_type" as LLVM
does use null not exclusively for void types. An added test demonstrates
this for variadic function declarations, whose DISubroutine indicates the
start of variadic types with `null`.

Reviewed By: gysit

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

20 months ago[UniformityAnalysis] Fix some file headers and pass names
Jay Foad [Thu, 16 Feb 2023 09:01:48 +0000 (09:01 +0000)]
[UniformityAnalysis] Fix some file headers and pass names

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

20 months ago[Flang][OpenMP] Fix a corner case where target region is empty
Kiran Chandramohan [Thu, 16 Feb 2023 09:23:16 +0000 (09:23 +0000)]
[Flang][OpenMP] Fix a corner case where target region is empty

Reviewed By: psoni2628, raghavendhra

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

20 months ago[mlir][MemRef|Tensor] Fix the handling of DimOp
Quentin Colombet [Fri, 27 Jan 2023 15:10:54 +0000 (16:10 +0100)]
[mlir][MemRef|Tensor] Fix the handling of DimOp

Although specifying an index that is out of bounds for both `memref.dim`
and `tensor.dim` produces an undefined behavior, this is still valid IR.
In particular, we could expose an out of bound index because of some
optimizations, for instance as demonstrated with
https://github.com/llvm/llvm-project/issues/60295, and this shouldn't
cause the compiler to abort.

This patch removes the overzealous verifier checks and properly handles
out of bound indices (as in it doesn't crash the compiler, but still
produces UB).

This fixes https://github.com/llvm/llvm-project/issues/60295.

Note: That `shape.dim` has a similar problem but we're not supposed to
produce UB in this case. Instead we're supposed to propagate an error in
the resulting value and I don't know how to do that at the moment. Hence I
left this part out of the patch.

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

20 months ago[llvm-debuginfo-analyzer] (08a/09) - Memory Management
Carlos Alberto Enciso [Thu, 16 Feb 2023 09:52:50 +0000 (09:52 +0000)]
[llvm-debuginfo-analyzer] (08a/09) - Memory Management

llvm-debuginfo-analyzer is a command line tool that processes debug
info contained in a binary file and produces a debug information
format agnostic “Logical View”, which is a high-level semantic
representation of the debug info, independent of the low-level
format.

The code has been divided into the following patches:

1) Interval tree
2) Driver and documentation
3) Logical elements
4) Locations and ranges
5) Select elements
6) Warning and internal options
7) Compare elements
8) ELF Reader
8a) Memory Management
9) CodeView Reader

Full details:

https://discourse.llvm.org/t/llvm-dev-rfc-llvm-dva-debug-information-visual-analyzer/62570

This patch:

This is a high level summary of the changes in this patch.

Memory Management
- Use Bump allocators for memory management.

As the logical elements are only allocated in one pass (debuginfo
parsing) and they are never manipulated/created/destroyed later,
use the SpecificBumpPtrAllocator for the memory management.

Reviewed By: dblaikie, Orlando

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

20 months agoAArch64: count callee stack we use when estimating scavenging requirements.
Tim Northover [Fri, 27 Jan 2023 13:18:59 +0000 (13:18 +0000)]
AArch64: count callee stack we use when estimating scavenging requirements.

20 months ago[AMDGPU] Autogenerate checks for several tests. NFCI
Diana Picus [Thu, 16 Feb 2023 09:07:50 +0000 (10:07 +0100)]
[AMDGPU] Autogenerate checks for several tests. NFCI

20 months ago[lld-macho] Use uint64_t instead of size_t to fix 32 bit test failures
David Spickett [Thu, 16 Feb 2023 09:41:50 +0000 (09:41 +0000)]
[lld-macho] Use uint64_t instead of size_t to fix 32 bit test failures

Our bot has been failing https://lab.llvm.org/buildbot/#/builders/178/builds/3967:
Assertion `isecEnd - isecVA <= forwardBranchRange && "should only finalize sections in jump range"' failed.

I think this is due to the use of size_t, which is 32 bit on 32 bit,
for a value used in some 64 bit address calculations. Which was added in
https://reviews.llvm.org/D144029.

Switching to uint64_t fixes the issues.

20 months ago[InstSimplify] Slightly optimize simplifyLoad() (NFC)
Nikita Popov [Wed, 15 Feb 2023 13:39:52 +0000 (14:39 +0100)]
[InstSimplify] Slightly optimize simplifyLoad() (NFC)

Check upfront whether the load is based on a constant global
with definitive initializer. Don't bother computing offsets
otherwise.

20 months ago[NFC] Add a test for C++20 Modules
Chuanqi Xu [Thu, 16 Feb 2023 09:13:31 +0000 (17:13 +0800)]
[NFC] Add a test for C++20 Modules

Add a test to check that the template instantiation during the template
specialization wouldn't be emitted again in the importer.

20 months ago[JT][CT] Preserve exisiting BPI/BFI during JumpThreading
Evgeniy Brevnov [Tue, 14 Feb 2023 10:03:42 +0000 (17:03 +0700)]
[JT][CT] Preserve exisiting BPI/BFI during JumpThreading

Currently, JT creates and updates local instances of BPI\BFI. As a result global ones have to be invalidated if JT made any changes.
In fact, JT doesn't use any information from BPI/BFI for the sake of the transformation itself. It only creates BPI/BFI to keep them up to date. But since it updates local copies (besides cases when it updates profile metadata) it just waste of time.

Current patch is a rework of D124439. D124439 makes one step and replaces local copies with global ones retrieved through AnalysisPassManager. Here we do one more step and don't create BPI/BFI if the only reason of creation is to keep BPI/BFI up to date. Overall logic is the following. If there is cached BPI/BFI then update it along the transformations. If there is no existing BPI/BFI, then create it only if it is required to update profile metadata.

Please note if BPI/BFI exists on exit from JT (either cached or created) it is always up to date and no reason to invalidate it.

Reviewed By: mkazantsev

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

20 months ago[NFC] Add two tests for C++ modules
Chuanqi Xu [Thu, 16 Feb 2023 08:24:37 +0000 (16:24 +0800)]
[NFC] Add two tests for C++ modules

One test for checking the decls in language linkage shouldn't be
discarded and can be mangled correctly.

Another one for checking we can't export again in an export decl.

20 months ago[mlir][llvm] Import alias scope metadata from LLVM IR.
Tobias Gysi [Thu, 16 Feb 2023 06:40:26 +0000 (07:40 +0100)]
[mlir][llvm] Import alias scope metadata from LLVM IR.

The revision adds support for importing alias.scope and noalias metadata
from LLVM IR into LLVM dialect. It also adds a verifier to the
AliasScopeMetadataOp to check that the associated domain exists
and is of type AliasScopeDomainMetadataOp.

Reviewed By: Dinistro

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

20 months ago[InstCombine] Call simplifyInsertValueInst()
Nikita Popov [Thu, 16 Feb 2023 08:47:14 +0000 (09:47 +0100)]
[InstCombine] Call simplifyInsertValueInst()

InstCombine is supposed to be a superset of InstSimplify, but we
were not attempting simplification of insertvalue instructions.
As the test change illustrates, we failed to remove some aggregate
construction patterns because of that.

20 months ago[InstCombine] Add additional aggregate reconstruction test (NFC)
Nikita Popov [Thu, 16 Feb 2023 08:47:44 +0000 (09:47 +0100)]
[InstCombine] Add additional aggregate reconstruction test (NFC)

This is like test2 from the same file, but using poison instead of
undef as base, which matches the IR we use nowadays.

20 months ago[InstSimplify] Fix poison safety in insertvalue fold
Nikita Popov [Wed, 15 Feb 2023 15:29:23 +0000 (16:29 +0100)]
[InstSimplify] Fix poison safety in insertvalue fold

We can only fold insertvalue undef, (extractvalue x, n) to x
if x is not poison, otherwise we might be replacing undef with
poison (https://alive2.llvm.org/ce/z/fnw3c8). The insertvalue
poison case is always fine.

I didn't go to particularly large effort to preserve cases where
folding with undef is still legal (mainly when there is a chain of
multiple inserts that end up covering the whole aggregate),
because this shouldn't really occur in practice: We should always
be generating the insertvalue poison form when constructing
aggregates nowadays.

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

20 months ago[flang] Retrieve the correct scope when lowering SELECT TYPE
Valentin Clement [Thu, 16 Feb 2023 08:05:12 +0000 (09:05 +0100)]
[flang] Retrieve the correct scope when lowering SELECT TYPE

Scope to retrieve the associating entity is needed to map the
symbol to the IR value. The scope can be found with a source
information. For the type case in SELECT TYPE construct, the source
information is on the Statement<TypeCase>. This patch updates
the lowering so the scopes for each type guards is retrieved
before the processing.

Reviewed By: PeteSteinfeld, vdonaldson

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

20 months ago[mlir] Add check for value that might be null.
jacquesguan [Fri, 13 Jan 2023 08:00:21 +0000 (16:00 +0800)]
[mlir] Add check for value that might be null.

Because we are generating uninitialized value for no integer type and use `isUninitialized()` to judge if it is valid after https://reviews.llvm.org/rG93f081c896536112e1ca8133991d23cb1134793a, we should check the value before use `getValue` to get it.
Fixes https://github.com/llvm/llvm-project/issues/59984.

Reviewed By: Mogball

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

20 months ago[LoopDeletion] Remove legacy pass
Fangrui Song [Thu, 16 Feb 2023 07:31:05 +0000 (23:31 -0800)]
[LoopDeletion] Remove legacy pass

Following recent changes to remove non-core legacy passes.

20 months ago[Modules] Code cleanup after removing ModulesTS
Chuanqi Xu [Thu, 16 Feb 2023 07:22:12 +0000 (15:22 +0800)]
[Modules] Code cleanup after removing ModulesTS

Some codes become unused after we remove ModulesTS.

20 months ago[Modules] Remove -fmodules-ts
Chuanqi Xu [Wed, 15 Feb 2023 10:30:49 +0000 (18:30 +0800)]
[Modules] Remove -fmodules-ts

As the diagnostic message shows, we should remove -fmodules-ts flag in
clang/llvm17. Since clang/llvm16 is already branched. We can remove the
depreacared flag now.

20 months ago[X86] Support load/store for bf16 in avx
Xiang1 Zhang [Thu, 16 Feb 2023 05:38:12 +0000 (13:38 +0800)]
[X86] Support load/store for bf16 in avx

Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D144163

20 months agoUse llvm::has_single_bit<uint32_t> (NFC)
Kazu Hirata [Thu, 16 Feb 2023 06:17:27 +0000 (22:17 -0800)]
Use llvm::has_single_bit<uint32_t> (NFC)

This patch replaces isPowerOf2_32 with llvm::has_single_bit<uint32_t>
where the argument is wider than uint32_t.

20 months ago[ADT] Use llvm::rotr (NFC)
Kazu Hirata [Thu, 16 Feb 2023 06:13:30 +0000 (22:13 -0800)]
[ADT] Use llvm::rotr (NFC)

This patch replaces rotate with llvm::rotate<uint64_t> where the
rotate count is an immediate.

20 months ago[Modules] Refactor modules-ts tests to use standard c++ modules
Chuanqi Xu [Thu, 16 Feb 2023 05:57:25 +0000 (13:57 +0800)]
[Modules] Refactor modules-ts tests to use standard c++ modules

We're going to remove the support for modules-ts. But there are a lot of
tests which uses -fmodules-ts. We shouldn't remove them simply. This
patch refactor these tests to use standard c++ modules.

20 months ago[RISCV][CodeGen] Add codegen pattern for experimental zfa extension (FLI and FCVTMOD...
Jun Sha (Joshua) [Thu, 16 Feb 2023 05:41:41 +0000 (13:41 +0800)]
[RISCV][CodeGen] Add codegen pattern for experimental zfa extension (FLI and FCVTMOD not included)

20 months ago[Clang][RISCV] Sort test cases into its mnemonics
eopXD [Thu, 16 Feb 2023 00:44:41 +0000 (16:44 -0800)]
[Clang][RISCV] Sort test cases into its mnemonics

Referencing the corresponding change from the source of the test cases:
riscv-non-isa/rvv-intrinsic-doc#196

Reviewed By: craig.topper

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

20 months ago[mlir][vector] NFC: Improve vector type accessor methods
Lei Zhang [Thu, 16 Feb 2023 04:08:15 +0000 (04:08 +0000)]
[mlir][vector] NFC: Improve vector type accessor methods

Plain `getVectorType()` can be quite confusing and error-prone
given that, well, vector ops always work on vector types, and
it can commonly involve both source and result vectors. So this
commit makes various such accessor methods to be explicit w.r.t.
source or result vectors.

Reviewed By: ThomasRaoux

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

20 months ago[mlir] Use std::optional instead of llvm::Optional (NFC)
Kazu Hirata [Thu, 16 Feb 2023 03:40:10 +0000 (19:40 -0800)]
[mlir] Use std::optional instead of llvm::Optional (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

20 months ago[RISCV] Make a const member function static. NFC
Craig Topper [Thu, 16 Feb 2023 03:28:39 +0000 (19:28 -0800)]
[RISCV] Make a const member function static. NFC

This function doesn't use any members from the class so it can be
static.

20 months agoUpdate: [RISCV][MC] Add support for experimental zfa extension(FLI instruction not...
Jun Sha (Joshua) [Thu, 16 Feb 2023 01:54:40 +0000 (09:54 +0800)]
Update: [RISCV][MC] Add support for experimental zfa extension(FLI instruction not included)

20 months ago[RISCV][MC] Add support for experimental zfa extension(FLI instruction not included)
Jun Sha (Joshua) [Thu, 16 Feb 2023 01:50:59 +0000 (09:50 +0800)]
[RISCV][MC] Add support for experimental zfa extension(FLI instruction not included)

20 months ago[MC] Remove an unneeded comparison on cast result. NFC
Fangrui Song [Thu, 16 Feb 2023 01:46:45 +0000 (17:46 -0800)]
[MC] Remove an unneeded comparison on cast result. NFC

20 months agoFix bazel build
Pranav Kant [Thu, 16 Feb 2023 01:31:19 +0000 (01:31 +0000)]
Fix bazel build

Fallback from 66b3f4a407316004df11307b92aa603b20c0b349

20 months ago[mlir][sparse] reduce the input size in stress_test.py to make it finish in time.
Peiming Liu [Thu, 16 Feb 2023 01:11:16 +0000 (01:11 +0000)]
[mlir][sparse] reduce the input size in stress_test.py to make it finish in time.

Reviewed By: aartbik

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

20 months ago[debugserver] Initialize logging earlier in the startup sequence
Alex Langford [Wed, 15 Feb 2023 22:18:31 +0000 (14:18 -0800)]
[debugserver] Initialize logging earlier in the startup sequence

Prior to setting up logging, we have uses of RNBLogSTDERR and
RNBLogSTDOUT. These macros will dump to STDERR and STDOUT respectively
if debugserver has a tty. Otherwise, it uses _DNBLog, which will do
nothing if a logging function hasn't been set up. For example, if you
specify a log file that cannot be opened for any reason and you don't
have a tty, you have 0 insight into what happened.

rdar://105473133

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

20 months ago[mlir][sparse] introduce operations to query sparse tensor slice offset/strides at...
Peiming Liu [Tue, 10 Jan 2023 23:46:45 +0000 (23:46 +0000)]
[mlir][sparse] introduce operations to query sparse tensor slice offset/strides at the given dimenion

Reviewed By: aartbik

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

20 months ago[Clang][Driver] Fix integer normalization with KCFI
Sami Tolvanen [Wed, 15 Feb 2023 23:14:20 +0000 (23:14 +0000)]
[Clang][Driver] Fix integer normalization with KCFI

Commit 71c7313f42d2b6063fea09854cf4fc46fd0627e1 added integer
normalization for CFI, but doesn't correctly pass the argument
with -fsanitize=kcfi. Set CfiICallNormalizeIntegers also with
SanitizerKind::KCFI to fix the issue.

20 months ago[LoopReroll] Remove legacy pass (unused in the pipeline)
Fangrui Song [Thu, 16 Feb 2023 00:09:32 +0000 (16:09 -0800)]
[LoopReroll] Remove legacy pass (unused in the pipeline)

Following recent changes to remove non-core legacy passes.

20 months ago[mlir][sparse] support coiteration over sparse tensor slices
Peiming Liu [Wed, 28 Dec 2022 19:53:32 +0000 (19:53 +0000)]
[mlir][sparse] support coiteration over sparse tensor slices

Reviewed By: aartbik

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

20 months agoReland "[hwasan] Add definitions for missing operator delete functions"
Leonard Chan [Wed, 15 Feb 2023 22:34:21 +0000 (22:34 +0000)]
Reland "[hwasan] Add definitions for missing operator delete functions"

Looks like builders were failing for the sized variants of operator
delete. These are hidden behind the __cpp_sized_deallocation macro
which can be defined with -fsized-deallocation.

20 months ago[scudo] Improve the uses of roundUpTo/roundDownTo/isAligned
Chia-hung Duan [Wed, 15 Feb 2023 01:31:49 +0000 (01:31 +0000)]
[scudo] Improve the uses of roundUpTo/roundDownTo/isAligned

The implementations of those functions require the rounding target to be
power-of-two. It's better to add a debugging check to avoid misuse.
Besides, add a general verion of those three to accommadate non
power-of-two cases.

Also change the name to roundUp/roundDown/isAligned

Reviewed By: cferris, cryptoad

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

20 months ago[scudo] Calling iterateOverChunks requires holding lock
Chia-hung Duan [Wed, 15 Feb 2023 01:31:20 +0000 (01:31 +0000)]
[scudo] Calling iterateOverChunks requires holding lock

Ensure the allocator is disabled before visiting all chunks.

Reviewed By: cferris

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

20 months ago[scudo] Add thread-safety annotations on TSD data members
Chia-hung Duan [Wed, 15 Feb 2023 01:30:45 +0000 (01:30 +0000)]
[scudo] Add thread-safety annotations on TSD data members

Ideally, we want to assert that all the operations on
Cache/QuarantineCache always have the `Mutex` acquired. However,
the current architecture of accessing TSD is not easy to cooperate
with the thread-safety analysis because of pointer aliasing. In
alternative, we add the getters for accessing TSD member and attach
proper thread-safety annotations on them.

Reviewed By: cferris

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

20 months ago[LoopFlatten] Inline an external linkage function not in llvm::. NFC
Fangrui Song [Wed, 15 Feb 2023 23:40:34 +0000 (15:40 -0800)]
[LoopFlatten] Inline an external linkage function not in llvm::. NFC