platform/upstream/llvm.git
23 months ago[AArch64][CodeGen] Remove redundant vector negations before concat
Benjamin Maxwell [Wed, 16 Nov 2022 10:45:48 +0000 (10:45 +0000)]
[AArch64][CodeGen] Remove redundant vector negations before concat

This adds a new canonicalization rule to replace concats of truncated
negations with a negation of the concatenated truncates, e.g.

    (concat_vectors (v4i16 (truncate (not (v4i32)))),
                    (v4i16 (truncate (not (v4i32)))))
   ->
    (not (concat_vectors (v4i16 (truncate (v4i32))),
                         (v4i16 (truncate (v4i32)))))

Doing this allows avoiding redundant negations being emitted in
certain cases.

Reviewed By: peterwaller-arm

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

23 months ago[X86] vselect-avx.ll - add AVX512 test coverage
Simon Pilgrim [Wed, 16 Nov 2022 11:12:15 +0000 (11:12 +0000)]
[X86] vselect-avx.ll - add AVX512 test coverage

Ensure we test predicate selects as well

23 months ago[libc][NFC] move memmove implementation
Guillaume Chatelet [Tue, 25 Oct 2022 14:36:06 +0000 (14:36 +0000)]
[libc][NFC] move memmove implementation

Moving memmove implementation to its own file for symmetry with other mem functions.

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

23 months ago[libc] deprecate LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB
Guillaume Chatelet [Tue, 25 Oct 2022 15:18:46 +0000 (15:18 +0000)]
[libc] deprecate LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB

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

23 months ago[libc] remove mem functions dead code
Guillaume Chatelet [Tue, 25 Oct 2022 11:09:59 +0000 (11:09 +0000)]
[libc] remove mem functions dead code

Let's wait a bit for https://reviews.llvm.org/D136595 to settle before
cleaning up. Just in case we would need to revert.

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

23 months ago[AArch64][ARM] add Armv8.9-a/Armv9.4-a identifier support
Ties Stuij [Wed, 16 Nov 2022 09:47:55 +0000 (09:47 +0000)]
[AArch64][ARM] add Armv8.9-a/Armv9.4-a identifier support

For both ARM and AArch64 add support for specifying -march=armv8.9a/armv9.4a to
clang. Add backend plumbing like target parser and predicate support.

For a summary of Amv8.9/Armv9.4 features, see:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-2022

For detailed information, consult the Arm Architecture Reference Manual for
A-profile architecture:
https://developer.arm.com/documentation/ddi0487/latest/

People who contributed to this patch:
- Keith Walker
- Ties Stuij

Reviewed By: tmatheson

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

23 months ago[NFC][SelectionDAG][DebugInfo] Refactor DanglingDebugInfo class
OCHyams [Wed, 16 Nov 2022 10:10:24 +0000 (10:10 +0000)]
[NFC][SelectionDAG][DebugInfo] Refactor DanglingDebugInfo class

Hide the underlying DbgValueInst by adding methods to extract the necessary
information and by adding a raw_ostream &operator<< overload to print it.

Remove the DebugLoc field as this is always the same as the DbgValueInst's
DebugLoc (see D136247).

Reviewed By: StephenTozer

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

23 months ago[NFC][SelectionDAG][DebugInfo] Remove duplicate parameter from handleDebugValue
OCHyams [Wed, 16 Nov 2022 09:59:35 +0000 (09:59 +0000)]
[NFC][SelectionDAG][DebugInfo] Remove duplicate parameter from handleDebugValue

handleDebugValue has two DebugLoc parameters that appear to always take the
same value. Remove one of the duplicate parameters. See phabricator review for
more detail.

Reviewed By: StephenTozer

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

23 months agoAdd Float8E4M3FN type to MLIR.
Reed [Wed, 16 Nov 2022 09:24:24 +0000 (10:24 +0100)]
Add Float8E4M3FN type to MLIR.

The paper https://arxiv.org/abs/2209.05433 introduces two new FP8 dtypes: E5M2 (called Float8E5M2 in LLVM) and E4M3 (called Float8E4M3FN in LLVM). Support for Float8E5M2 in APFloat and MLIR was added in https://reviews.llvm.org/D133823. Support for Float8E4M3FN in APFloat was added in https://reviews.llvm.org/D137760. This change adds Float8E4M3FN to MLIR as well.

There is an RFC for adding the FP8 dtypes here: https://discourse.llvm.org/t/rfc-add-apfloat-and-mlir-type-support-for-fp8-e5m2/65279.

This change is identical to the MLIR changes in the patch that added Float8E5M2, except that Float8E4M3FN is added instead.

Reviewed By: stellaraccident, bkramer, rriddle

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

23 months ago[mlir][linalg] Fix bug in InferStaticShapeOfOperands pattern
Vladislav Vinogradov [Thu, 10 Nov 2022 10:23:44 +0000 (13:23 +0300)]
[mlir][linalg] Fix bug in InferStaticShapeOfOperands pattern

The pattern tries to deduce static shape from `tensor.cast` producer of linalg operation operands.
The original code unconditionally casts type of the `tensor.cast` source to `RankedTensorType`.
But the `tensor.cast` can also operate on `UnrankedTensorType`, so this cast either fail on assertion
in debug build or introduce UB in release build.

The patch replaces unconditional cast with `dyn_cast` and check for the cast result.

Reviewed By: mravishankar

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

23 months ago[clang][Parse][NFC] Remove unused DenseMap
Timm Bäder [Wed, 16 Nov 2022 08:28:48 +0000 (09:28 +0100)]
[clang][Parse][NFC] Remove unused DenseMap

23 months ago[clang][NFC] Remove unused CastForMoving parameter
Timm Bäder [Mon, 14 Nov 2022 15:35:23 +0000 (16:35 +0100)]
[clang][NFC] Remove unused CastForMoving parameter

Nothing ever passes a third parameter to CastForMoving.

23 months ago[WebAssembly] multivalue stackify fix
Samuel Parker [Tue, 15 Nov 2022 09:15:32 +0000 (09:15 +0000)]
[WebAssembly] multivalue stackify fix

Don't attempt to move a multivalue def past one of it's prior uses.

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

23 months ago[clang][Interp][NFC] Use constexpr if in OffsetHelper
Timm Bäder [Wed, 9 Nov 2022 11:48:43 +0000 (12:48 +0100)]
[clang][Interp][NFC] Use constexpr if in OffsetHelper

Add here is a template parameter, so we can do this.

23 months ago[mlir] [transform] Fix for RAUW error in transform gpu dialect
Guray Ozen [Tue, 15 Nov 2022 17:49:35 +0000 (18:49 +0100)]
[mlir] [transform] Fix for RAUW error in transform gpu dialect

The given test fails due to error below.

The following error is why the test is failing. One `memref.store` and two `memref.load` are consumers of the loop index for which I do RAUW. `memref.store` is first in the list. If I RAUW on this the loop of `llvm::make early inc range(threadIdx.getUsers())` does not return two `memref.load` as users. They remain unchanged. I'm not really certain why.

This change applies RAUW after collecting the users. If a better solution exists, I would be happy to implement it.

```
mlir-opt: ...llvm-project/mlir/include/mlir/IR/UseDefLists.h:175: mlir::IRObjectWithUseList<mlir::OpOperand>::~IRObjectWithUseList() [OperandType = mlir::OpOperand]: Assertion `use_empty() && "Cannot destroy a value that still has uses!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
```

Reviewed By: springerm

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

23 months ago[MC][LoongArch] Fix needsRelocateWithSymbol() implementation
Youling Tang [Wed, 16 Nov 2022 07:52:27 +0000 (15:52 +0800)]
[MC][LoongArch] Fix needsRelocateWithSymbol() implementation

LoongArch should be `section plus offset`, so use the generic implementation
of `llvm/lib/MC/MCELFObjectTargetWriter.cpp` to return `false` directly, like
x86 and aarch64.

```
$ cat test.c
static int __attribute__((section(".text.another"))) test(int a, int b)
{
return a + b;
}
static int a = 1, b = 2;

int foo()
{
test(a, b);
return 0;
}

$ gcc -c test.c
$ readelf -Wr test.o

Relocation section '.rela.text' at offset 0x2a0 contains 5 entries:
    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
0000000000000010  0000000300000047 R_LARCH_PCALA_HI20     0000000000000000 .data + 0
0000000000000014  0000000300000048 R_LARCH_PCALA_LO12     0000000000000000 .data + 0
0000000000000018  0000000300000047 R_LARCH_PCALA_HI20     0000000000000000 .data + 4
000000000000001c  0000000300000048 R_LARCH_PCALA_LO12     0000000000000000 .data + 4
0000000000000028  0000000500000042 R_LARCH_B26            0000000000000000 .text.another + 0

Relocation section '.rela.eh_frame' at offset 0x318 contains 2 entries:
    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
000000000000001c  0000000500000063 R_LARCH_32_PCREL       0000000000000000 .text.another + 0
000000000000003c  0000000200000063 R_LARCH_32_PCREL       0000000000000000 .text + 0
```

Reviewed By: SixWeining, MaskRay

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

23 months agoAMDGPU/GlobalISel: Fix shift tests using out of bounds offsets
Matt Arsenault [Mon, 14 Nov 2022 23:13:21 +0000 (15:13 -0800)]
AMDGPU/GlobalISel: Fix shift tests using out of bounds offsets

23 months agoDAG: Fix assert on load casted to vector with attached range metadata
Matt Arsenault [Sat, 12 Nov 2022 19:33:29 +0000 (11:33 -0800)]
DAG: Fix assert on load casted to vector with attached range metadata

AMDGPU legalizes i64 loads to loads of <2 x i32>, leaving the
i64 MMO with attached range metadata alone. The known bit width
was using the scalar element type, and asserting on a mismatch.

23 months ago[AMDGPU][GISel] Smaller code for scalar 32 to 64-bit extensions
Jay Foad [Fri, 6 Aug 2021 12:09:47 +0000 (13:09 +0100)]
[AMDGPU][GISel] Smaller code for scalar 32 to 64-bit extensions

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

23 months ago[LoongArch] Add immediate operand validity check for __builtin_loongarch_dbar
gonglingqin [Wed, 16 Nov 2022 05:59:52 +0000 (13:59 +0800)]
[LoongArch] Add immediate operand validity check for __builtin_loongarch_dbar

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

23 months ago[LLDB] Xfail TestVSCode_eventStatistic.py on Arm/AArch64 Linux
Muhammad Omair Javaid [Wed, 16 Nov 2022 06:36:31 +0000 (10:36 +0400)]
[LLDB] Xfail TestVSCode_eventStatistic.py on Arm/AArch64 Linux

This patch marks TestVSCode_eventStatistic.py as xfail on Arm/AArch64
Linux platform. test_initialized_event testcase is failing. See buildbot
logs below:

https://lab.llvm.org/buildbot/#/builders/17/builds/30199
https://lab.llvm.org/buildbot/#/builders/96/builds/31528

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

23 months ago[AMDGPU] Remove the assertion for MUBUF instruction with voffset
Christudasan Devadasan [Sat, 12 Nov 2022 13:29:48 +0000 (18:59 +0530)]
[AMDGPU] Remove the assertion for MUBUF instruction with voffset

Currently, there is an assertion that limits the MUBUF instruction
with voffset used for a VGPR spill inside kernel functions when
the frame pointer is really used. It seemed more like an unwanted
limitation and hence removing the assertion.

Reviewed By: arsenm

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

23 months ago[Driver] Enable nested configuration files
Serge Pavlov [Thu, 20 Oct 2022 05:24:50 +0000 (12:24 +0700)]
[Driver] Enable nested configuration files

Users may partition parameters specified by configuration file and put
different groups into separate files. These files are inserted into the
main file using constructs `@file`. Relative file names in it are
resolved relative to the including configuration file and this is not
convenient in some cases. A configuration file, which resides in system
directory, may need to include a file with user-defined parameters and
still provide default definitions if such file is absent.

To solve such problems, the option `--config=` is allowed inside
configuration files. Like `@file` it results in insertion of
command-line arguments but the algorithm of file search is different and
allows overriding system definitions with user ones.

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

23 months agoInstSimplify: Fold arithmetic_fence as idempotent
Matt Arsenault [Wed, 16 Nov 2022 02:18:21 +0000 (18:18 -0800)]
InstSimplify: Fold arithmetic_fence as idempotent

23 months agoIR: Make arithmetic_fence a DefaultAttrs intrinsic
Matt Arsenault [Wed, 16 Nov 2022 02:24:26 +0000 (18:24 -0800)]
IR: Make arithmetic_fence a DefaultAttrs intrinsic

23 months ago[gn build] Port 617277e7cbda
LLVM GN Syncbot [Wed, 16 Nov 2022 06:08:50 +0000 (06:08 +0000)]
[gn build] Port 617277e7cbda

23 months ago[VP][RISCV] Add vp.nearbyint and RISC-V support.
Yeting Kuo [Wed, 9 Nov 2022 01:40:24 +0000 (09:40 +0800)]
[VP][RISCV] Add vp.nearbyint and RISC-V support.

nearbyint has the property to execute without exception.
For not modifying fflags, the patch added new machine opcode
PseudoVFROUND_NOEXCEPT_V that expands vfcvt.x.f.v and vfcvt.f.x.v between a pair
of frflags and fsflags.

Reviewed By: craig.topper

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

23 months ago[clang-format][NFC] Improve documentation of FixNamespaceComments
Björn Schäpers [Sat, 12 Nov 2022 04:51:19 +0000 (05:51 +0100)]
[clang-format][NFC] Improve documentation of FixNamespaceComments

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

23 months ago[clang-format][NFC] Improve documentation on ReflowComments
Björn Schäpers [Fri, 11 Nov 2022 21:19:03 +0000 (22:19 +0100)]
[clang-format][NFC] Improve documentation on ReflowComments

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

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

23 months ago[clang-format][NFC] Moved configuration parsing tests in own file
Björn Schäpers [Fri, 11 Nov 2022 08:00:49 +0000 (09:00 +0100)]
[clang-format][NFC] Moved configuration parsing tests in own file

I want to reduce the size of ForatTest.cpp with its still wopping 25k
lines it is a burden on the compiler and editor (mine is clangd
powered).

This are tests which are really serving a different purpose than
formatting.

I've copied the code and made the following changes:
- Dropped the ; at the end of some macros, all macro "invocations"
  already have their own ;.
- Dropped the _F, we don't need a fxiture here.

Differential Revisison: https://reviews.llvm.org/D137823

23 months ago[AArch64InstPrinter] Print TargetAddress as an uint64_t
Woody Lin [Wed, 2 Nov 2022 10:51:14 +0000 (18:51 +0800)]
[AArch64InstPrinter] Print TargetAddress as an uint64_t

Outputs readable addresses by printed 'TargetAddress' as an uint64_t
value.

`bl     -0x37efd56628` => `bl     0xffffffc8102a99d8`

Reviewed By: dmgreen

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

23 months ago[mlir][sparse] avoid single small vector, set exact number 3
Aart Bik [Tue, 15 Nov 2022 23:37:31 +0000 (15:37 -0800)]
[mlir][sparse] avoid single small vector, set exact number 3

Reviewed By: wrengr

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

23 months agoRevert "[pgo] Avoid introducing relocations by using private alias"
Paul Kirth [Wed, 16 Nov 2022 03:36:54 +0000 (03:36 +0000)]
Revert "[pgo] Avoid introducing relocations by using private alias"

This reverts commit 2b8917f8ad792c4c484975b82039bbdebe556881.

This breaks with lld and gold

23 months ago[VP][RISCV] Add vp.bswap and RISC-V support.
Yeting Kuo [Mon, 14 Nov 2022 09:58:18 +0000 (17:58 +0800)]
[VP][RISCV] Add vp.bswap and RISC-V support.

The patch also added function expandVPBSWAP to expand ISD::VP_BSWAP nodes.

Reviewed By: craig.topper

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

23 months ago[RISCV] Improve formatting of Sched lists in tablegen. NFC
Craig Topper [Wed, 16 Nov 2022 02:59:12 +0000 (18:59 -0800)]
[RISCV] Improve formatting of Sched lists in tablegen. NFC

23 months agoSend statistics in initialized event
George Hu [Wed, 16 Nov 2022 00:29:54 +0000 (16:29 -0800)]
Send statistics in initialized event

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

23 months ago[mlir][Transforms] CSE of ops with a single block.
Mahesh Ravishankar [Tue, 20 Sep 2022 00:49:01 +0000 (00:49 +0000)]
[mlir][Transforms] CSE of ops with a single block.

Currently CSE does not support CSE of ops with regions. This patch
extends the CSE support to ops with a single region.

Differential Revision: https://reviews.llvm.org/D134306
Depends on D137857

23 months ago[X86][AMX] Fix the shape dependency issue.
Luo, Yuanke [Mon, 14 Nov 2022 02:20:15 +0000 (10:20 +0800)]
[X86][AMX] Fix the shape dependency issue.

AMX shape should be defined before AMX intrinsics. However for below
case, the shape a.row is defined after tile load of b. If we transform
`load b` to `@llvm.x86.tileloadd64 intrinsic`, the shape dependency
doesn't meet.
```
void test_tile_dpbsud(__tile1024i a, __tile1024i b, __tile1024i c) {
  __tile_dpbsud(&c, a, b);
}
```
This patch is to store the tile b to stack and reloaded it after the
def of b.row. It would cause redundant store/load, but it is simple
to avoid generating invalid IR.
The better way may hoist `def b.row` before tile load instruction,
but it seems more complicated to recursively hoist its operands.

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

23 months ago[RISCV] Don't use zero-stride vector load for gather if not optimized
wangpc [Wed, 16 Nov 2022 02:42:18 +0000 (10:42 +0800)]
[RISCV] Don't use zero-stride vector load for gather if not optimized

We may form a zero-stride vector load when lowering gather to strided
load. As what D137699 has done, we use `load+splat` for this form if
there is no optimized implementation.
We restrict this to unmasked loads currently in consideration of the
complexity of hanlding all falses masks.

Reviewed By: reames

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

23 months ago[RISCV] Remove some unneeded widening FP vector pseudo instructions. NFC
Craig Topper [Wed, 16 Nov 2022 02:00:22 +0000 (18:00 -0800)]
[RISCV] Remove some unneeded widening FP vector pseudo instructions. NFC

We don't need LMUL=8 versions of these.

Reviewed By: michaelmaitland

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

23 months ago[RISCV] Refactor getDefaultVLOps. NFC.
Han-Kuan Chen [Mon, 14 Nov 2022 03:08:46 +0000 (19:08 -0800)]
[RISCV] Refactor getDefaultVLOps. NFC.

Current getDefaultVLOps can only deduce VL from a MVT. However,
sometimes users have already known VL value. This commit will provide a
uniform interface to get VL instead of calling DAG.getConstant.

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

23 months ago[PowerPC] Fix strict load-conversion recognition
Qiu Chaofan [Wed, 16 Nov 2022 01:59:39 +0000 (09:59 +0800)]
[PowerPC] Fix strict load-conversion recognition

Direct-move instructions are usually more efficient than load then store
for conversion. But direct moves are not needed when the source register
was just loaded from some address.

The pattern has already been recognized, but the source value of strict
nodes are not the first (that's the chain), but the second.

Reviewed By: shchenz

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

23 months agoRevert "[RISCV][llvm-mca] Use LMUL Instruments to provide more accurate reports on...
Michael Maitland [Wed, 16 Nov 2022 02:01:19 +0000 (18:01 -0800)]
Revert "[RISCV][llvm-mca] Use LMUL Instruments to provide more accurate reports on RISCV"

This reverts commit b88b8307bf9e24f53e7ef3052abf2c506ff55fd2.

23 months ago[mlir][sparse] move SparseTensorReader functions into the _mlir_ciface_ section
wren romano [Wed, 16 Nov 2022 00:31:01 +0000 (16:31 -0800)]
[mlir][sparse] move SparseTensorReader functions into the _mlir_ciface_ section

This is a reposting of D137737, which got reverted when D137735 did.  There are no changes other than rebasing.

Reviewed By: aartbik

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

23 months ago[RISCV][llvm-mca] Use LMUL Instruments to provide more accurate reports on RISCV
Michael Maitland [Fri, 4 Nov 2022 15:51:39 +0000 (08:51 -0700)]
[RISCV][llvm-mca] Use LMUL Instruments to provide more accurate reports on RISCV

On x86 and AArch, SIMD instructions encode all of the scheduling information in the instruction
itself. For example, VADD.I16 q0, q1, q2 is a neon instruction that operates on 16-bit integer
elements stored in 128-bit Q registers, which leads to eight 16-bit lanes in parallel. This kind
of information impacts how the instruction takes to execute and what dependencies this may cause.

On RISCV however, the data that impacts scheduling is encoded in CSR registers such as vtype or
vl, in addition with the instruction itself. But MCA does not track or use the data in these
registers. This patch fixes this problem by introducing Instruments into MCA.

* Replace `CodeRegions` with `AnalysisRegions`
* Add `Instrument` and `InstrumentManager`
* Add `InstrumentRegions`
* Add RISCV Instrument and `InstrumentManager`
* Parse `Instruments` in driver
* Use instruments to override schedule class
* RISCV use lmul instrument to override schedule class
* Fix unit tests to pass empty instruments
* Add -ignore-im clopt to disable this change

A prior version of this patch was commited in. It was reverted in
5e82ee5373211db8522181054800ccd49461d9d82323a4ee610f5e1db74d362af4c6fb8c704be8f6 reverted
that change because the unit test files caused build errors. This commit adds the original changes
and the fixed test files.

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

23 months ago[mlir][Translation] Allow specifying an expected input alignment for "ToMLIR" transla...
River Riddle [Tue, 15 Nov 2022 02:16:28 +0000 (18:16 -0800)]
[mlir][Translation] Allow specifying an expected input alignment for "ToMLIR" translations

This allows for ensuring that alignment requirements on translation
inputs are satisfied.

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

23 months ago[Sema] Use the value category of the base expression when creating an
Akira Hatanaka [Wed, 16 Nov 2022 01:13:33 +0000 (17:13 -0800)]
[Sema] Use the value category of the base expression when creating an
ExtVectorElementExpr

This fixes a bug where an lvalue ExtVectorElementExpr was created when
the base expression was an ObjC property dot operator.

This reverts 220d08d942ab0df3211388e602ed34fa6139ca61.

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

23 months ago[lldb] Fix simple template names and template params with scope qualifiers
Arthur Eubanks [Mon, 7 Nov 2022 21:07:26 +0000 (13:07 -0800)]
[lldb] Fix simple template names and template params with scope qualifiers

Followup to D134378.

With PrintingPolicy::SuppressScope, we'd also not print the scope in template params. The intention was only to skip the scope for the class because we expect template params to be fully qualified when comparing them for simple template names.

Instead, use `NamedDecl::getNameForDiagnostic` if we're dealing with a tag, which is what we actually use when emitting debug info in clang. That already has an option to suppress the scope on the base name.

Reviewed By: dblaikie

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

23 months ago[mlir][sparse] fix memory leakage in concatenate rewriter.
Peiming Liu [Wed, 16 Nov 2022 00:00:33 +0000 (00:00 +0000)]
[mlir][sparse] fix memory leakage in concatenate rewriter.

Reviewed By: aartbik

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

23 months ago[bazel] Remove reference to file removed in 70dc3b811e4926fa2c88bd3b53b29c46fcba1a90
Benjamin Kramer [Tue, 15 Nov 2022 23:35:12 +0000 (00:35 +0100)]
[bazel] Remove reference to file removed in 70dc3b811e4926fa2c88bd3b53b29c46fcba1a90

23 months ago[libc] [Obvious] Cleanup.
Raman Tenneti [Tue, 15 Nov 2022 23:26:36 +0000 (15:26 -0800)]
[libc] [Obvious] Cleanup.

+ Avoid the `clockid` var and just passed `long(CLOCK_REALTIME)`
  to the syscall.

Reviewed By: rtenneti

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

23 months ago[lldb-vscode] Send Selected Statistics Dump in Terminated Event
Wanyi Ye [Sat, 10 Sep 2022 18:27:09 +0000 (11:27 -0700)]
[lldb-vscode] Send Selected Statistics Dump in Terminated Event

This patch will gather debug info & breakpoint info from the statistics dump (from `(SBTarget.GetStatistics())` func) and send to DAP in terminated event.

The statistics content can be huge (especially the `modules`) and dumping in full JSON can create delay in the IDE's debugging UI. (For more details, please read: https://github.com/llvm/llvm-project/commit/7bbd0fba986c241162b77b7e424ad82bc7e17b41 ). Hence, we will filter out large contents before returning it in terminated event.

It will keep all the metadata fields (those starts with "total"). For large contents, it uses the opt-out strategy. Currently it only removes the "modules" field. This way every time a new top-level field being added, we will be able to capture them from DAP log without changing lldb-vscode.

The DAP terminated event should look like
```
{
  "event":"terminated",
  "seq":0,
  "statistics": {
    "memory": <JSON string>
    "targets": <JSON string>, // it's a JSON array, breakpoints info included in each target
    <metadata_key: value> // pairs
  },
  "type":"event"
}
```

All the info above will be append to statistics field in the terminated event

Test Plan

Debugged a simple hello world program from VSCode. Exit debug session in two ways: 1) run to program exit; 2) user initiated debug session end (quit debugging before program exit).
Check DAP log and see both debug sessions have statistics returned in terminated event.

Here's an example when debugging the test program:

```
{"event":"terminated","seq":0,"statistics":{"memory":"{\"strings\":{\"bytesTotal\":1843200,\"bytesUnused\":897741,\"bytesUsed\":945459}}","targets":"[{\"breakpoints\":[{\"details\":{\"Breakpoint\":{\"BKPTOptions\":{\"AutoContinue\":false,\"ConditionText\":\"\",\"EnabledState\":true,\"IgnoreCount\":0,\"OneShotState\":false},\"BKPTResolver\":{\"Options\":{\"NameMask\":[56],\"Offset\":0,\"SkipPrologue\":true,\"SymbolNames\":[\"foo\"]},\"Type\":\"SymbolName\"},\"Hardware\":false,\"Names\":[\"vscode\"],\"SearchFilter\":{\"Options\":{},\"Type\":\"Unconstrained\"}}},\"id\":1,\"internal\":false,\"numLocations\":1,\"numResolvedLocations\":1,\"resolveTime\":0.002232},{\"details\":{\"Breakpoint\":{\"BKPTOptions\":{\"AutoContinue\":false,\"ConditionText\":\"\",\"EnabledState\":true,\"IgnoreCount\":0,\"OneShotState\":false},\"BKPTResolver\":{\"Options\":{\"Column\":0,\"Exact\":false,\"FileName\":\"/data/users/wanyi/llvm-sand/external/llvm-project/lldb/test/API/tools/lldb-vscode/terminated-event/main.cpp\",\"Inlines\":true,\"LineNumber\":5,\"Offset\":0,\"SkipPrologue\":true},\"Type\":\"FileAndLine\"},\"Hardware\":false,\"Names\":[\"vscode\"],\"SearchFilter\":{\"Options\":{},\"Type\":\"Unconstrained\"}}},\"id\":2,\"internal\":false,\"numLocations\":0,\"numResolvedLocations\":0,\"resolveTime\":0.23203799999999999},{\"details\":{\"Breakpoint\":{\"BKPTOptions\":{\"AutoContinue\":false,\"ConditionText\":\"\",\"EnabledState\":true,\"IgnoreCount\":0,\"OneShotState\":false},\"BKPTResolver\":{\"Options\":{\"Language\":\"c\",\"NameMask\":[4,4,4,4,4,4],\"Offset\":0,\"SkipPrologue\":false,\"SymbolNames\":[\"_dl_debug_state\",\"rtld_db_dlactivity\",\"__dl_rtld_db_dlactivity\",\"r_debug_state\",\"_r_debug_state\",\"_rtld_debug_state\"]},\"Type\":\"SymbolName\"},\"Hardware\":false,\"SearchFilter\":{\"Options\":{\"ModuleList\":[\"/usr/lib64/ld-2.28.so\"]},\"Type\":\"Modules\"}}},\"id\":-1,\"internal\":true,\"kindDescription\":\"shared-library-event\",\"numLocations\":1,\"numResolvedLocations\":1,\"resolveTime\":0.00026699999999999998}],\"expressionEvaluation\":{\"failures\":0,\"successes\":0},\"firstStopTime\":0.087458974999999994,\"frameVariable\":{\"failures\":0,\"successes\":0},\"launchOrAttachTime\":0.052953161999999998,\"moduleIdentifiers\":[94554748126576,94554747837792,94554747149216,139800112130176,139800112161056,139800112206064,139800112340224,139800112509552,139800112236528],\"signals\":[{\"SIGSTOP\":1}],\"sourceMapDeduceCount\":0,\"stopCount\":8,\"targetCreateTime\":0.00057700000000000004,\"totalBreakpointResolveTime\":0.234537}]","totalDebugInfoByteSize":1668056,"totalDebugInfoEnabled":3,"totalDebugInfoIndexLoadedFromCache":0,"totalDebugInfoIndexSavedToCache":0,"totalDebugInfoIndexTime":0.027963000000000002,"totalDebugInfoParseTime":0.34354800000000002,"totalModuleCount":10,"totalModuleCountHasDebugInfo":3,"totalSymbolTableIndexTime":0.056050000000000003,"totalSymbolTableParseTime":0.23930000000000001,"totalSymbolTableStripped":0,"totalSymbolTablesLoadedFromCache":0,"totalSymbolTablesSavedToCache":0},"type":"event"}
```

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

23 months ago[libc] disable flakey tests
Michael Jones [Tue, 15 Nov 2022 21:50:27 +0000 (13:50 -0800)]
[libc] disable flakey tests

The mprotect test has been failing and causing significant buildbot
noise. Given that this is a simple functions it's more important that
the buildbot errors be useful than having more thorough tests for this
function.

Reviewed By: sivachandra, lntue

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

23 months ago[mlir][sparse] cleanup small vector constant hints
Aart Bik [Tue, 15 Nov 2022 22:15:35 +0000 (14:15 -0800)]
[mlir][sparse] cleanup small vector constant hints

Following advise from

https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h

This revision removes the size hints from SmallVector (unless we are
certain of the resulting number of elements). Also, this replaces
SmallVector references with SmallVectorImpl references.

Reviewed By: Peiming

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

23 months ago[libc] cleanup changes to gettimeofday.
Raman Tenneti [Tue, 15 Nov 2022 22:14:20 +0000 (14:14 -0800)]
[libc] cleanup changes to gettimeofday.

+ Deleted duplicate definitions of StructTimeVal and StructTimeValPtr.
+ Caled syscall  clock_gettime to get timespec data.
+ Added tests to test for sleeping 200 and 1000 microseconds.
+ Fixed comments from https://reviews.llvm.org/D137881

Reviewed By: sivachandra

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

23 months ago[BOLT-TESTS] Follow-up to D131919
Amir Ayupov [Tue, 15 Nov 2022 22:44:32 +0000 (14:44 -0800)]
[BOLT-TESTS] Follow-up to D131919

googletest was moved to third-party. Update path in BOLT's CMakeCache.

Reviewed By: #bolt, maksfb

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

23 months ago[LSR] Check if terminating value is safe to expand before transformation
eopXD [Fri, 28 Oct 2022 09:07:17 +0000 (02:07 -0700)]
[LSR] Check if terminating value is safe to expand before transformation

According to report by @JojoR, the assertion error was hit hence we need
to have this check before the actual transformation.

Reviewed By: Meinersbur, #loopoptwg

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

23 months ago[gn build] Port a16bd4f9f25e
LLVM GN Syncbot [Tue, 15 Nov 2022 22:46:53 +0000 (22:46 +0000)]
[gn build] Port a16bd4f9f25e

23 months ago[gn build] Port 4be39288f506
LLVM GN Syncbot [Tue, 15 Nov 2022 22:46:52 +0000 (22:46 +0000)]
[gn build] Port 4be39288f506

23 months ago[mlir][sparse] Fix rewriting for convert op and concatenate op.
bixia1 [Tue, 15 Nov 2022 21:24:15 +0000 (13:24 -0800)]
[mlir][sparse] Fix rewriting for convert op and concatenate op.

Fix a problem in convert op rewriting where it used the original index for
ToIndicesOp.

Extend the concatenate op rewriting to handle dense destination and dynamic
shape destination.

Make the concatenate op integration test run on the codegen path.

Reviewed By: Peiming

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

23 months agoNFC test if rosetta is installed before running x86 binary on AS
Jason Molenda [Tue, 15 Nov 2022 22:43:20 +0000 (14:43 -0800)]
NFC test if rosetta is installed before running x86 binary on AS

Rosetta 2 is not installed by default in a fresh macOS installation
on Apple Silicon, so x86 binaries cannot be run.  CI bots are often
in this state.  Update this test to check for the rosetta debugserver,
which our debugserver also hardcodes the path of, before trying to
run an x86 process on AS systems.

23 months ago[ObjC] Fix an assertion failure in EvaluateLValue
Akira Hatanaka [Tue, 15 Nov 2022 21:55:12 +0000 (13:55 -0800)]
[ObjC] Fix an assertion failure in EvaluateLValue

Look through parentheses when determining whether the expression is a
@selector expression.

23 months ago[Clang][Sema] Refactor category declaration under CheckForIncompatibleAttributes...
eopXD [Mon, 7 Nov 2022 17:47:09 +0000 (09:47 -0800)]
[Clang][Sema] Refactor category declaration under CheckForIncompatibleAttributes. NFC

This change would allow extension of new categories be aware of adding
more code here.

This patch also updates the comments, which was originally missing the
vector predicate.

Reviewed By: mikerice

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

23 months ago[TargetLowering][RISCV][ARM][AArch64][Mips] Reduce the number of AND mask constants...
Craig Topper [Tue, 15 Nov 2022 22:36:01 +0000 (14:36 -0800)]
[TargetLowering][RISCV][ARM][AArch64][Mips] Reduce the number of AND mask constants used by BSWAP expansion.

We can reuse constants if we use SRL followed by AND and AND followed by SHL.
Similar was done to bitreverse previously.

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

23 months ago[AggressiveInstCombine] Remove legacy PM pass
Arthur Eubanks [Mon, 31 Oct 2022 21:50:38 +0000 (14:50 -0700)]
[AggressiveInstCombine] Remove legacy PM pass

As part of legacy PM optimization pipeline removal.

This shouldn't be used in codegen pipelines so it should be ok to remove.

Reviewed By: asbirlea

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

23 months agoNFC test if rosetta debugserver exists before testing rosetta
Jason Molenda [Tue, 15 Nov 2022 22:33:50 +0000 (14:33 -0800)]
NFC test if rosetta debugserver exists before testing rosetta

A fresh install of macOS does not have Rosetta 2 installed by
default; the CI bots are often in this state, resulting in a
test failure.  debugserver already hardcodes the filepath of
the Rosetta 2 debugserver; test if that file exists before
running the Rosetta test.

23 months ago[opt] Print deprecation warning for use of legacy syntax with new pass manager
Arthur Eubanks [Sun, 23 Oct 2022 20:42:13 +0000 (13:42 -0700)]
[opt] Print deprecation warning for use of legacy syntax with new pass manager

And a possible opt invocation plus a link to more extensive documentation.

Reviewed By: asbirlea

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

23 months ago[lldb/test] Fix app_specific_backtrace_crashlog.test (NFC)
Med Ismail Bennani [Tue, 15 Nov 2022 22:23:26 +0000 (14:23 -0800)]
[lldb/test] Fix app_specific_backtrace_crashlog.test (NFC)

This patch changes app_specific_backtrace_crashlog.test's crashlog file
extension from `ips` to `txt. This should prevent the test from opening
Console.app when being run.

This should also fix a test failure caused by missing symbols.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[RISCV] Move GlobalISEL specific files to sub-directory [nfc]
Philip Reames [Tue, 15 Nov 2022 21:50:39 +0000 (13:50 -0800)]
[RISCV] Move GlobalISEL specific files to sub-directory [nfc]

23 months ago[clang][deps] Remove checks that were just for exhaustiveness
Ben Langmuir [Tue, 15 Nov 2022 22:18:59 +0000 (14:18 -0800)]
[clang][deps] Remove checks that were just for exhaustiveness

Instead of checking all the paths, just ensure the one we care about is
correct. On a particular platform one of the paths seems to have been
more canonical than we were expecting, which is fine.

23 months ago[OpenMP] [OMPT] [2/8] Implemented a connector for communication of OMPT callbacks...
Dhruva Chakrabarti [Tue, 15 Nov 2022 20:27:04 +0000 (12:27 -0800)]
[OpenMP] [OMPT] [2/8] Implemented a connector for communication of OMPT callbacks between libraries.

This is part of a set of patches implementing OMPT target callback support and has been split out of the originally submitted https://reviews.llvm.org/D113728. The overall design can be found in https://rice.app.box.com/s/pf3gix2hs4d4o1aatwir1set05xmjljc

The purpose of this patch is to provide a way to register tool-provided callbacks into libomp when libomptarget is loaded.

Introduced a cmake variable LIBOMPTARGET_OMPT_SUPPORT that can be used to control OMPT target support. It follows host OMPT support, controlled by LIBOMP_HAVE_OMPT_SUPPORT.

Added a connector that can be used to communicate between OMPT implementations in libomp and libomptarget or libomptarget and a plugin.

Added a global constructor in libomptarget that uses the connector to force registration of tool-provided callbacks in libomp. A pair of init and fini functions are provided to libomp as part of the connect process which will be used to register the tool-provided callbacks in libomptarget.

Patch from John Mellor-Crummey <johnmc@rice.edu>
(With contributions from Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>)

Reviewed By: dreachem, jhuber6

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

23 months ago[OPENMP]Initial support for at clause
Jennifer Yu [Fri, 11 Nov 2022 02:12:35 +0000 (18:12 -0800)]
[OPENMP]Initial support for at clause

Error directive is allowed in both declared and executable contexts.
The function ActOnOpenMPAtClause is called in both places during the
parsers.

Adding a param "bool InExContext" to identify context which is used to
emit error massage.

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

23 months ago[clang][deps] Avoid leaking modulemap paths across unrelated imports
Ben Langmuir [Mon, 14 Nov 2022 22:51:54 +0000 (14:51 -0800)]
[clang][deps] Avoid leaking modulemap paths across unrelated imports

Use a FileEntryRef when retrieving modulemap paths in the scanner so
that we use a path compatible with the original module import, rather
than a FileEntry which can allow unrelated modules to leak paths into
how we build a module due to FileManager mutating the path.

Note: the current change prevents an "unrelated" path, but does not
change how VFS mapped paths are handled (which would be calling
getNameAsRequested) nor canonicalize the path.

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

23 months ago[SLP]Fix a crash on analysis of the vectorized node.
Alexey Bataev [Tue, 15 Nov 2022 20:52:03 +0000 (12:52 -0800)]
[SLP]Fix a crash on analysis of the vectorized node.

Need to use advanced check for the same vectorized node to avoid
possible compiler crash. We may have 2 similar nodes (vector one and
gather) after graph nodes rotation, need to do extra checks for the
exact match.

23 months ago[libc] re-enable assert
Michael Jones [Tue, 15 Nov 2022 20:05:37 +0000 (12:05 -0800)]
[libc] re-enable assert

The assert functions were disabled while the signal functions were being
fixed. This patch re-enables them.

Reviewed By: sivachandra

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

23 months agoApply clang-tidy fixes for llvm-qualified-auto in TestTilingInterface.cpp (NFC)
Mehdi Amini [Mon, 14 Nov 2022 07:28:19 +0000 (07:28 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in TestTilingInterface.cpp (NFC)

23 months agoApply clang-tidy fixes for readability-identifier-naming in SparseTensorCodegen.cpp...
Mehdi Amini [Mon, 14 Nov 2022 06:38:25 +0000 (06:38 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in SparseTensorCodegen.cpp (NFC)

23 months agoApply clang-tidy fixes for llvm-else-after-return in SparseTensorCodegen.cpp (NFC)
Mehdi Amini [Mon, 14 Nov 2022 06:37:42 +0000 (06:37 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in SparseTensorCodegen.cpp (NFC)

23 months ago[libc++] Introduce helper functions __make_iter in vector and string
Louis Dionne [Mon, 14 Nov 2022 21:01:05 +0000 (11:01 -1000)]
[libc++] Introduce helper functions __make_iter in vector and string

This prepares the terrain for introducing a new type of bounded iterator
that can't be constructed like __wrap_iter. This reverts part of the
changes made to std::vector in 4eab04f84.

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

23 months ago[mlir][sparse] avoid single default parameters in pass constructors
Aart Bik [Tue, 15 Nov 2022 19:47:53 +0000 (11:47 -0800)]
[mlir][sparse] avoid single default parameters in pass constructors

Reviewed By: bixia

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

23 months ago[mlir][SerializeToHsaco] Minimize dependencies of AMDGPU compilation
Krzysztof Drewniak [Mon, 14 Nov 2022 21:53:10 +0000 (21:53 +0000)]
[mlir][SerializeToHsaco] Minimize dependencies of AMDGPU compilation

The SerializeToHsaco uses functions from ExecutionEngineUtils to set
up LLVM pass pipelines, but does not otherwise depend on the execution
engine (except indirectly via a dependency on IPO). This commit
removes the dependency on the execution engine to prevent
unnecessarily compilations.

Reviewed By: ThomasRaoux

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

23 months ago[libc] Include stddef.h after D137871
Fangrui Song [Tue, 15 Nov 2022 20:22:33 +0000 (20:22 +0000)]
[libc] Include stddef.h after D137871

C standard does not require stdint.h to define size_t.

23 months ago[mlir] Fix a warning
Kazu Hirata [Tue, 15 Nov 2022 20:21:20 +0000 (12:21 -0800)]
[mlir] Fix a warning

This patch fixes:

  mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp:195:30: warning:
  cast from type ‘const long unsigned int*’ to type ‘void*’ casts away
  qualifiers [-Wcast-qual]

23 months ago[mlir] Fix warnings
Kazu Hirata [Tue, 15 Nov 2022 20:16:03 +0000 (12:16 -0800)]
[mlir] Fix warnings

This patch fixes:

  mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp:296:31: error:
  comparison of integers of different signs: 'int64_t' (aka 'long')
  and 'const uint64_t' (aka 'const unsigned long')
  [-Werror,-Wsign-compare]

  mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp:297:67: error:
  comparison of integers of different signs: 'int64_t' (aka 'long')
  and 'const uint64_t' (aka 'const unsigned long')
  [-Werror,-Wsign-compare]

  mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp:298:31: error:
 comparison of integers of different signs: 'int64_t' (aka 'long') and
 'const uint64_t' (aka 'const unsigned long') [-Werror,-Wsign-compare]

  mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp:479:30: error:
  comparison of integers of different signs: 'int64_t' (aka 'long')
  and 'const uint64_t' (aka 'const unsigned long')
  [-Werror,-Wsign-compare]

23 months ago[mlir] Remove `Transforms/SideEffectUtils.h` and move the methods into `Interface...
Mahesh Ravishankar [Fri, 11 Nov 2022 17:10:38 +0000 (17:10 +0000)]
[mlir] Remove `Transforms/SideEffectUtils.h` and move the methods into `Interface/SideEffectInterfaces.h`.

The methods in `SideEffectUtils.h` (and their implementations in
`SideEffectUtils.cpp`) seem to have similar intent to methods already
existing in `SideEffectInterfaces.h`. Move the decleration (and
implementation) from `SideEffectUtils.h` (and `SideEffectUtils.cpp`)
into `SideEffectInterfaces.h` (and `SideEffectInterface.cpp`).

Also drop the `SideEffectInterface::hasNoEffect` method in favor of
`mlir::isMemoryEffectFree` which actually recurses into the operation
instead of just relying on the `hasRecursiveMemoryEffectTrait`
exclusively.

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

23 months ago[Clang] Extend the number of case Sema::CheckForIntOverflow covers
Shafik Yaghmour [Tue, 15 Nov 2022 19:06:59 +0000 (11:06 -0800)]
[Clang] Extend the number of case Sema::CheckForIntOverflow covers

Currently Sema::CheckForIntOverflow misses several case that other compilers
diagnose for overflow in integral constant expressions. This includes the
arguments of a CXXConstructExpr as well as the expressions used in an
ArraySubscriptExpr, CXXNewExpr and CompoundLiteralExpr.

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

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

23 months ago[mlir] Fix warnings
Kazu Hirata [Tue, 15 Nov 2022 20:01:00 +0000 (12:01 -0800)]
[mlir] Fix warnings

This patch fixes:

  mlir/include/mlir/ExecutionEngine/SparseTensor/Storage.h:955:20:
  error: unused variable 'sz' [-Werror,-Wunused-variable]

  mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp:1460:2:
  error: extra ';' outside of a function is incompatible with C++98
  [-Werror,-Wc++98-compat-extra-semi]

23 months ago[mlir][sparse] Only insert non-zero values to the result of the concatenate operation.
bixia1 [Tue, 15 Nov 2022 18:52:57 +0000 (10:52 -0800)]
[mlir][sparse] Only insert non-zero values to the result of the concatenate operation.

Modify the integration test to check number_of_entries and use it to limit for
outputing sparse tensor values.

Reviewed By: aartbik, Peiming

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

23 months ago[mlir][sparse] fix bugs in concatenate rewriter.
Peiming Liu [Tue, 15 Nov 2022 19:45:22 +0000 (19:45 +0000)]
[mlir][sparse] fix bugs in concatenate rewriter.

Reviewed By: aartbik, bixia

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

23 months agoAdd FP8 E4M3 support to APFloat.
Reed [Tue, 15 Nov 2022 19:11:50 +0000 (20:11 +0100)]
Add FP8 E4M3 support to APFloat.

NVIDIA, ARM, and Intel recently introduced two new FP8 formats, as described in the paper: https://arxiv.org/abs/2209.05433. The first of the two FP8 dtypes, E5M2, was added in https://reviews.llvm.org/D133823. This change adds the second of the two: E4M3.

There is an RFC for adding the FP8 dtypes here: https://discourse.llvm.org/t/rfc-add-apfloat-and-mlir-type-support-for-fp8-e5m2/65279. I spoke with the RFC's author, Stella, and she gave me the go ahead to implement the E4M3 type. The name of the E4M3 type in APFloat is Float8E4M3FN, as discussed in the RFC. The "FN" means only Finite and NaN values are supported.

Unlike E5M2, E4M3 has different behavior from IEEE types in regards to Inf and NaN values. There are no Inf values, and NaN is represented when the exponent and mantissa bits are all 1s. To represent these differences in APFloat, I added an enum field, fltNonfiniteBehavior, to the fltSemantics struct. The possible enum values are IEEE754 and NanOnly. Only Float8E4M3FN has the NanOnly behavior.

After this change is submitted, I plan on adding the Float8E4M3FN type to MLIR, in the same way as E5M2 was added in https://reviews.llvm.org/D133823.

Reviewed By: bkramer

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

23 months ago[asan][darwin] This test is x86_64 specific, not non-ios in general.
Roy Sundahl [Tue, 15 Nov 2022 19:23:46 +0000 (11:23 -0800)]
[asan][darwin] This test is x86_64 specific, not non-ios in general.

This test was unsupported in iOS when a more accurate test is that the architecture is x86_64. This "fix" is first in a series of updates intended to get asan arm64 tests fully functional.

Reviewed By: thetruestblue, vitalybuka

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

23 months agoRevert D137574 "PEI should be able to use backward walk in replaceFrameIndicesBackward."
Fangrui Song [Tue, 15 Nov 2022 19:19:46 +0000 (19:19 +0000)]
Revert D137574 "PEI should be able to use backward walk in replaceFrameIndicesBackward."

This reverts commit e05ce03cfa0b36e9b99149e21afcb1fc039df813.

Caused asan use-after-poison to 4 DebugInfo/AMDGPU/ tests.
Triggered in PEI::replaceFrameIndicesBackward called llvm::MachineInstr::getNumOperands

23 months ago[libc][math] Improve the performance and error printing of UInt.
Tue Ly [Fri, 11 Nov 2022 23:04:56 +0000 (18:04 -0500)]
[libc][math] Improve the performance and error printing of UInt.

Use add_with_carry builtin to improve the performance of
addition and multiplication of UInt class.  For 128-bit, it is as
fast as using __uint128_t.

Microbenchmark for addition:
https://quick-bench.com/q/-5a6xM4T8rIXBhqMTtLE-DD2h8w

Microbenchmark for multiplication:
https://quick-bench.com/q/P2muLAzJ_W-VqWCuxEJ0CU0bLDg

Microbenchmark for shift right:
https://quick-bench.com/q/N-jkKXaVsGQ4AAv3k8VpsVkua5Y

Microbenchmark for shift left:
https://quick-bench.com/q/5-RzwF8UdslC-zuhNajXtXdzLRM

Reviewed By: sivachandra

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

23 months ago[AVR] Fix use-of-uninitialized-value after D137520
Fangrui Song [Tue, 15 Nov 2022 19:06:18 +0000 (11:06 -0800)]
[AVR] Fix use-of-uninitialized-value after D137520

23 months ago[NVPTX] Fix alignment for arguments of function pointer calls
Andrew Savonichev [Tue, 15 Nov 2022 18:43:06 +0000 (21:43 +0300)]
[NVPTX] Fix alignment for arguments of function pointer calls

Alignment of function arguments can be increased only if we can do
this for all call sites. Therefore we do not increase it for external
functions, and now we skip functions that have address taken, to avoid
any issues with functions pointers.

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

23 months ago[NVPTX] Fix pointer argument declaration for --nvptx-short-ptr
Andrew Savonichev [Tue, 15 Nov 2022 18:41:33 +0000 (21:41 +0300)]
[NVPTX] Fix pointer argument declaration for --nvptx-short-ptr

When --nvptx-short-ptr is set, local pointers are stored as 32-bit on
nvptx64 target.

Before this patch, arguments for a function declaration were always
emitted as b64 regardless of their address space, but they were set as
b32 for the corresponding call instruction:

   .extern .func test
   (
    .param .b64 test_param_0
   )
   [...]
    .param .b32 param0;
    st.param.b32 [param0+0], %r1;
    call.uni test, (param0);

This is not supported:

  ptxas: Type of argument does not match formal parameter
  'test_param_0'

Now short pointers in a function declaration are emitted as b32 if
--nvptx-short-ptr is set.

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

23 months ago[NVPTX] Fix pointer type for short 32-bit pointers
Andrew Savonichev [Tue, 15 Nov 2022 18:39:34 +0000 (21:39 +0300)]
[NVPTX] Fix pointer type for short 32-bit pointers

Global variables used to be printed as u64/b64 even when
-nvptx-short-ptr is set.

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

23 months ago[NFC][X86][Costmodel] Drop reduntant interleaved cost test coverage
Roman Lebedev [Tue, 15 Nov 2022 18:27:53 +0000 (21:27 +0300)]
[NFC][X86][Costmodel] Drop reduntant interleaved cost test coverage

These are already covered by the more general tests i've added.

23 months agoApply clang-tidy fixes for modernize-loop-convert in CodegenUtils.cpp (NFC)
Mehdi Amini [Mon, 14 Nov 2022 06:36:11 +0000 (06:36 +0000)]
Apply clang-tidy fixes for modernize-loop-convert in CodegenUtils.cpp (NFC)

23 months agoApply clang-tidy fixes for llvm-qualified-auto in TileUsingInterface.cpp (NFC)
Mehdi Amini [Mon, 14 Nov 2022 06:33:14 +0000 (06:33 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in TileUsingInterface.cpp (NFC)