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

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