platform/upstream/llvm.git
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

20 months ago[LoopFlatten] Remove legacy pass (unused in the pipeline)
Fangrui Song [Wed, 15 Feb 2023 23:28:16 +0000 (15:28 -0800)]
[LoopFlatten] Remove legacy pass (unused in the pipeline)

Following recent changes to remove non-core legacy passes.

20 months ago[lldb] Remove pydoc import during script interpreter init
Dave Lee [Wed, 15 Feb 2023 22:01:05 +0000 (14:01 -0800)]
[lldb] Remove pydoc import during script interpreter init

The Python script interpreter imports `pydoc` during initialization, but this can be
slow in some cases, and doesn't seem to be necessary any more.

This can be slow because pydoc may execute shell commands (for example `xcrun` on
macOS). The shell commands may have variable performance, depending on their caches and
search space.

The 2012 bug report for the original commit (f71a8399997bfdc1ddeeb30c6a8897554a11c382)
says the following:

> "script help" in lldb pipes the help documentation through less(1) but there's some
> problem with the key handling and often the keys you'd use to move in less (space to
> move down a page, 'q' to quit) are not received by less (they're going to lldb
> instead)

This was resolved at the time by overriding `pydoc`'s pager to be the `plainpager`
function.

I have manually tested `script help(lldb.SBDebugger)` and found no issues with the
pager, including using "space" for paging, "/" for searching, and "q" for quitting.

The presumption is that lldb and/or Python have improved I/O handling that eliminates
the original problem.

The original bug report gave an ~/.lldbinit workaround:

```
script import pydoc; pydoc.pager = pydoc.plainpager
```

Note that calling Python's `help()` will import `pydoc`, but this will only happen for
users who use `help()` from the `script` command.

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

20 months ago[mlir][sparse] disable sparse convolution test cases.
Peiming Liu [Wed, 15 Feb 2023 22:27:39 +0000 (22:27 +0000)]
[mlir][sparse] disable sparse convolution test cases.

These test cases will be re-enabled after new algorithm is implemented.

Reviewed By: aartbik

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

20 months ago[LoopInterchange] Remove legacy pass (unused in the pipeline)
Fangrui Song [Wed, 15 Feb 2023 23:09:29 +0000 (15:09 -0800)]
[LoopInterchange] Remove legacy pass (unused in the pipeline)

Following recent changes to remove non-core legacy passes.

20 months ago[libc][bazel] Add missing dependency for stdlib tests.
Tue Ly [Wed, 15 Feb 2023 23:03:17 +0000 (18:03 -0500)]
[libc][bazel] Add missing dependency for stdlib tests.

20 months ago[mlir][sparse] split sparse concatenate test cases smaller ones.
Peiming Liu [Wed, 15 Feb 2023 22:19:48 +0000 (22:19 +0000)]
[mlir][sparse] split sparse concatenate test cases smaller ones.

To allow a better parallelization.

Reviewed By: aartbik

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

20 months ago[mlir][sparse] adding `SparseTensorType::get{Pointer,Index}Type` methods
wren romano [Wed, 15 Feb 2023 21:31:05 +0000 (13:31 -0800)]
[mlir][sparse] adding `SparseTensorType::get{Pointer,Index}Type` methods

Depends On D143800

Reviewed By: aartbik

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

20 months agoRevert "Transform vector SET{LE/ULT/ULE} -> SETLT and SET{GE/UGT/UGE} -> SETGT if...
Noah Goldstein [Wed, 15 Feb 2023 22:10:22 +0000 (16:10 -0600)]
Revert "Transform vector SET{LE/ULT/ULE} -> SETLT and SET{GE/UGT/UGE} -> SETGT if possible"

This reverts commit f3732c2b18df305a1927b9d4a94610421a2750e7.

20 months agoRevert "Remove incorrect comment around `truncateAVX512SetCCNoBWI`; NFC"
Noah Goldstein [Wed, 15 Feb 2023 22:10:14 +0000 (16:10 -0600)]
Revert "Remove incorrect comment around `truncateAVX512SetCCNoBWI`; NFC"

This reverts commit f895d55f149b66542940b22c547bb8400cbe2237.

20 months ago[PseudoProbe] Refactoring a test
Hongtao Yu [Wed, 15 Feb 2023 22:03:05 +0000 (14:03 -0800)]
[PseudoProbe] Refactoring a test

As titled.

Reviewed By: fhahn

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

20 months ago[gn build] Port 6f3e6a765a9e
LLVM GN Syncbot [Wed, 15 Feb 2023 22:00:54 +0000 (22:00 +0000)]
[gn build] Port 6f3e6a765a9e

20 months ago[Clang][docs] Update the release notes page to the new skeleton
Roy Jacobson [Wed, 15 Feb 2023 21:53:38 +0000 (23:53 +0200)]
[Clang][docs] Update the release notes page to the new skeleton

Was discussed at https://reviews.llvm.org/D142578.

20 months agoRevert "[hwasan] Add definitions for missing operator delete functions"
Leonard Chan [Wed, 15 Feb 2023 21:51:49 +0000 (21:51 +0000)]
Revert "[hwasan] Add definitions for missing operator delete functions"

This reverts commit d6ff0808618cd421d7ee82daec951956ec27a837.

This broke a bunch of builders:
http://45.33.8.238/linux/99657/step_10.txt
https://lab.llvm.org/buildbot/#/builders/247/builds/1627

20 months ago[RISCV] Use !cond instead of multiple !if in RISCVInstrInfoVPseudos.td. NFC
Craig Topper [Wed, 15 Feb 2023 21:46:05 +0000 (13:46 -0800)]
[RISCV] Use !cond instead of multiple !if in RISCVInstrInfoVPseudos.td. NFC

Rely on !cond erroring for unmatched condition instead of using a
bogus string for the default.

20 months ago[X86][Win64] Avoid statepoints prior to SEH epilogue
Markus Böck [Wed, 15 Feb 2023 21:25:46 +0000 (22:25 +0100)]
[X86][Win64] Avoid statepoints prior to SEH epilogue

This patchs purpose is very similar to https://reviews.llvm.org/D119644

The gist of the issue is that SEH unwinding has certain invariants around call instructions. One of those is that a call instruction must not be immediately followed by the function epilogue. Failing to do so leads to Windows' unwinder not recognizing the frame and skipping it when unwinding the stack.

LLVM ensures this invariant by inserting a noop after a call prior to an epilogue. The implementation however, makes the unfortunate assumption that pseudo instructions may not be calls, leading to statepoints being skipped and no noop being inserted.
This patch fixes that issue by only skipping over pseudo instructions that aren't calls.

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

20 months ago[mlir][sparse] misc code cleanup
wren romano [Wed, 15 Feb 2023 21:28:11 +0000 (13:28 -0800)]
[mlir][sparse] misc code cleanup

* Flattening/simplifying some nested conditionals
* const-ifying some local variables

Depends On D143800

Reviewed By: aartbik

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

20 months ago[flang][runtime] MayAlias() must be false for unallocated descriptors
Peter Klausler [Wed, 15 Feb 2023 21:11:37 +0000 (13:11 -0800)]
[flang][runtime] MayAlias() must be false for unallocated descriptors

When either descriptor argument to MayAlias() is not allocated, the
result must be false by definition, since the values of the extents
in the dimensional information may be uninitialized.

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

20 months ago[RISCV] Add CLB/CLH/SLB/SLH formats for Zcb instructions.
Craig Topper [Wed, 15 Feb 2023 20:53:17 +0000 (12:53 -0800)]
[RISCV] Add CLB/CLH/SLB/SLH formats for Zcb instructions.

This matches how they are described in the spec.

Rework the tablegen classes to make this format consistent with
other formats.

Reviewed By: asb

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

20 months ago[RISCV] Remove some vestiges of Zbp and Zbt extensions. NFC
Craig Topper [Wed, 15 Feb 2023 20:51:03 +0000 (12:51 -0800)]
[RISCV] Remove some vestiges of Zbp and Zbt extensions. NFC

Unused tablegen classes and unused operand type.

20 months ago[clang-format] Fix windows build.
Manuel Klimek [Wed, 15 Feb 2023 20:59:43 +0000 (20:59 +0000)]
[clang-format] Fix windows build.

MSVC needs a return after llvm_unreachable.

20 months ago[NFC] Make Module::getIFuncList() private
Vasileios Porpodas [Wed, 15 Feb 2023 18:54:04 +0000 (10:54 -0800)]
[NFC] Make Module::getIFuncList() private

This is a followup to d180443570d7895193d2ab6f1e1486d669dc9723
which did not actually remove the `public` keyword.

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

20 months ago[mlir][sparse] Adding `SparseTensorType::{operator==, hasSameDimToLvlMap}`
wren romano [Wed, 15 Feb 2023 20:03:52 +0000 (12:03 -0800)]
[mlir][sparse] Adding `SparseTensorType::{operator==, hasSameDimToLvlMap}`

Depends On D143800

Reviewed By: aartbik, Peiming

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

20 months ago[flang] Don't add a source range to a type instantiation's scope
Peter Klausler [Wed, 15 Feb 2023 19:11:54 +0000 (11:11 -0800)]
[flang] Don't add a source range to a type instantiation's scope

A type instantiation's scope doesn't require a source range, as we don't
need/want it to be the result of SemanticsContext::FindScope(), and
adding the original type's source range to the scope of one of its
instantiations has the side effect of expanding the source range of
all of its parents to include the original type definition, which
breaks FindScope() for any scope including a type instantiation.

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

20 months agoRevert D129735 "[RISCV] Add new pass to transform undef to pseudo for vector values."
Fangrui Song [Wed, 15 Feb 2023 19:51:08 +0000 (11:51 -0800)]
Revert D129735 "[RISCV] Add new pass to transform undef to pseudo for vector values."

This reverts commit f1c4241fb6e50c507adafbe14faf82a755ab92ca.

It causes use-after-poison asan failures for
CodeGen/RISCV/rvv/undef-earlyclobber-chain.ll and CodeGen/RISCV/regalloc-last-chance-recoloring-failure.ll

20 months ago[C2x] Implement the `unreachable` macro for WG14 N2826
Aaron Ballman [Wed, 15 Feb 2023 19:41:38 +0000 (14:41 -0500)]
[C2x] Implement the `unreachable` macro for WG14 N2826

This exposes __builtin_unreachable as the expansion for the unreachable
macro in C2x. I added this definition under __need_STDDEF_H_misc on the
assumption there is no need for a separate need macro to control adding
this.

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

20 months ago[hwasan] Add definitions for missing operator delete functions
Leonard Chan [Wed, 15 Feb 2023 19:41:04 +0000 (19:41 +0000)]
[hwasan] Add definitions for missing operator delete functions

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

20 months ago[NFC][SVE] Refactor isel for floating multiply-add operations to use PatFrags.
Paul Walker [Wed, 8 Feb 2023 10:52:19 +0000 (10:52 +0000)]
[NFC][SVE] Refactor isel for floating multiply-add operations to use PatFrags.

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

20 months ago[scudo] Fix inconsistent signed/unsigned comparison
Chia-hung Duan [Wed, 15 Feb 2023 18:26:24 +0000 (18:26 +0000)]
[scudo] Fix inconsistent signed/unsigned comparison

Fix broken test on PPC

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

20 months ago[ConstriantElimination] Add NODEBUG condition around `dump`
Zain Jaffal [Wed, 15 Feb 2023 17:43:25 +0000 (17:43 +0000)]
[ConstriantElimination] Add NODEBUG condition around `dump`

20 months ago[AArch64] Guard extra uses in mls combine.
David Green [Wed, 15 Feb 2023 18:36:46 +0000 (18:36 +0000)]
[AArch64] Guard extra uses in mls combine.

This is a small extension to D143143 to ensure that nodes with multiple uses to
not get transformed. The tests have also been extended to include more mla
cases.

20 months ago[mlir] bazel fix
Aart Bik [Wed, 15 Feb 2023 18:33:10 +0000 (10:33 -0800)]
[mlir] bazel fix

Reviewed By: olegshyshkov

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

20 months ago[mlir][tensor] Fix a bug in tiling unpack op.
Hanhan Wang [Tue, 14 Feb 2023 18:02:35 +0000 (10:02 -0800)]
[mlir][tensor] Fix a bug in tiling unpack op.

The inner tiling sizes could be dynamic (which are Values). In this
context, they should be added to tiledOperand when cloning the op.

Reviewed By: chelini

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

20 months ago[libc++][CI] Starts using Clang 17.
Mark de Wever [Tue, 7 Feb 2023 10:10:24 +0000 (11:10 +0100)]
[libc++][CI] Starts using Clang 17.

Reviewed By: #libc, ldionne, Mordante

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

20 months ago[Pseudo probe] Duplicate probes in vectorized loop body.
Hongtao Yu [Wed, 15 Feb 2023 02:21:22 +0000 (18:21 -0800)]
[Pseudo probe] Duplicate probes in vectorized loop body.

Prevoius pseudo probes were dropped out of a vectorized loop body during loop vectorization. This can result in the samples of the loop entry is used for the loop body, which in turn can cause undercounting of the loop iteration count. The undercounting can further prevent the loop from being vectorized in the next build. I'm fixing this by explicting allowing pseudo probes to be kept in the vectorized loop body, and by claiming a probe instruction is not "uniform", the vectorizer will duplicate it by the number of vector lanes.

For one internal service, I'm seeing the change causes the size increase of the .pseudoprobe section by 0.7%, which should count around 0.2% of the whole binary size.

Reviewed By: wenlei

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

20 months ago[CodeGen] Add a flag to `Address` and `Lvalue` that is used to keep
Akira Hatanaka [Thu, 26 Jan 2023 23:29:33 +0000 (15:29 -0800)]
[CodeGen] Add a flag to `Address` and `Lvalue` that is used to keep
track of whether the pointer is known not to be null

The flag will be used for the arm64e work we plan to upstream in the
future (see https://lists.llvm.org/pipermail/llvm-dev/2019-October/136091.html).
Currently the flag has no effect on code generation.

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

20 months agoReland "[mlir] Make the vast majority of intgration and runner tests work on Windows"
Markus Böck [Wed, 15 Feb 2023 17:57:13 +0000 (18:57 +0100)]
Reland "[mlir] Make the vast majority of intgration and runner tests work on Windows"

This reverts commit 5561e174117ff395d65b6978d04b62c1a1275138

The logic was moved from cmake into lit fixing the issue that lead to the revert and potentially others with multi-config cmake generators

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

20 months ago[flang][runtime] Fix typo in assign.cpp
Peter Klausler [Wed, 15 Feb 2023 18:12:43 +0000 (10:12 -0800)]
[flang][runtime] Fix typo in assign.cpp

Variable name 'y' needs to be used in the declaration of 'yDesc'.

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

20 months ago[mlir][spirv] Support i32 memref.atomic_rmw conversion
Lei Zhang [Wed, 15 Feb 2023 17:51:17 +0000 (17:51 +0000)]
[mlir][spirv] Support i32 memref.atomic_rmw conversion

These cases can be directly mapped to spirv.AtomicI* ops.

Reviewed By: kuhar

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

20 months ago[flang][NFC] Remove unwanted tab
Valentin Clement [Wed, 15 Feb 2023 17:51:58 +0000 (18:51 +0100)]
[flang][NFC] Remove unwanted tab