11331 Commits

Author SHA1 Message Date
Alex MacLean
36757613b7
[NVVM] Upgrade nvvm.ptr.* intrinics to addrspace cast (#109710)
Remove the following intrinsics which can be trivially replaced with an
`addrspacecast`

  * llvm.nvvm.ptr.gen.to.global
  * llvm.nvvm.ptr.gen.to.shared
  * llvm.nvvm.ptr.gen.to.constant
  * llvm.nvvm.ptr.gen.to.local
  * llvm.nvvm.ptr.global.to.gen
  * llvm.nvvm.ptr.shared.to.gen
  * llvm.nvvm.ptr.constant.to.gen
  * llvm.nvvm.ptr.local.to.gen

Also, cleanup the NVPTX lowering of `addrspacecast` making it more
concise.
2024-09-24 08:15:14 -07:00
Rahul Joshi
66c8dce82e
[TableGen] Add a !listflatten operator to TableGen (#109346)
Add a !listflatten operator that will transform an input list of type
`list<list<X>>` to `list<X>` by concatenating elements of the
constituent lists of the input argument.
2024-09-24 06:01:34 -07:00
David Spickett
029b9b611d [llvm][docs] Improve formatting of ENABLE_PROJECTS/RUNTIMES description
* Add line breaks so it's clear what should be passed to CMake.
* Make the note into an RST note block.
* Fix a couple of markdown style plain text markers.
2024-09-24 13:04:44 +01:00
Scott Egerton
396f677514
[AMDGPU] Remove unused VGPRSingleUseHintInsts feature (#109769) 2024-09-24 10:58:00 +01:00
Alex MacLean
9ac00b85e0
[NVPTX] deprecate nvvm.rotate.* intrinsics, cleanup funnel-shift handling (#107655)
This change deprecates the following intrinsics which can be trivially
converted to llvm funnel-shift intrinsics:

- @llvm.nvvm.rotate.b32
- @llvm.nvvm.rotate.right.b64
- @llvm.nvvm.rotate.b64
2024-09-23 14:58:52 -07:00
Alex MacLean
8be6b108fb
[NVPTX] Remove nvvm.bitcast.* intrinsics (#107936)
Remove the following intrinsics which correspond directly to a bitcast:

- llvm.nvvm.bitcast.f2i
- llvm.nvvm.bitcast.i2f
- llvm.nvvm.bitcast.d2ll
- llvm.nvvm.bitcast.ll2d
2024-09-23 11:24:07 -07:00
Benji Smith
df6855ba57
[C API] Add usub_cond and usub_sat atomic ops to C API (#109532)
These were added in the C++ API in
https://github.com/llvm/llvm-project/pull/105568 but were not exposed
via the C API previously
2024-09-23 09:54:02 +02:00
Michal Rostecki
c320df4a2c
[LLVM-C] Add bindings to Instruction::getDbgRecordRange() (#107802)
Since the migration from `@llvm.dbg.value` intrinsic to `#dbg_value`
records, there is no way to retrieve the debug records for an
`Instruction` in LLVM-C API.

Previously, with debug info intrinsics, retrieving debug info for an
`Instruction` could be done with `LLVMGetNextInstructions`, because the
intrinsic call was also an instruction.

However, to be able to retrieve debug info with the current LLVM, where
debug records are used, the `getDbgRecordRange()` iterator needs to be
exposed.

Add new functions for DbgRecord sequence traversal:
  LLVMGetFirstDbgRecord
  LLVMGetLastDbgRecord
  LLVMGetNextDbgRecord
  LLVMGetPreviousDbgRecord

See llvm/docs/RemoveDIsDebugInfo.md and release notes.
2024-09-20 14:34:42 +01:00
davidtrevelyan
0f488a0b7d
[LLVM][rtsan] Add sanitize_realtime_unsafe attribute (#106754) 2024-09-19 16:45:25 -06:00
Jonas Paulsson
14120227a3
Target ABI: improve call parameters extensions handling (#100757)
For the purpose of verifying proper arguments extensions per the target's ABI,
introduce the NoExt attribute that may be used by a target when neither sign-
or zeroextension is required (e.g. with a struct in register). The purpose of
doing so is to be able to verify that there is always one of these attributes
present and by this detecting cases where sign/zero extension is actually
missing.

As a first step, this patch has the verification step done for the SystemZ
backend only, but left off by default until all known issues have been
addressed.

Other targets/front-ends can now also add NoExt attribute where needed and do
this check in the backend.
2024-09-19 16:59:31 +02:00
Xing Guo
8f3fb5d982
[Doc] Improve documentation for JITLink. (#109163)
This patch improves the documentation for JITLink by fixing some typos,
correcting indentations and fixing out-dated code examples.
2024-09-19 08:39:47 +08:00
Shilei Tian
b334ca6739 [NFC] Remove trailing whitespaces in llvm/docs/LangRef.rst 2024-09-18 10:26:40 -04:00
Jay Foad
8663a75fa2
[AMDGPU] Add link to RDNA 3.5 docs (#108977) 2024-09-17 16:32:27 +01:00
Michael Maitland
ee2add0683
[GISEL] Fix bugs and clarify spec of G_EXTRACT_SUBVECTOR (#108848)
The implementation was missing the fact that `G_EXTRACT_SUBVECTOR`
destination and source vector can be different types.

Also fix a bug in the MIR builder for `G_EXTRACT_SUBVECTOR` to generate
the correct opcode.

Clarify the G_EXTRACT_SUBVECTOR specification.
2024-09-17 10:08:39 -04:00
Sam Elliott
17a3bdb529 [RISCV][docs] Fix List Formatting 2024-09-17 04:50:45 -07:00
Craig Topper
aaa0f4d382
[RISCV][Docs] Remove Zvbb, Zvbc and Zvk* from experimental C intrinsics section of RISCVUsage.rst. NFC (#108718)
These are no longer experimental after
051054e6f74303bc880221e88671745f363964cc. I left the section because we
will be adding intrinsics for Zvkgs and Zvbc32e.
2024-09-16 11:12:09 -07:00
Sam Elliott
f0787edc5e [RISCV][docs] Explain Relaxation Default
As requested in follow-up comments on #108592.
2024-09-16 10:52:25 -07:00
Aaron Ballman
c0719d8c08
[Policy] Replace "code owners" with "maintainers" (#107384)
This replaces the previous Code Owners section of our developer policy
with a new section for Maintainers. It also updates most of the places
we mention "code owner" in the documentation (it does not update the
files named `Code Owners.rst` or similar because those should be updated
when the subprojects add their `Maintainers.rst` file).

The wording was taken from what was proposed in the RFC (including all
suggested amendments from folks on the thread).

Please see the RFC for more details:

https://discourse.llvm.org/t/rfc-proposing-changes-to-the-community-code-ownership-policy/80714/
2024-09-16 13:05:03 -04:00
Sam Elliott
76a85b0e2f
[RISCV][docs] GP Relaxation and Small Data Limit (#108592)
As discussed in this week's RISC-V sync-up, we said we would add
documentation about these options, and how they work.
2024-09-16 15:41:07 +01:00
Anton Sidorenko
dbdf84388a
[RISCV] Add Syntacore SCR7 processor definition (#108406)
Syntacore SCR7 is a high-performance Linux-capable RISC-V processor
core.
The core has rv64imafdcv_zba_zbb_zbc_zbs_zkn march.
Overview: https://syntacore.com/products/scr7

Scheduling model will be added in a subsequent PR.

---------

Co-authored-by: Dmitrii Petrov <dmitrii.petrov@syntacore.com>
Co-authored-by: Anton Afanasyev <anton.afanasyev@syntacore.com>
Co-authored-by: Elena Lepilkina <elena.lepilkina@syntacore.com>
2024-09-16 13:09:37 +03:00
David Green
feac761f37
[GlobalISel][AArch64] Add G_FPTOSI_SAT/G_FPTOUI_SAT (#96297)
This is an implementation of the saturating fp to int conversions for
GlobalISel. On AArch64 the converstion instrctions work this way,
producing saturating results. LegalizerHelper::lowerFPTOINT_SAT is
ported from SDAG.

AArch64 has a lot of existing tests for fptosi_sat, covering a wide
range of types. I have tried to make most of them work all at once, but
a few fall back due to other missing features such as f128 handling for
min/max.
2024-09-16 10:33:59 +01:00
Craig Topper
55ec015c4d [RISCV][Docs] Correct vector crypto note link spelling. NFC 2024-09-14 05:41:38 -07:00
Craig Topper
c6c3803b72
[RISCV] Add documentation that Zvbc and Zvk* are supported through intrinsics. NFC (#108577) 2024-09-13 16:31:44 -07:00
Craig Topper
1fc3ca1a12
[RISCV] Add Zvfhmin to RISCVUsage.rst. NFC (#108574) 2024-09-13 11:39:39 -07:00
Craig Topper
8e2843b471
[RISCV][Docs] Change Zvbb and Zvkb from 'Assembly Support' to Supported. NFC (#108572)
We have generic isel support for Zvkb and Zvbb.
2024-09-13 09:29:31 -07:00
Justin Bogner
34e20f18f0
[DirectX] Implement typedBufferLoad_checkbit (#108087)
This represents a typedBufferLoad that's followed by
"CheckAccessFullyMapped". It returns an extra `i1` representing that
value.

Fixes #108085
2024-09-11 16:24:38 -07:00
Alex Bradbury
596e7ccd30
[RISCV][doc] Add note to RISCVUsage about supported atomics ABIs (#103879)
I've tried to avoid giving too much detailed explanation as the psABI docs are the
better source for this.
2024-09-11 10:04:56 +01:00
Reid Kleckner
829ea59dda
[docs] Add a section on AI-generated content to the developer policy (#91014)
Governments around the world are starting to require labelling for
AI-generated content, and some LLVM stakeholders have asked if LLVM
contains AI-generated content. Defining a policy on the use of AI tools
allows us to answer that question affirmatively, one way of the other.

The policy proposed here allows the use of AI tools in LLVM
contributions, flowing from the idea that any contribution is fine
regardless of how it is made, as long as the contributor has the right
to license it under the project license.

I gathered input from the community in this RFC and incorporated it into the policy:
https://discourse.llvm.org/t/rfc-define-policy-on-ai-tool-usage-in-contributions/78758
2024-09-10 16:21:01 -07:00
Justin Bogner
90e841131a
[DirectX] Lower @llvm.dx.typedBufferStore to DXIL ops
The `@llvm.dx.typedBufferStore` intrinsic is lowered to `@dx.op.bufferStore`.

Pull Request: https://github.com/llvm/llvm-project/pull/104253
2024-09-10 10:33:57 -07:00
MichelleCDjunaidi
edbe8faba1
[llvm][Docs] Update guide to include `pip install lit` (#106526)
Also updates and clarifies which version would be installed.

As per
https://discourse.llvm.org/t/information-on-lit-is-outdated/76498.
2024-09-10 10:13:04 +01:00
Thorsten Schütt
bece0d7517
[GlobalIsel] Update MIR gallery (#107903)
add more patterns
clarify wip_match_opcode usage
2024-09-10 09:04:54 +02:00
Justin Bogner
3f22756f39
[DirectX] Lower @llvm.dx.typedBufferLoad to DXIL ops
The `@llvm.dx.typedBufferLoad` intrinsic is lowered to `@dx.op.bufferLoad`.
There's some complexity here in translating to scalarized IR, which I've
abstracted out into a function that should be useful for samples, gathers, and
CBuffer loads.

I've also updated the DXILResources.rst docs to match what I'm doing here and
the proposal in llvm/wg-hlsl#59. I've removed the content about stores and raw
buffers for now with the expectation that it will be added along with the work.

Note that this change includes a bit of a hack in how it deals with
`getOverloadKind` for the `dx.ResRet` types - we need to adjust how we deal
with operation overloads to generate a table directly rather than proxy through
the OverloadKind enum, but that's left for a later change here.

Part of #91367

Pull Request: https://github.com/llvm/llvm-project/pull/104252
2024-09-09 13:21:22 -07:00
Pierre van Houtryve
eaac4a2613
[AMDGPU] Document & Finalize GFX12 Memory Model (#98599)
Documents the memory model implemented as of #98591, with some
fixes/optimizations to the implementation.
2024-09-09 15:35:28 +02:00
Yuxuan Chen
234cc81625
[LLVM][Coroutines] Create .noalloc variant of switch ABI coroutine ramp functions during CoroSplit (#99283)
This patch is episode two of the coroutine HALO improvement project
published on discourse:
https://discourse.llvm.org/t/language-extension-for-better-more-deterministic-halo-for-c-coroutines/80044

Previously CoroElide depends on inlining, and its analysis does not work
very well with code generated by the C++ frontend due the existence of
many customization points. There has been issue reported to upstream how
ineffective the original CoroElide was in real world applications.

For C++ users, this set of patches aim to fix this problem by providing
library authors and users deterministic HALO behaviour for some
well-behaved coroutine `Task` types. The stack begins with a library
side attribute on the `Task` class that guarantees no unstructured
concurrency when coroutines are awaited directly with `co_await`ed as a
prvalue. This attribute on Task types gives us lifetime guarantees and
makes C++ FE capable to telling the ME which coroutine calls are
elidable. We convey such information from FE through the attribute
`coro_elide_safe`.

This patch modifies CoroSplit to create a variant of the coroutine ramp
function that 1) does not use heap allocated frame, instead take an
additional parameter as the pointer to the frame. Such parameter is
attributed with `dereferenceble` and `align` to convey size and align
requirements for the frame. 2) always stores cleanup instead of destroy
address for `coro.destroy()` actions.

In a later patch, we will have a new pass that runs right after
CoroSplit to find usages of the callee coroutine attributed
`coro_elide_safe` in presplit coroutine callers, allocates the frame on
its "stack", transform those usages to call the `noalloc` ramp function
variant.

(note I put quotes on the word "stack" here, because for presplit
coroutine, any alloca will be spilled into the frame when it's being
split)

The C++ Frontend attribute implementation that works with this change
can be found at https://github.com/llvm/llvm-project/pull/99282
The pass that makes use of the new `noalloc` split can be found at
https://github.com/llvm/llvm-project/pull/99285
2024-09-08 23:09:20 -07:00
Shan Huang
ac93554462
Refine the examples in the debug info document (#86272)
This PR modifies the examples of section "When to merge instruction
locations" in
[HowToUpdateDebugInfo](https://llvm.org/docs/HowToUpdateDebugInfo.html)
according to [the
discussion](https://discourse.llvm.org/t/debuginfo-merging-instruction-locations-of-hoisted-instructions/77357),
revise one misleading counterexample and refining the description of
hoisting identical instructions.
2024-09-09 13:49:38 +08:00
gulfemsavrun
787cd8f0fe
[InstrProf] Add debuginfod correlation support (#106606)
This patch adds debuginfod support into llvm-profdata to
find the assosicated executable by a build id in a raw
profile to correlate a profile with a provided correlation
kind (debug-info or binary).
2024-09-06 13:28:23 -07:00
anjenner
4af249fe6e
Add usub_cond and usub_sat operations to atomicrmw (#105568)
These both perform conditional subtraction, returning the minuend and
zero respectively, if the difference is negative.
2024-09-06 16:19:20 +01:00
Nabeel Omer
fb6c10da1f
[MC] Emit a jump table size section (#101962)
This patch will make LLVM emit a new section .llvm_jump_table_sizes 
containing tuples of (jump table address, entry count) in object files.
This section is useful for tools that need to statically reconstruct the
control flow of executables.

At the moment this is only enabled by default for the PS5 target.
2024-09-06 13:41:36 +01:00
SpencerAbson
1f70fcefa9
[Clang][AArch64] Add customisable immediate range checking to NEON (#100278)
This patch moves NEON immediate argument specification and checking to
the system currently shared by both SVE and SME.

In its current form, the TableGen definition of a NEON intrinsic cannot
control how its immediate arguments are range-checked, this information
must be inferred from the name of the intrinsic by NeonEmitter, which
also assumes that any NEON instruction will only ever receive a single
immediate argument. For SVE/SME instrinsics, this information is more
conveniently supplied in the TableGen definition.

As a result, for each immediate argument, NEON instructions must define
- The index of the immediate argument to be checked
- The type of immediate range check to be performed,
    (e.g., ImmCheckShiftRight)
- The index of the argument whose type defines the context
    of this immediate check (base type, vector size).
- **Difference from SVE/SME** If this definition generates a polymorphic
NEON builtin, the base type defined by this argument is overwritten by
that of the type code supplied to the overloaded builtin call. This
third argument is omitted in some cases due to this.

Here is an example for
[`vfma_laneq`](https://developer.arm.com/architectures/instruction-sets/intrinsics/#f:@navigationhierarchiessimdisa=[Neon]&q=vfma_laneq)
- The immediate is supplied in argument 3
- The immediate is used as an index into the lanes of argument 2
- So we must perform an immediate check on argument 3, based on the type
information of argument 2.
- `ImmCheck<3, ImmCheckLaneIndex, 2>`

During this work, we discovered that the existing immediate
range-checking system was largely untested, which made it difficult to
make reliable progress. Missing tests have been added to verify this
implementation against all intrinsics which take constrained immediate
arguments. All test immediate range checking tests for NEON intrinsics
are moved to a dedicated directory
`clang/test/Sema/aarch64-neon-immediate-ranges/`.
2024-09-06 13:12:37 +01:00
Scott Linder
9171881d64 [AMDGPU][Docs] DWARF aspace-aware base types (post-review fixes) 2024-09-04 22:19:25 +00:00
Aarni Koskela
df5840f9f0
[AMDGPU][Docs] Update product names for some targets (#106973)
Based on
https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html#supported-gpus.
2024-09-04 16:58:17 +04:00
Scott Linder
18cf14efe3 [Docs] Use cacheable myst_heading_slug_func value
Avoid creating an uncacheable conf variable by using a string instead of
a function reference. Also has the effect of avoiding triggering the
"config.cache" sphinx warning.

Requires myst_parser 0.19.0 (specifically
https://github.com/executablebooks/MyST-Parser/pull/696) which is over a
year old by now. Do we mandate any minimum version for these
dependencies?
2024-09-03 22:05:03 +00:00
Orlando Cazalet-Hyams
b6a4ab5a12
[NFC] Fix #106873 - update assignment tracking docs (#106959) 2024-09-02 14:57:59 +01:00
Tom Stellard
ec58817537
docs: Clarify commit access requirements in the Developer Policy (#101414)
We have been discussing changes to our commit access polices recently
and based on some feedback from clattner here:

https://discourse.llvm.org/t/rfc-new-criteria-for-commit-access/76290/81

We need to update our Developer Policy so that it matches what we are
actually doing in this project. We currently grant commit access to
anyone with a valid justification, not just contributors who have
submitted high-quality patches in the past.

---------

Co-authored-by: Shilei Tian <i@tianshilei.me>
2024-08-31 13:04:09 -07:00
Paul T Robinson
1faa9c8a02
[Security] Nominate Matthew Voss to replace Paul Robinson on the Secu… (#106112)
…rity Group

Matthew is a member of Sony's PS4/PS5 toolchain team, most visible for
his work on LTO, but he also has a long-standing interest in security.
He will replace Paul as one of Sony's participants in the Security Group
as Paul will be retiring from Sony at the end of September.
2024-08-30 12:08:47 -04:00
Chris Apple
fef3426ad3
Revert "[LLVM][rtsan] Add LLVM nosanitize_realtime attribute (#105447)" (#106743)
This reverts commit 178fc4779ece31392a2cd01472b0279e50b3a199.

This attribute was not needed now that we are using the lsan style
ScopedDisabler for disabling this sanitizer

See #106736 
#106125 

For more discussion
2024-08-30 07:48:31 -07:00
Sjoerd Meijer
c4a53811c1
[test-suite] Document the LLVM test-suite benchmark apps (#105843)
There is no documentation or description of the different apps in the
LLVM benchmark test-suite and this is a first attempt to document this
for the MultiSource apps.
2024-08-30 15:36:47 +01:00
Stephen Tozer
3d08ade7bd
[ExtendLifetimes] Implement llvm.fake.use to extend variable lifetimes (#86149)
This patch is part of a set of patches that add an `-fextend-lifetimes`
flag to clang, which extends the lifetimes of local variables and
parameters for improved debuggability. In addition to that flag, the
patch series adds a pragma to selectively disable `-fextend-lifetimes`,
and an `-fextend-this-ptr` flag which functions as `-fextend-lifetimes`
for this pointers only. All changes and tests in these patches were
written by Wolfgang Pieb (@wolfy1961), while Stephen Tozer (@SLTozer)
has handled review and merging. The extend lifetimes flag is intended to
eventually be set on by `-Og`, as discussed in the RFC
here:

https://discourse.llvm.org/t/rfc-redefine-og-o1-and-add-a-new-level-of-og/72850

This patch implements a new intrinsic instruction in LLVM,
`llvm.fake.use` in IR and `FAKE_USE` in MIR, that takes a single operand
and has no effect other than "using" its operand, to ensure that its
operand remains live until after the fake use. This patch does not emit
fake uses anywhere; the next patch in this sequence causes them to be
emitted from the clang frontend, such that for each variable (or this) a
fake.use operand is inserted at the end of that variable's scope, using
that variable's value. This patch covers everything post-frontend, which
is largely just the basic plumbing for a new intrinsic/instruction,
along with a few steps to preserve the fake uses through optimizations
(such as moving them ahead of a tail call or translating them through
SROA).

Co-authored-by: Stephen Tozer <stephen.tozer@sony.com>
2024-08-29 17:53:32 +01:00
cor3ntin
0a484820e1
Restore missing link in CodeOfConduct.rst (#106385)
Link restored from the original policy outlined here
https://discourse.llvm.org/t/code-of-conduct-changes-related-to-llvm-project-policy-changes/64197
2024-08-29 14:15:49 +02:00
VisdaVokhshoori
f9ee9f5b39
[llvm][Docs] Update TestSuiteGuide.md (#79613)
Update svn to git & virtualenv to venv
2024-08-29 09:28:13 +01:00