platform/upstream/llvm.git
23 months ago[flang][RFC] Proposal for complex number lowering through MLIR
David Truby [Tue, 1 Nov 2022 14:12:14 +0000 (14:12 +0000)]
[flang][RFC] Proposal for complex number lowering through MLIR

This design document proposes lowering FIR complex number operations
through the MLIR complex dialect.

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

23 months ago[flang][RFC] Change the interface for non-BIND(C) CPTR type with VALUE attribute
Peixin Qiao [Fri, 4 Nov 2022 14:19:38 +0000 (22:19 +0800)]
[flang][RFC] Change the interface for non-BIND(C) CPTR type with VALUE attribute

When the `type(c_ptr/c_funptr)` argument has value attribute in non-BIND(C)
procedure, it is passed by VALUE in gfortran. ifort does not do this. Be
consistent with gfortran.

Fix #58756.

Reviewed By: PeteSteinfeld, jeanPerier

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

23 months ago[flang] Fix function result rewrite
Peixin Qiao [Fri, 4 Nov 2022 14:15:58 +0000 (22:15 +0800)]
[flang] Fix function result rewrite

When the function result is `type(c_ptr/c_funptr)`, and the function has
or does not have BIND(C) attribute, the function result is not taken as
the first argument of the function call in other compilers such as
gfortran and ifort. Fix it to be consistent with gfortran/ifort by
changing the abstract result type check.

Fix #58739.

Reviewed By: PeteSteinfeld, jeanPerier

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

23 months ago[flang] Update fir.select_type op to fit design document
Valentin Clement [Fri, 4 Nov 2022 13:59:37 +0000 (14:59 +0100)]
[flang] Update fir.select_type op to fit design document

Update the already existing fir.select_type operation to
reflect decisions made in the polymorphic entities design document.
The verifier is updated to check that the select is polymorphic.
The case attributes name are changed and some tests are added.

Reviewed By: jeanPerier

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

23 months agoImplement CWG2631
Corentin Jabot [Sun, 23 Oct 2022 15:32:58 +0000 (17:32 +0200)]
Implement CWG2631

Implement https://cplusplus.github.io/CWG/issues/2631.html.

Immediate calls in default arguments and defaults members
are not evaluated.

Instead, we evaluate them when constructing a
`CXXDefaultArgExpr`/`BuildCXXDefaultInitExpr`.

The immediate calls are executed by doing a
transform on the initializing expression.

Note that lambdas are not considering subexpressions so
we do not need to transform them.

As a result of this patch, unused default member
initializers are not considered odr-used, and
errors about members binding to local variables
in an outer scope only surface at the point
where a constructor is defined.

Reviewed By: aaron.ballman, #clang-language-wg

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

23 months ago[StructurizeCFG][DebugInfo] Avoid use-after-free
Juan Manuel MARTINEZ CAAMAÑO [Fri, 4 Nov 2022 13:28:26 +0000 (13:28 +0000)]
[StructurizeCFG][DebugInfo] Avoid use-after-free

Reviewed By: dstuttard

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

23 months ago[GVN] Patch for invalid GVN replacement
Alex Gatea [Fri, 4 Nov 2022 13:28:17 +0000 (14:28 +0100)]
[GVN] Patch for invalid GVN replacement

If PRE is performed as part of the main GVN pass (to PRE GEP
operands before processing loads), and it is performed across a
backedge, we will end up adding the new instruction to the leader
table of a block that has not yet been processed. When it will be
processed, GVN will incorrectly assume that the value is already
available, even though it is only available at the end of the
block.

Avoid this by not performing PRE across backedges.

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

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

23 months agoadds huge pages support of PIE/no-PIE binaries
Alexey Moksyakov [Mon, 27 Jun 2022 12:37:53 +0000 (12:37 +0000)]
adds huge pages support of PIE/no-PIE binaries

This patch adds the huge pages support (-hugify) for PIE/no-PIE
binaries. Also returned functionality to support the kernels < 5.10
where there is a problem in a dynamic loader with the alignment of
pages addresses.

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

23 months ago[llvm-debuginfo-analyzer] Fix format string-type mismatch in LVScope
Michał Górny [Fri, 4 Nov 2022 08:19:22 +0000 (09:19 +0100)]
[llvm-debuginfo-analyzer] Fix format string-type mismatch in LVScope

Fix mismatch between `%d`/`%x` format strings and `uint64_t` type.
This fixes incorrect printing of "Scope Sizes" on 32-bit platforms
where this leads to `llvm::print()` misreading vararg.

Fixes #58758

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

23 months ago[Driver] Do not run test on AIX
Serge Pavlov [Fri, 4 Nov 2022 11:30:17 +0000 (18:30 +0700)]
[Driver] Do not run test on AIX

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

23 months ago[mlir][linalg] Add BroadcastOp to Linalg structured ops.
Oleg Shyshkov [Fri, 4 Nov 2022 11:06:31 +0000 (12:06 +0100)]
[mlir][linalg] Add BroadcastOp to Linalg structured ops.

[[RFC] Primitive Ops: add BroadcastOp to Linalg](https://discourse.llvm.org/t/rfc-primitive-ops-add-broadcastop-to-linalg/66313?u=olegshyshkov)

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

23 months ago[AMDGPU] Skip stack-arg dbg objects while fixing the dead frame indices
Christudasan Devadasan [Wed, 2 Nov 2022 13:38:02 +0000 (19:08 +0530)]
[AMDGPU] Skip stack-arg dbg objects while fixing the dead frame indices

Both SGPR->VGPR and VGPR->AGPR spilling code give a fixup to the
spill frame indices referred in debug instructions so that they
can be entirely removed. We should skip the stack argument debug
objects while looking inside the bitvector with FI as the index
that tracks the spill indices being processed. The stack args will
have negative indices and would crash while accessing the bitvector.

Reviewed By: arsenm

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

23 months ago[LoongArch] Change the name of LoongArchPreRAExpandPseudo pass
wanglei [Fri, 4 Nov 2022 09:50:31 +0000 (17:50 +0800)]
[LoongArch] Change the name of LoongArchPreRAExpandPseudo pass

By convention, pass names use lowercase letters.
LoongArch-prera-expand-pseudo -> loongarch-prera-expand-pseudo.

Reviewed By: SixWeining

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

23 months ago[IR] Switch everything to use memory attribute
Nikita Popov [Wed, 2 Nov 2022 15:46:56 +0000 (16:46 +0100)]
[IR] Switch everything to use memory attribute

This switches everything to use the memory attribute proposed in
https://discourse.llvm.org/t/rfc-unify-memory-effect-attributes/65579.
The old argmemonly, inaccessiblememonly and inaccessiblemem_or_argmemonly
attributes are dropped. The readnone, readonly and writeonly attributes
are restricted to parameters only.

The old attributes are auto-upgraded both in bitcode and IR.
The bitcode upgrade is a policy requirement that has to be retained
indefinitely. The IR upgrade is mainly there so it's not necessary
to update all tests using memory attributes in this patch, which
is already large enough. We could drop that part after migrating
tests, or retain it longer term, to make it easier to import IR
from older LLVM versions.

High-level Function/CallBase APIs like doesNotAccessMemory() or
setDoesNotAccessMemory() are mapped transparently to the memory
attribute. Code that directly manipulates attributes (e.g. via
AttributeList) on the other hand needs to switch to working with
the memory attribute instead.

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

23 months ago[AArch64] SME2 multi-vec unpack, ZIP, frint for two and four registers
Caroline Concatto [Wed, 2 Nov 2022 09:35:43 +0000 (09:35 +0000)]
[AArch64] SME2 multi-vec unpack, ZIP, frint for  two and four registers

This patch adds the assembly/disassembly for the following instructions:
  SUNPK: Unpack and sign-extend multi-vector elements.
  UUNPK: Unpack and zero-extend multi-vector elements.
  ZIP (four registers): Interleave elements from four vectors.
  ZIP (two registers): Interleave elements from two vectors.
  FRINTA: Multi-vector floating-point round to integral value, to nearest with ties away from zero.
  FRINTM: Multi-vector floating-point round to integral value, toward minus Infinity.
  FRINTN: Multi-vector floating-point round to integral value, to nearest with ties to even.
  FRINTP: Multi-vector floating-point round to integral value, toward plus Infinity.

The reference can be found here:

https://developer.arm.com/documentation/ddi0602/2022-09

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

23 months ago[AArch64][SVE] Extend PTEST_ANY(X=OP(PG,...), X) -> PTEST_ANY(PG, X)) instcombine
Cullen Rhodes [Fri, 4 Nov 2022 08:40:18 +0000 (08:40 +0000)]
[AArch64][SVE] Extend PTEST_ANY(X=OP(PG,...), X) ->  PTEST_ANY(PG, X)) instcombine

Extend above instcombine added in D134946 to cover more flag-setting
instructions.

Reviewed By: peterwaller-arm

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

23 months ago[X86] Use default attributes for more intrinsics
Nikita Popov [Wed, 2 Nov 2022 10:49:22 +0000 (11:49 +0100)]
[X86] Use default attributes for more intrinsics

Another followup to D136939, adding default attributes to the
remaining readnone intrinsics.

This also covers some non-readnone intrinsics, because they were
interleaved, and it seemed to make more sense to update them at
the same time.

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

23 months ago[libc][NFC] Remove "$>" from another command block on examples/README.md.
Siva Chandra Reddy [Fri, 4 Nov 2022 08:37:05 +0000 (08:37 +0000)]
[libc][NFC] Remove "$>" from another command block on examples/README.md.

23 months ago[libc][NFC] Remove "$>" from recipe commands blocks in examples/README.md.
Siva Chandra Reddy [Fri, 4 Nov 2022 08:33:28 +0000 (08:33 +0000)]
[libc][NFC] Remove "$>" from recipe commands blocks in examples/README.md.

The blocks come with a copy button so removing the "$>" makes it easy to
copy paste the commands.

23 months ago[libc] Add example programs and their CMake build and instructions.
Siva Chandra Reddy [Fri, 28 Oct 2022 23:20:28 +0000 (23:20 +0000)]
[libc] Add example programs and their CMake build and instructions.

These examples are serve as an examples for people wanting to start
using the libc.

Reviewed By: michaelrj, jeffbailey

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

23 months ago[SimplifyCFG] Allow speculating block containing assume()
Nikita Popov [Thu, 3 Nov 2022 13:13:08 +0000 (14:13 +0100)]
[SimplifyCFG] Allow speculating block containing assume()

SpeculativelyExecuteBB(), which converts a branch + phi structure
into a select, currently bails out if the block contains an assume
(because it is not speculatable).

Adjust the fold to ignore ephemeral values (i.e. assumes and values
only used in assumes) for cost modelling purposes, and drop them
when performing the fold.

Theoretically, we could try to preserve the assume information by
generating a assume(br_cond || assume_cond) style assume, but this
is very unlikely to to be useful (because we don't do anything
useful with assumes of this form) and it would make things
substantially more complicated once we take operand bundle assumes
into account (which don't really support a || operation).
I'd prefer not to do that without good motivation.

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

23 months ago[clang-format][NFC] Remove parsePPElIf()
Owen Pan [Wed, 2 Nov 2022 22:23:00 +0000 (15:23 -0700)]
[clang-format][NFC] Remove parsePPElIf()

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

23 months ago[clang][cuda/hip] Allow `__noinline__` lambdas
Pierre van Houtryve [Fri, 4 Nov 2022 07:25:22 +0000 (07:25 +0000)]
[clang][cuda/hip] Allow `__noinline__`  lambdas

D124866 seem to have had an unintended side effect: __noinline__ on lambdas was no longer accepted.

This fixes the regression and adds a test case for it.

Reviewed By: aaron.ballman

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

23 months agoRevert "Implement CWG2631"
Corentin Jabot [Fri, 4 Nov 2022 07:24:52 +0000 (08:24 +0100)]
Revert "Implement CWG2631"

Breaks the build on some platforms.

This reverts commit bf1e235695a7acdc3e868217e69d5b31ada06cb3.

23 months ago[AMDGPU] Create new instructions in SIInstrInfo::moveToVALU
Jay Foad [Mon, 31 Oct 2022 15:10:14 +0000 (15:10 +0000)]
[AMDGPU] Create new instructions in SIInstrInfo::moveToVALU

Create new VALU instructions in moveToVALU instead of mutating the
existing SALU instruction. This makes it easier to add extra operands so
we can convert to the VOP3 form of VALU instructions.

NFCI but it does have the minor side effect of removing duplicate
implicit operands that were present on the original SALU if they are
default implicit operands for the VALU.

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

23 months ago[flang] Handle non derived-type unlimited polymorphic allocation
Valentin Clement [Fri, 4 Nov 2022 07:18:47 +0000 (08:18 +0100)]
[flang] Handle non derived-type unlimited polymorphic allocation

Runtime call to PointerNullifyDerived or AllocatableInitDerived
should only be generated for derived-type allocation of polymorphic entities.
With unlimited polymorphic entities, it is possible that the type spec is not
a derived-type. Avoid failure in that case.

Reviewed By: PeteSteinfeld

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

23 months ago[libc] Add implementation of setbuf and setvbuf.
Siva Chandra Reddy [Wed, 2 Nov 2022 22:38:50 +0000 (22:38 +0000)]
[libc] Add implementation of setbuf and setvbuf.

Reviewed By: michaelrj

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

23 months ago[libc] Convert the api-test in to an integration test.
Siva Chandra Reddy [Fri, 4 Nov 2022 07:07:54 +0000 (07:07 +0000)]
[libc] Convert the api-test in to an integration test.

It used to pass but showed an annoying message about _start not being
available. That will not happen anymore.

23 months ago[RISCV] Add FMV_H_X/FMV_W_X/FCVT_H_W/FCVT_H_WU to isAllUsesReadW in SExtWRemoval.
Craig Topper [Fri, 4 Nov 2022 03:56:47 +0000 (20:56 -0700)]
[RISCV] Add FMV_H_X/FMV_W_X/FCVT_H_W/FCVT_H_WU to isAllUsesReadW in SExtWRemoval.

The instructions only read the lower 16 or 32 bits of a GPR.

23 months ago[RISCV] Change SEXT_B/SEXT_H/ZEXT_H_RV64 handling in isAllUsesReadW in SExtWRemoval.
Craig Topper [Fri, 4 Nov 2022 03:55:41 +0000 (20:55 -0700)]
[RISCV] Change SEXT_B/SEXT_H/ZEXT_H_RV64 handling in isAllUsesReadW in SExtWRemoval.

These instrucitons only use the lower 8 or 16 bits. We don't need
to look across them.

23 months agoImplement CWG2631
Corentin Jabot [Sun, 23 Oct 2022 15:32:58 +0000 (17:32 +0200)]
Implement CWG2631

Implement https://cplusplus.github.io/CWG/issues/2631.html.

Immediate calls in default arguments and defaults members
are not evaluated.

Instead, we evaluate them when constructing a
`CXXDefaultArgExpr`/`BuildCXXDefaultInitExpr`.

The immediate calls are executed by doing a
transform on the initializing expression.

Note that lambdas are not considering subexpressions so
we do not need to transform them.

As a result of this patch, unused default member
initializers are not considered odr-used, and
errors about members binding to local variables
in an outer scope only surface at the point
where a constructor is defined.

Reviewed By: aaron.ballman, #clang-language-wg

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

23 months ago[lldb/Interpreter] Open saved transcript in GUI Editor
Med Ismail Bennani [Tue, 1 Nov 2022 05:14:18 +0000 (22:14 -0700)]
[lldb/Interpreter] Open saved transcript in GUI Editor

This patch will automatically open LLDB's saved transcript file on the
graphical editor if lldb is running under an interactive graphical session.

This can be controlled by a new setting: `interpreter.open-transcript-in-editor`

rdar://92692106

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[ELF] Fix duplicate work typo. NFC
Fangrui Song [Fri, 4 Nov 2022 06:10:19 +0000 (23:10 -0700)]
[ELF] Fix duplicate work typo. NFC

23 months ago[X86][test] Change some CodeGen tests to use %clang_cc1
Fangrui Song [Fri, 4 Nov 2022 05:54:44 +0000 (22:54 -0700)]
[X86][test] Change some CodeGen tests to use %clang_cc1

23 months ago[X86][test] Add -fcf-protection test for pre-pentiumpro
Fangrui Song [Fri, 4 Nov 2022 05:21:43 +0000 (22:21 -0700)]
[X86][test] Add -fcf-protection test for pre-pentiumpro

For #58737

23 months ago[X86][CET] Add Diags for targets pre to i686 for `-fcf-protection`
Phoebe Wang [Fri, 4 Nov 2022 03:21:28 +0000 (11:21 +0800)]
[X86][CET] Add Diags for targets pre to i686 for `-fcf-protection`

Intel Control-flow Enforcement Technology (CET) provides new instructions `endbr32/64` for the indirect branch control. They are NOPs on i686 and new targets. We need to check for that in case it crashes on older targets.

Fixes #58737

Reviewed By: nickdesaulniers

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

23 months ago[LoopInterchange] Check phis in all subloops
Congzhe Cao [Fri, 4 Nov 2022 04:07:42 +0000 (00:07 -0400)]
[LoopInterchange] Check phis in all subloops

This is the bugfix to the miscompile mentioned in
https://reviews.llvm.org/D132055#3814831. The IR
that reproduced the bug is added as the test case in
this patch.

What this patch does is that, during legality phase
instead of checking the phi nodes only in `InnerLoop`
and `OuterLoop`, we check phi nodes in all subloops
of the `OuterLoop`. Suppose if the loop nest is triply
nested, and `InnerLoop` and `OuterLoop` is the middle
loop and the outermost loop respectively, we'll check
phi nodes in the innermost loop as well, in addition to
the ones in the middle and outermost loops.

Reviewed By: Meinersbur, #loopoptwg

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

23 months ago[CodeGenPrep] Change ValueToSExts from DeseMap to MapVector
Haohai Wen [Fri, 4 Nov 2022 02:15:11 +0000 (10:15 +0800)]
[CodeGenPrep] Change ValueToSExts from DeseMap to MapVector

mergeSExts iterates throught ValueToSExts. Using DenseMap result in
unstable optimization path so that output IR may vary even if the input
IR is same.

Reviewed By: wxiao3

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

23 months agoReland "[LLDB] [LoongArch] Add loongarch64 case in ComputeHostArchitectureSupport()"
Tiezhu Yang [Fri, 4 Nov 2022 02:39:57 +0000 (10:39 +0800)]
Reland "[LLDB] [LoongArch] Add loongarch64 case in ComputeHostArchitectureSupport()"

This is a simple change, loongarch64 host also supports 32-bit binaries,
so note it.

Without this patch:

```
[loongson@linux build]$ ./tools/lldb/unittests/Host/HostTests | tail -6
[==========] 78 tests from 18 test suites ran. (16 ms total)
[  PASSED  ] 77 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] HostTest.GetProcessInfo

 1 FAILED TEST
```

With this patch:

```
[loongson@linux build]$ ./tools/lldb/unittests/Host/HostTests | tail -2
[==========] 78 tests from 18 test suites ran. (15 ms total)
[  PASSED  ] 78 tests.
```

Reviewed By: SixWeining, xen0n, MaskRay, DavidSpickett

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

23 months agoRevert "[LLDB] [LoongArch] Add loongarch64 case in ComputeHostArchitectureSupport()"
Weining Lu [Fri, 4 Nov 2022 02:38:10 +0000 (10:38 +0800)]
Revert "[LLDB] [LoongArch] Add loongarch64 case in ComputeHostArchitectureSupport()"

This reverts commit de865087f8c07c742dec3523ec8cbe6895bd57ac.

Reason to revert: author name is wrong.

23 months ago[LLDB] [LoongArch] Add loongarch64 case in ComputeHostArchitectureSupport()
Weining Lu [Fri, 4 Nov 2022 02:26:31 +0000 (10:26 +0800)]
[LLDB] [LoongArch] Add loongarch64 case in ComputeHostArchitectureSupport()

This is a simple change, loongarch64 host also supports 32-bit binaries,
so note it.

Without this patch:

```
[loongson@linux build]$ ./tools/lldb/unittests/Host/HostTests | tail -6
[==========] 78 tests from 18 test suites ran. (16 ms total)
[  PASSED  ] 77 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] HostTest.GetProcessInfo

 1 FAILED TEST
```

With this patch:

```
[loongson@linux build]$ ./tools/lldb/unittests/Host/HostTests | tail -2
[==========] 78 tests from 18 test suites ran. (15 ms total)
[  PASSED  ] 78 tests.
```

Reviewed By: xen0n, MaskRay, DavidSpickett

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

23 months ago[X86] Support -march=raptorlake, meteorlake
Freddy Ye [Fri, 4 Nov 2022 01:04:57 +0000 (09:04 +0800)]
[X86] Support -march=raptorlake, meteorlake

Reviewed By: pengfei, skan, MaskRay

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

23 months ago[lldb-vscode] Send Statistics Dump in terminated event
Wanyi Ye [Sat, 10 Sep 2022 18:27:09 +0000 (11:27 -0700)]
[lldb-vscode] Send 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/D137003

23 months agoAdd TOC to GPU.md
Oleksandr "Alex" Zinenko [Fri, 4 Nov 2022 00:03:01 +0000 (01:03 +0100)]
Add TOC to GPU.md

23 months ago[lld][WebAssembly] Add support for LLD_REPRODUCE
Sam Clegg [Thu, 3 Nov 2022 23:13:54 +0000 (16:13 -0700)]
[lld][WebAssembly] Add support for LLD_REPRODUCE

This is feature of the ELF and COFF linker that we were missing until
now.

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

23 months ago[clang][dataflow] Generalize custom comparison to return tri-value result.
Yitzhak Mandelbaum [Thu, 3 Nov 2022 12:44:10 +0000 (12:44 +0000)]
[clang][dataflow] Generalize custom comparison to return tri-value result.

Currently, the API for a model's custom value comparison returns a
boolean. Therefore, models cannot distinguish between situations where the
values are recognized by the model and different and those where the values are
just not recognized.  This patch changes the return value to a tri-valued enum,
allowing models to express "don't know".

This patch is essentially a NFC -- no practical differences result from this
change in this patch. But, it prepares for future patches (particularly,
upcoming patches for widening) which will take advantage of the new flexibility.

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

23 months ago[mlir][index] Add shl, shrs, and shru ops
Jeff Niu [Thu, 3 Nov 2022 18:51:43 +0000 (11:51 -0700)]
[mlir][index] Add shl, shrs, and shru ops

This patch adds the left shift, signed right shift, and unsigned right
shift operations to the index dialects with folders and LLVM lowerings.

Reviewed By: rriddle

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

23 months ago[RISCV] Add missing break to the last case in a switch. NFC
Craig Topper [Thu, 3 Nov 2022 22:54:09 +0000 (15:54 -0700)]
[RISCV] Add missing break to the last case in a switch. NFC

Might create a problem in the future if more cases are added.

23 months ago[lldb] Support simplified template names when looking up functions
Arthur Eubanks [Mon, 31 Oct 2022 18:19:36 +0000 (11:19 -0700)]
[lldb] Support simplified template names when looking up functions

This makes setting breakpoints work with -gsimple-template-names.

Assume that callers handle false positives. For example, `Module::LookupInfo::Prune` removes wrong template instantiations when setting a breakpoint.

Reviewed By: labath

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

23 months ago[mlir][linalg] Add reduction tiling transformation
Thomas Raoux [Wed, 2 Nov 2022 05:18:26 +0000 (05:18 +0000)]
[mlir][linalg] Add reduction tiling transformation

Add a transformation to tile reduction ops into a parallel operation
followed by a merge operation. This is equivalent to the existing
reduction spliting transformation but using loops instead of using
higher dimensions linalg.

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

23 months ago[StatepointLowering] remove unused parameter. NFC
Nick Desaulniers [Thu, 3 Nov 2022 22:42:51 +0000 (15:42 -0700)]
[StatepointLowering] remove unused parameter. NFC

Reviewed By: craig.topper

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

23 months ago[SelectionDAGBuilder] use bitcast instead of AnyExtOrTrunc if copy parts from an...
Henry Yu [Thu, 3 Nov 2022 22:30:38 +0000 (15:30 -0700)]
[SelectionDAGBuilder] use bitcast instead of AnyExtOrTrunc if copy parts from an int vector to a float vector to fix issue #58615

The getCopyFromPartsVector doesn't work correctly when PartEVT and ValueVT have both different element type and different size.

This patch
1) removes the part of a comment that contains the incorrect assumption that element type are the same
2) use bitcast when copy parts of int vector to a float vector after the subvector extraction

Reviewed By: Peter, efriedma

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

23 months ago[IR Verifier] didn't check if switch case is constant, align IR Verifier's check...
Peter Rong [Tue, 25 Oct 2022 02:10:47 +0000 (19:10 -0700)]
[IR Verifier] didn't check if switch case is constant, align IR Verifier's check with LLParser.

If a programmer incorrectly `Switch->setOperand()` and `Verifier` will pass, causing problems when dumping this `Module`
This patch aligns SwitchInst's check with LLParser. It also includes a test to justify the patch.

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

23 months agoclang/cmake: Simplify lit detection for standalone builds
Tom Stellard [Thu, 3 Nov 2022 22:12:50 +0000 (15:12 -0700)]
clang/cmake: Simplify lit detection for standalone builds

Reviewed By: mgorny, phosek, Ericson2314

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

23 months agoOverride CalculateFrameVariableError in SymbolFileOnDemand
George Hu [Wed, 2 Nov 2022 19:19:22 +0000 (12:19 -0700)]
Override CalculateFrameVariableError in SymbolFileOnDemand

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

23 months ago[lldb/Plugins] Use default initializers for StructuredData::*SP (NFC)
Med Ismail Bennani [Thu, 3 Nov 2022 21:42:34 +0000 (14:42 -0700)]
[lldb/Plugins] Use default initializers for StructuredData::*SP (NFC)

This patch replaces the ScriptedProcessInterface getters to return
default initializers for StructureData shared pointers instead of
returning a null pointer.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[lldb/crashlog] Add support for Application Specific Backtraces & Information
Med Ismail Bennani [Thu, 3 Nov 2022 21:27:28 +0000 (14:27 -0700)]
[lldb/crashlog] Add support for Application Specific Backtraces & Information

For an exception crashlog, the thread backtraces aren't usually very helpful
and instead, developpers look at the "Application Specific Backtrace" that
was generated by `objc_exception_throw`.

LLDB could already parse and symbolicate these Application Specific Backtraces
for regular textual-based crashlog, so this patch adds support to parse them
in JSON crashlogs, and materialize them a HistoryThread extending the
crashed ScriptedThread.

This patch also includes the Application Specific Information messages
as part of the process extended crash information log. To do so, the
ScriptedProcess Python interface has a new GetMetadata method that
returns an arbitrary dictionary with data related to the process.

rdar://93207586

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[lldb/Utility] Add GetDescription(Stream&) to StructureData::*
Med Ismail Bennani [Thu, 3 Nov 2022 18:25:40 +0000 (11:25 -0700)]
[lldb/Utility] Add GetDescription(Stream&) to StructureData::*

This patch improves the StructuredData classes to provide a
GetDescription(lldb_private::Stream&) affordance.

This is very convenient compared to the Dump method because this try to
pretty print the structure instead of just serializing it into a JSON.

This patch also updates some parts of lldb (i.e. extended crash info) to
use this new affordance instead of StructuredData::Dump.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[lldb/Utility] Fix StructuredData::ParseJSONValue for null items
Med Ismail Bennani [Mon, 10 Oct 2022 20:45:45 +0000 (13:45 -0700)]
[lldb/Utility] Fix StructuredData::ParseJSONValue for null items

This patch fixes the JSON parser for StructuredData to handle JSON null
entries.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[lldb/Commands] Add newline for extended backtrace thread (NFCI)
Med Ismail Bennani [Sat, 8 Oct 2022 01:20:17 +0000 (18:20 -0700)]
[lldb/Commands] Add newline for extended backtrace thread (NFCI)

This adds a new line between the real thread and the extended backtrace
thread when it's available. This should improve readability for the user.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[lldb/Plugins] Cleanup error handling in Scripted{Process,Thread} (NFC)
Med Ismail Bennani [Fri, 7 Oct 2022 23:11:49 +0000 (16:11 -0700)]
[lldb/Plugins] Cleanup error handling in Scripted{Process,Thread} (NFC)

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[lldb/crashlog] Fix the image_regex_uuid to skip null UUID images
Med Ismail Bennani [Fri, 7 Oct 2022 23:08:52 +0000 (16:08 -0700)]
[lldb/crashlog] Fix the image_regex_uuid to skip null UUID images

This patch updates the image_regex_uuid matcher to match null-UUID
images in the plain text crashlog parser.

It updates the regex to match one or more '?' characters or the image
full path.

rdar://100904019

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[lldb/crashlog] Add support for 32bit frame addresses
Med Ismail Bennani [Fri, 7 Oct 2022 23:12:52 +0000 (16:12 -0700)]
[lldb/crashlog] Add support for 32bit frame addresses

This patch adds support for 32bit stack frame addresses in the `crashlog`
command.

For crash reports that are generated from a arm64_32 process, `PAGEZERO`
is loaded at 0x00004000 so no code address will be less than 0x4000.

This patch changes the crashlog frame address regex group to match
addresses as small as 4 hex characters.

rdar://100805026

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
23 months ago[libcxx] Fix the support requirements for `std::function` Objective-C++ test.
varconst [Thu, 3 Nov 2022 21:25:40 +0000 (14:25 -0700)]
[libcxx] Fix the support requirements for `std::function` Objective-C++ test.

The test requires two features to be supported but only checked for one
of them.

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

23 months ago[Binary] Support extracting offloading files from COFF
Joseph Huber [Thu, 27 Oct 2022 16:13:22 +0000 (16:13 +0000)]
[Binary] Support extracting offloading files from COFF

This patch adds initial support for extracting offloading binaries from
`COFF` objects. This is a first step to allow building offloading files
on Windows targets with the new driver.

Depends on D136796

Reviewed By: rnk

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

23 months ago[llvm-objdump][Offload] Use common offload extraction method
Joseph Huber [Wed, 26 Oct 2022 21:07:12 +0000 (21:07 +0000)]
[llvm-objdump][Offload] Use common offload extraction method

A previous patch introduced a common function used to extract offloading
binaries from an image. Therefore we no longer need to duplicate the
functionality in the `llvm-objdump` implementation. Functionally, this
removes the old warning behaviour when given malformed input. This has
been changed to a hard error, which is effectively the same.

This required a slight tweak in the linker wrapper to filter out the
user passing shared objects directly.

Reviewed By: tra

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

23 months agoDebugInfo: Move missing-abstract-variable.ll test from Generic to X86
Tom Stellard [Thu, 3 Nov 2022 20:59:46 +0000 (13:59 -0700)]
DebugInfo: Move missing-abstract-variable.ll test from Generic to X86

This test is XFAIL'd on most arches, and seems too fragile to be run on non-X86.

Reviewed By: jmorse, probinson

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

23 months agoDefine _GNU_SOURCE for arm baremetal in C++ mode.
Manoj Gupta [Tue, 25 Oct 2022 19:29:03 +0000 (12:29 -0700)]
Define _GNU_SOURCE for arm baremetal in C++ mode.

This matches other C++ drivers e.g. Linux that define
_GNU_SOURCE. This lets clang compiler more code by default
without explicitly passing _GNU_SOURCE on command line.

Reviewed By: MaskRay

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

23 months ago[mlir][Arith] Fix folder of CmpIOp to not fail when element type is not integer.
Mahesh Ravishankar [Thu, 3 Nov 2022 20:38:34 +0000 (20:38 +0000)]
[mlir][Arith] Fix folder of CmpIOp to not fail when element type is not integer.

The folder used `cast<IntegerType>`  which would segfault if the type were
a vector type. Handle this case appropriately and avoid failure.

Reviewed By: hanchung

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

23 months ago[mlir][Tensor] Allow builders of `tensor.empty` to accept encoding attribute.
Mahesh Ravishankar [Thu, 3 Nov 2022 20:30:12 +0000 (20:30 +0000)]
[mlir][Tensor] Allow builders of `tensor.empty` to accept encoding attribute.

The `RankedTensorType` can have an optional encoding
attribute. Allowing the builders of `tensor.empty` to accept the
encoding attribute (optionally), allows building empty tensors with
the type having the encoding attribute.

Reviewed By: nicolasvasilache, hanchung, springerm

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

23 months ago[test-release] Build BOLT by default for x86/arm
Rafael Auler [Tue, 1 Nov 2022 21:21:23 +0000 (14:21 -0700)]
[test-release] Build BOLT by default for x86/arm

Make BOLT build by default in X86 and AArch64 Linux boxes.

Reviewed By: thieta, xbolva00

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

23 months agoLink libclangBasic against libatomic when necessary.
Sam James [Wed, 19 Oct 2022 19:12:10 +0000 (20:12 +0100)]
Link libclangBasic against libatomic when necessary.

This is necessary at least on PPC32.

Depends on D136280.

Bug: https://bugs.gentoo.org/874024
Thanks-to: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Tested-by: erhard_f@mailbox.org <erhard_f@mailbox.org>
Differential Revision: https://reviews.llvm.org/D136282

23 months agoLink liblldCOFF against libatomic when necessary
Sam James [Wed, 19 Oct 2022 19:09:34 +0000 (20:09 +0100)]
Link liblldCOFF against libatomic when necessary

Also simplify code for liblldCommon using the new LLVM_ATOMIC_LIB variable.

Depends on D136280.

Bug: https://bugs.gentoo.org/832675
Thanks-to: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Tested-by: erhard_f@mailbox.org <erhard_f@mailbox.org>
Differential Revision: https://reviews.llvm.org/D136281

23 months agoSet LLVM_ATOMIC_LIB variable for convenient linking against libatomic
Sam James [Wed, 19 Oct 2022 18:50:20 +0000 (19:50 +0100)]
Set LLVM_ATOMIC_LIB variable for convenient linking against libatomic

* Set LLVM_ATOMIC_LIB to keep track of when we need to link against libatomic.
* Add detection of mold linker which is required for this.
* Use --as-needed when linking against libatomic as a bonus. On some platforms,
  libatomic may be required only sometimes.

Bug: https://bugs.gentoo.org/832675
Thanks-to: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Tested-by: erhard_f@mailbox.org <erhard_f@mailbox.org>
Differential Revision: https://reviews.llvm.org/D136280

23 months ago[AArch64] Compare BFI and ORR with left-shifted operand for OR instruction selection.
Mingming Liu [Wed, 2 Nov 2022 23:28:49 +0000 (16:28 -0700)]
[AArch64] Compare BFI and ORR with left-shifted operand for OR instruction selection.

Before this patch:
- For `r = or op0, op1`, `tryBitfieldInsertOpFromOr` combines it to BFI when
  1) one of the two operands is bit-field-positioning or bit-field-extraction op; and
  2) bits from the two operands don't overlap

After this patch:
- Right before OR is combined to BFI, evaluates if ORR with left-shifted operand is better.

A motivating example (https://godbolt.org/z/rnMrzs5vn, which is added as a test case in `test_orr_not_bfi` in `CodeGen/AArch64/bitfield-insert.ll`)

For IR:
```
define i64 @test_orr_not_bfxil(i64 %0) {
  %2 = and i64 %0, 127
  %3 = lshr i64 %0, 1
  %4 = and i64 %3, 16256
  %5 = or i64 %4, %2
  ret i64 %5
}
```

Before:
```
   lsr     x8, x0, #1
   and     x8, x8, #0x3f80
   bfxil   x8, x0, #0, #7
```

After:
```
   ubfx x8, x0, #8, #7
   and x9, x0, #0x7f
   orr x0, x9, x8, lsl #7
```

Reviewed By: dmgreen

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

23 months ago[ConstraintElim] Drop bail out for scalable vectors after using getTrue
Florian Hahn [Thu, 3 Nov 2022 19:05:45 +0000 (19:05 +0000)]
[ConstraintElim] Drop bail out for scalable vectors after using getTrue

ConstantInt::getTrue/getFalse can materialize scalable vectors with all
lanes true/false.

23 months ago[flang]Fix build failure in tests
Mats Petersson [Thu, 3 Nov 2022 13:24:13 +0000 (13:24 +0000)]
[flang]Fix build failure in tests

After submitting the DataLayout fix, some tests fail when they didn't
before. This has to do with the target essentially being ignored when
these tests were run earlier, as the --target x86-unknown-linux-gnu
only has to be correctly formed to be accepted.

Now the target triple is actually being used to get the targetmachine
earlier - before MLIR is generated - so the test that has a valid target
but not available on the platform fails.

Fix is to require x86 registered target when running those tests.

Reviewed By: awarzynski

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

23 months agoRevert "[AArch64] Improve codegen for shifted mask op"
Nathan Chancellor [Thu, 3 Nov 2022 18:33:50 +0000 (11:33 -0700)]
Revert "[AArch64] Improve codegen for shifted mask op"

This reverts commit b4e1466c35d3ca3e04244e8e8b4ffaf0784d6d37.

This causes a crash while building the Linux kernel. See the original
Phabricator review for a reduced C and LLVM IR reproducer.

23 months ago[NFC][AArch64]Precommit test for D135102
Mingming Liu [Thu, 3 Nov 2022 17:45:18 +0000 (10:45 -0700)]
[NFC][AArch64]Precommit test for D135102

- Run auto updater for 'trunc-to-tbl.ll' and 'build-pair-isel.ll'
- Add the motivating test of D135102 to 'bitfield-insert.ll'

Reviewed By: fhahn

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

23 months agoHave GetSupportedArchitectures report all supported arches
Jason Molenda [Thu, 3 Nov 2022 17:46:48 +0000 (10:46 -0700)]
Have GetSupportedArchitectures report all supported arches

PlatformDarwinKernel::GetSupportedArchitectures returns a list
of architectures that are possible for this platform; it was using
a compile-time check for the debug host to decide the list of arches
that were valid.  This was copied from a codepath doing native process
debugging, and was clearly wrong for kernel debugging, but it had
not happened to cause problems so it went unnoticed for a long time.

Small NFC change to the logging messages of Target::SetArchitecture
to make them a little more explicit about how the architecture is
being modified/replaced.

Differential Revision: https://reviews.llvm.org/D137301
rdar://101690111

23 months ago[mlir][bufferize] Add filterFn option to BufferResultsToOutParams
Emilio Cota [Thu, 3 Nov 2022 14:47:25 +0000 (10:47 -0400)]
[mlir][bufferize] Add filterFn option to BufferResultsToOutParams

This allows users to restrict the transformation to a
subset of the functions in a module.

For example, a user might want to apply the transformation to
a module's entry point, but not to the calls in the module
because those calls might refer to external C functions outside
of their control.

Reviewed By: springerm, nicolasvasilache
Differential Revision: https://reviews.llvm.org/D137264

23 months agoFixing flang's definition of MLIR_MAIN_SRC_DIR
Renaud-K [Wed, 2 Nov 2022 23:02:04 +0000 (16:02 -0700)]
Fixing flang's definition of MLIR_MAIN_SRC_DIR

23 months agoGlobalISel: Fix artifact combine value finder look through copy
Petar Avramovic [Thu, 3 Nov 2022 16:41:41 +0000 (17:41 +0100)]
GlobalISel: Fix artifact combine value finder look through copy

Search for COPY source in instruction we get from look through (not copy dst).

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

23 months ago[Flang] Run clang-format on all flang files
Peter Steinfeld [Wed, 2 Nov 2022 21:31:14 +0000 (14:31 -0700)]
[Flang] Run clang-format on all flang files

This will make it easier for me to do reviews.

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

23 months ago[mlir][llvmir] Add support for llvm.signext/zeroext function attributes.
Slava Zakharin [Thu, 3 Nov 2022 16:07:44 +0000 (09:07 -0700)]
[mlir][llvmir] Add support for llvm.signext/zeroext function attributes.

This change-set adds basic support for llvm.signext and llvm.zeroext
attributes, and makes sure that the attributes are translated to LLVM IR
when attached to arguments.

This is needed for https://github.com/llvm/llvm-project/issues/58579

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

23 months ago[RISCV][CodeGen] Account for LMUL for Vector Integer Arithmetic Instructions
Michael Maitland [Wed, 26 Oct 2022 01:43:00 +0000 (18:43 -0700)]
[RISCV][CodeGen] Account for LMUL for Vector Integer Arithmetic Instructions

It is likley that subtargets act differently for a vector integer arithmetic instruction based on the LMUL.
This patch creates seperate SchedRead, SchedWrite, WriteRes, ReadAdvance for each relevant LMUL. It also
introduces the concept of an "UpperBound LMUL" which allows us to describe how an instruction should behave
when the LMUL is unknown. All base instructions use the UpperBound resources because they are not tied to
a specific LMUL. This gives subtargetes the flexibility to describe their own upper bounds on each vector
instruction.

I have a series of patches for the rest of the vector instruction set ready to go, but I would like to first
get feedback on the first one of the series (this one).

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

23 months ago[AArch64] Alter arm_fp16.h to be target-based, not preprocessor based.
David Green [Thu, 3 Nov 2022 16:06:35 +0000 (16:06 +0000)]
[AArch64] Alter arm_fp16.h to be target-based, not preprocessor based.

As the other recent patches, this alters the arm_fp16 intrinsics to be
target based, not preprocessor based. Apparently arm_fp16.h is AArch64
only under clang, making this mostly trivial with the TargetGuard
infrastructure.

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

23 months ago[mlir][llvmir] Convert attributes for functions without bodies.
Slava Zakharin [Wed, 2 Nov 2022 19:47:50 +0000 (12:47 -0700)]
[mlir][llvmir] Convert attributes for functions without bodies.

So far the function argument attributes were only translated
for functions with bodies. This change makes sure that this
happens for functions without bodies (declarations) as well.

This is needed for https://github.com/llvm/llvm-project/issues/58579

Reviewed By: ftynse

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

23 months ago[mlir][python] Include anchor op in PassManager constructor
rkayaith [Thu, 20 Oct 2022 05:04:34 +0000 (01:04 -0400)]
[mlir][python] Include anchor op in PassManager constructor

This adds an extra argument for specifying the pass manager's anchor op,
with a default of `any`. Previously the anchor was always defaulted to
`builtin.module`.

Reviewed By: mehdi_amini

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

23 months ago[mlir][python] Include anchor op in PassManager.parse
rkayaith [Thu, 20 Oct 2022 03:36:15 +0000 (23:36 -0400)]
[mlir][python] Include anchor op in PassManager.parse

The pipeline string must now include the pass manager's anchor op. This
makes the parse API properly roundtrip the printed form of a pass
manager.

Reviewed By: mehdi_amini

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

23 months ago[mlir][CAPI] Include anchor op in mlirParsePassPipeline
rkayaith [Thu, 20 Oct 2022 02:37:12 +0000 (22:37 -0400)]
[mlir][CAPI] Include anchor op in mlirParsePassPipeline

The pipeline string must now include the pass manager's anchor op. This
makes the parse API properly roundtrip the printed form of a pass
manager. Since this is already an API break, I also added an extra
callback argument which is used for reporting errors.

The old functionality of appending to an existing pass manager is
available through `mlirOpPassManagerAddPipeline`.

Reviewed By: mehdi_amini, ftynse

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

23 months ago[mlir] Include anchor op in reproducer pipeline string
rkayaith [Wed, 21 Sep 2022 00:20:44 +0000 (20:20 -0400)]
[mlir] Include anchor op in reproducer pipeline string

Including the anchor op ensures that all pass manager settings are fully
specified, and makes the string consistent with the printed form.

Depends on D134622

Reviewed By: rriddle

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

23 months ago[OpenMP][OMPIRBuilder] Migrate createOffloadEntriesAndInfoMetadata from clang to...
Jan Sjodin [Thu, 3 Nov 2022 15:41:21 +0000 (11:41 -0400)]
[OpenMP][OMPIRBuilder] Migrate createOffloadEntriesAndInfoMetadata from clang to OpenMPIRBuilder

Remove unused [this] capture in lambda.

23 months ago[mlir][Pass] Include anchor op in -pass-pipeline
rkayaith [Tue, 18 Oct 2022 18:44:11 +0000 (14:44 -0400)]
[mlir][Pass] Include anchor op in -pass-pipeline

In D134622 the printed form of a pass manager is changed to include the
name of the op that the pass manager is anchored on. This updates the
`-pass-pipeline` argument format to include the anchor op as well, so
that the printed form of a pipeline can be directly passed to
`-pass-pipeline`. In most cases this requires updating
`-pass-pipeline='pipeline'` to
`-pass-pipeline='builtin.module(pipeline)'`.

This also fixes an outdated assert that prevented running a
`PassManager` anchored on `'any'`.

Reviewed By: rriddle

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

23 months ago[AMDGPU] Fix duplicated words in comments
Jay Foad [Thu, 3 Nov 2022 15:33:07 +0000 (15:33 +0000)]
[AMDGPU] Fix duplicated words in comments

23 months ago[AArch64] Add a baseline test for fp16 target intrinsics. NFC
David Green [Thu, 3 Nov 2022 15:18:36 +0000 (15:18 +0000)]
[AArch64] Add a baseline test for fp16 target intrinsics. NFC

23 months ago[LoopVectorize] Fix crash on "Cannot dereference end iterator!"(PR56627)
LiDongjin [Tue, 18 Oct 2022 15:28:34 +0000 (23:28 +0800)]
[LoopVectorize] Fix crash on "Cannot dereference end iterator!"(PR56627)

Check hasOneUser before user_back().

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

23 months ago[InstCombine] Perform memset -> load forwarding
Nikita Popov [Thu, 3 Nov 2022 09:54:16 +0000 (10:54 +0100)]
[InstCombine] Perform memset -> load forwarding

InstCombine does some basic store to load forwarding. One case it
currently misses is the case where the store is actually a memset.
This patch adds support for this case. This is a minimal
implementation that only handles a load at the memset base address,
without an offset.

GVN is already capable of performing this optimization. Having it
in InstCombine can help with phase ordering issues, similar to the
existing store to load forwarding.

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

23 months ago[SimplifyCFG] Add tests for block speculation with assumes (NFC)
Nikita Popov [Thu, 3 Nov 2022 14:46:23 +0000 (15:46 +0100)]
[SimplifyCFG] Add tests for block speculation with assumes (NFC)

23 months ago[XCOFF] change the decoding of External symbol's function auxiliary entry in XCOFF32...
zhijian [Thu, 3 Nov 2022 14:36:44 +0000 (10:36 -0400)]
[XCOFF] change the decoding of External symbol's function auxiliary entry in XCOFF32 for llvm-readobj

Summary:

llvm-readobj decide whether to decode the external symbol's function auxiliary entry based on whether symbol is function or not currently. But the XCOFFSymbolRef::isFunction() do not work properly when -ffunction-sections is enabled. we will not decode the function auxiliary entry based on the XCOFFSymbolRef::isFunction()
we will decode the function auxiliary entry based on following:
According to the https://www.ibm.com/docs/en/aix/7.2?topic=formats-xcoff-object-file-format#XCOFF__c0f91ad419jbau

In XCOFF32, there are only "one csect Auxiliary Entry" and "a function auxiliary symbol table entry" for the C_EXT, C_WEAKEXT, and C_HIDEXT Symbols. and By convention, the csect auxiliary entry in an XCOFF32 file must be the last auxiliary entry for any external symbol that has more than one auxiliary entry( that means for the C_EXT, C_WEAKEXT, and C_HIDEXT Symbols. if there more than one auxiliary Entries. we look the last one as csect auxiliary entry. and others auxiliary entries as function entries).

Reviewers: Hubert Tong, James Henderson
Differential Revision: https://reviews.llvm.org/D136950