11540 Commits

Author SHA1 Message Date
Steffen Larsen
f04bfbc416
[SPIRV] Support for SPV_INTEL_ternary_bitwise_function (#134866)
Adds support for the SPV_INTEL_ternary_bitwise_function extension,
adding;
* the OpBitwiseFunctionINTEL SPIR-V instruction, a ternary bitwise
function where the operation performed is determined by a look-up table
index,
 * and the corresponding TernaryBitwiseFunctionINTEL capability.

See
https://github.khronos.org/SPIRV-Registry/extensions/INTEL/SPV_INTEL_ternary_bitwise_function.html.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
2025-04-09 10:02:43 +02:00
Fangrui Song
02b377d8f7
[llc] Add -M for InstPrinter options
For many targets, llvm-objdump and llvm-mc
(https://reviews.llvm.org/D103004) support -M no-aliases (e.g.
`RISCVInstPrinter::applyTargetSpecificCLOption`).

This patch implements -M for llc.

While here, rename "DisassemblerOptions" in llvm-mc to the more
appropriate "InstPrinterOptions". For llvm-mc --assemble, there is no
disassembler involved.

Pull Request: https://github.com/llvm/llvm-project/pull/121078
2025-04-08 19:34:03 -07:00
Michael Kruse
8b11c39a0f
[llvm-mt] Do not build llvm-mt if not functional (#134631)
llvm-mt requires libxml2 to work, so do not even build it without
libxml2.

CMake 3.31 and later prefer llvm-mt.exe over Microsoft's mt.exe if
available and using clang-cl.exe as CMAKE_CXX_COMPILER. When CMake picks
up llvm-mt.exe without libxml2, any build will fail with the message
```
llvm-mt: error: no libxml2
```

Any test except `--help` already uses `REQUIRES: libxml2`. There is no
point in having a non-functional executable. Not building llvm-mt.exe
will force CMake to use Microsoft's `mt.exe` instead.

Fixes: #134237
2025-04-08 16:16:53 +02:00
Nikita Popov
03f21e2ba3
[LangRef] Update initializes definition (#134370)
Specify the initializes attribute in terms of an "initialized" shadow
state, such that:

* Loads prior to initialization return poison.
* Bytes that are not explicitly initialized are written with undef on
function return.

This is intended to preserve the core semantics of the attribute, but
adjusts the wording in a way that is compatible with existing
optimizations, such as insertion of spurious loads and removal of
uninitialized writes.

Fixes https://github.com/llvm/llvm-project/issues/133038.
Fixes https://github.com/llvm/llvm-project/issues/133059.
2025-04-08 09:30:44 +02:00
Shafik Yaghmour
d4c16424cf
[LLVM][Demangle] Fix MS Demangler to be stricter about wide string literals (#134483)
Static analysis detected that Demangler::demangleStringLiteral had a
potential overflow if not checking StringByteSize properly.

Added check to ensure that for wide string it is always even and that
there were the byte count did not mismatch the actual size of the
literal.

Fixes: https://github.com/llvm/llvm-project/issues/129970
2025-04-07 13:18:53 -07:00
David Spickett
b09daa4b23
[llvm][docs] 2 small fixes to GitHub guide (#134620)
1. `arc` is long gone, no need to mention it.
2. Say exactly where user branches can be made.
2025-04-07 16:39:04 +01:00
Andrzej Warzyński
c9157d4692
[llvm][docs] Reorder sections in GitHub.rst (#134212)
Reorder sections in GitHub.rst so that "Branches" and "Stacked Pull
Requests" appear after the more general section on pull requests. This
improves the conceptual flow for readers new to the process:

New order:
  * Introduction
  * Before your first PR
  * Pull Requests
  * Approvals
  * Landing your change
  * Branches
  * Stacked Pull Requests
  * ...

Previous order:
  * Introduction
  * Before your first PR
  * Branches
  * Stacked Pull Requests
  * Pull Requests
  * Approvals
  * Landing your change
  * ...

This change only reorders existing text - no content edits.
2025-04-07 11:36:55 +01:00
Sergei Barannikov
eb70253fcb
[LangRef/DataLayout] Spell out requirements for alignment values (#104705)
For 'p' the added wording matches the implementation.

For 'i', 'f', 'v' the implementation also allows 0 for `<pref>`
component, making 'i16:16:0' valid, for example. 'Fi0', 'Fn0' and 'S0'
are also currently accepted. This is likely unintentional. There are no
tests in the codebase that rely on this behavior, so the added wording
prohibits zero alignments for these specifications.

For 'a', the implementation currently allows 0 for both `<abi>` and
`<pref>` components. The added wording prohibits specifying zero for
`<pref>` with the same justification as above. Zero `<abi>` is used in
tests, and the example at the end of the section suggests that this is
valid, so that's left unchanged.

This effectively prohibits zero alignments everywhere except for the
`<abi>` component of aggregate specification.
2025-04-06 20:08:52 +03:00
Snehasish Kumar
f9193f3b18
[DebugInfo] Preserve line and column number when merging debug info. (#129960)
This patch introduces a new option `-preserve-merged-debug-info` to
preserve an arbitrary but deterministic version of debug information
when DILocations are merged. This is intended to be used in production
environments from which sample based profiles are derived such as
AutoFDO and MemProf.

With this patch we have see a 0.2% improvement on an internal workload
at Google when generating AutoFDO profiles. It also significantly
improves the ability for MemProf by preserving debug info for merged
call instructions used in the contextual profile.

---------

Co-authored-by: Krzysztof Pszeniczny <kpszeniczny@google.com>
2025-04-04 09:37:25 -07:00
Nikita Popov
ecd4c0857b
[Verifier] Require that dbg.declare variable is a ptr (#134355)
As far as I understand, the first operand of dbg_declare should be a
pointer (inside a metadata wrapper). However, using a non-pointer is
currently not rejected, and we have some tests that use non-pointer
types. As far as I can tell, these tests either meant to use dbg_value
or are just incorrect hand-crafted tests.

Ran into this while trying to `fix` #134008.
2025-04-04 15:34:45 +02:00
Steven Perron
a77d807781
[SPIRV] Add spirv.VulkanBuffer types to the backend (#133475)
Adds code to expand the `llvm.spv.resource.handlefrombinding` and
`llvm.spv.resource.getpointer` when the resource type is
`spirv.VulkanBuffer`.

It gets expanded as a storage buffer or uniform buffer denpending on the
storage class used.

This is implementing part of

https://github.com/llvm/wg-hlsl/blob/main/proposals/0018-spirv-resource-representation.md.
2025-04-03 09:44:07 -04:00
Chris B
81601cf3ab
[Docs] Clarify that reassoc isn't just for reassociation (#133168)
The `reassoc` fast-math flag allows a much wider array of algebraic
transformations than just strictly reassociations. In some cases it does
commutations, distributions, and folds away redundant inverse
operations...

While it might make sense to fix the flag naming at some point, in the
meantime we should at least have the docs be accurate to avoid
confusion.
2025-04-02 16:43:10 -05:00
Matt Arsenault
efca37fda5
llvm-reduce: Change exit code for uninteresting inputs (#134021)
This makes it easier to reduce llvm-reduce with llvm-reduce to filter
cases where the input reduced too much.

Not sure if it's possible to test the exit code in lit.
2025-04-02 23:43:06 +07:00
Andrzej Warzyński
7dce16a0e5
[docs][GitHub] Update docs for stacked PRs (#132424) 2025-04-02 17:00:49 +01:00
Jeremy Morse
1ebc308bba
[DebugInfo][RemoveDIs] Remove debug-intrinsic printing cmdline options (#131855)
During the transition from debug intrinsics to debug records, we used
several different command line options to customise handling: the
printing of debug records to bitcode and textual could be independent of
how the debug-info was represented inside a module, whether the
autoupgrader ran could be customised. This was all valuable during
development, but now that totally removing debug intrinsics is coming
up, this patch removes those options in favour of a single flag
(experimental-debuginfo-iterators), which enables autoupgrade, in-memory
debug records, and debug record printing to bitcode and textual IR.

We need to do this ahead of removing the
experimental-debuginfo-iterators flag, to reduce the amount of
test-juggling that happens at that time.

There are quite a number of weird test behaviours related to this --
some of which I simply delete in this commit. Things like
print-non-instruction-debug-info.ll , the test suite now checks for
debug records in all tests, and we don't want to check we can print as
intrinsics. Or the update_test_checks tests -- these are duplicated with
write-experimental-debuginfo=false to ensure file writing for intrinsics
is correct, but that's something we're imminently going to delete.

A short survey of curious test changes:
* free-intrinsics.ll: we don't need to test that debug-info is a zero
cost intrinsic, because we won't be using intrinsics in the future.
* undef-dbg-val.ll: apparently we pinned this to non-RemoveDIs in-memory
mode while we sorted something out; it works now either way.
* salvage-cast-debug-info.ll: was testing intrinsics-in-memory get
salvaged, isn't necessary now
* localize-constexpr-debuginfo.ll: was producing "dead metadata"
intrinsics for optimised-out variable values, dbg-records takes the
(correct) representation of poison/undef as an operand. Looks like we
didn't update this in the past to avoid spurious test differences.
* Transforms/Scalarizer/dbginfo.ll: this test was explicitly testing
that debug-info affected codegen, and we deferred updating the tests
until now. This is just one of those silent gnochange issues that get
fixed by RemoveDIs.

Finally: I've added a bitcode test, dbg-intrinsics-autoupgrade.ll.bc,
that checks we can autoupgrade debug intrinsics that are in bitcode into
the new debug records.
2025-04-01 14:27:11 +01:00
Mirko Brkušanin
ba7feaab92
[AMDGPU][Docs] Fix and update AMDGPUUsage.rst (#133894)
- Fix notes about SALU float and src1 SGPRs for dpp instructions
- Add split between gfx11 and gfx12 sections, update references.
2025-04-01 13:59:42 +02:00
David Spickett
7581cb68f9
[lldb] Remove lldb-server min and max gdbserver port options (#133275)
Since lldb 20, these have had no effect:
https://releases.llvm.org/20.1.0/docs/ReleaseNotes.html#changes-to-lldb

> lldb-server now listens to a single port for gdbserver connections and
> provides that port to the connection handler processes. This means
that
> only 2 ports need to be opened in the firewall (one for the
lldb-server
> platform, one for gdbserver connections). In addition, due to this
work,
lldb-server now works on Windows in the server mode.

Remove them.
2025-04-01 10:05:11 +01:00
AnastasiyaChernikova
5a3079421b
Add RISC-V support information to readme (#132699) 2025-03-31 22:13:46 +03:00
Tom Tromey
68947342b7
Add support for fixed-point types (#129596)
This adds DWARF generation for fixed-point types. This feature is needed
by Ada.

Note that a pre-existing GNU extension is used in one case. This has
been emitted by GCC for years, and is needed because standard DWARF is
otherwise incapable of representing these types.
2025-03-31 07:42:21 -07:00
Tim Gymnich
1d0005a69a
[GlobalISel][NFC] Rename GISelKnownBits to GISelValueTracking (#133466)
- rename `GISelKnownBits` to `GISelValueTracking` to analyze more than
just `KnownBits` in the future
2025-03-29 11:51:29 +01:00
Marco Elver
fa5025b760
[LangRef] Add entry for pcsections Metadata (#133423)
Add an entry for pcsections Metadata that references the PC Sections
Metadata document.

Fixes: https://github.com/llvm/llvm-project/issues/130552
2025-03-29 09:36:59 +01:00
vporpo
31fe0d20fc
[SandboxVec][Doc] Add documentation for the Sandbox Vectorizer (#133504) 2025-03-28 21:20:01 -07:00
quic_hchandel
edef028029
[RISCV] Add Qualcomm uC Xqciio (External Input Output) extension (#132721)
This extension adds two external input output instructions for
non-memory-mapped device.

The current spec can be found at:
https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.7.0

This patch adds assembler only support.

Co-authored-by: Sudharsan Veeravalli <quic_svs@quicinc.com>
2025-03-28 19:47:29 -07:00
Matt Arsenault
8c18c25b1b
llvm-reduce: Do not assert if the input is no longer interesting (#133386)
If the interestingness script is flaky, we should not assert. Print
a warning, and continue. This could still happen as a result of an
llvm-reduce bug, so make a note of that.

Add a --skip-verify-interesting-after-counting-chunks option to
avoid the extra run of the reduction script, and to silence the
warning.
2025-03-29 07:44:20 +07:00
Min-Yih Hsu
5a073f1f3a
[doc][IR] Add documentation for llvm.vector.(de)interleave3/5/7 (#133519)
I put the documentation of all factors into the same (de)interleave
entries because I really don't see a reason to separate them in an
already long LangRef page.
2025-03-28 15:17:36 -07:00
Jonas Devlieghere
ea8573aca5
[lldb] Add statusline to the release notes (#133281)
Add a release note for the LLDB statusline: #121860
2025-03-28 09:16:55 -07:00
Andras Gemes
579379cf7f
[Nomination] Add HighTec representatives to the Security Group (#124142)
I would like to nominate Mario Cupelli (@mariocup) and myself to join
the LLVM Security Group as representatives (vendor contacts) of [HighTec
EDV Systeme](https://github.com/hightec-rt).

Mario is the CTO of HighTec and has a strong background in compiler
safety qualification. I am a SW engineer with a focus on cybersecurity
and a goal to contribute to the LLVM Security Group.

HighTec collaborates with major silicon vendors and offers
safety-qualified C/C++ and Rust compilers based on LLVM. Our active
contributions to LLVM include work on the linker and various patches and
we are committed to further improving LLVM’s security.

Our motivation for joining the LLVM Security Group is to collaborate
with LLVM security experts, stay informed about the latest CVEs in LLVM
and meet the cybersecurity requirements of the automotive industry.
2025-03-28 14:02:57 +00:00
Pengcheng Wang
883612859b
[TableGen] Add !instances operator to get defined records (#129680)
The format is: `!instances<T>([regex])`.
    
This operator produces a list of records whose type is `T`. If
`regex` is provided, only records whose name matches the regular
expression `regex` will be included. The format of `regex` is ERE
(Extended POSIX Regular Expressions).
2025-03-28 16:31:00 +08:00
Luke Lau
cc30fbacec
[Docs][RISCV] Update RISCVVectorExtension.rst to reflect RISCVVMV0Elimination. NFC (#133058)
Also correct the old name of RISCVFoldMasks to RISCVVectorPeephole
2025-03-27 06:24:35 +02:00
Sam Elliott
6a371c7744
[RISCV] Support .option {no}exact (#122483)
This implements [the `.option exact` and `.option noexact`
proposal](https://github.com/riscv-non-isa/riscv-asm-manual/pull/122)
for RISC-V.

`.option exact` turns off:
- Compression
- Branch Relaxation
- Linker Relaxation

`.option noexact` turns these back on, and is also the default, matching
the current behaviour.
2025-03-26 11:14:16 -07:00
Ryotaro Kasuga
29ca03f19a
[Docs] Fix link in LoopTerminology (NFC) (#131138)
The link should refer to the section of 'phi' Instruction in the
LangRef, but it referred to the subsection of 'fcmp' Instruction.
Replace it with appropriate one.
2025-03-26 17:59:38 +09:00
Tom Tromey
f89129af8a
Add bit stride to DICompositeType (#131680)
In Ada, an array can be packed and the elements can take less space than
their natural object size. For example, for this type:

   type Packed_Array is array (4 .. 8) of Boolean;
   pragma pack (Packed_Array);

... each element of the array occupies a single bit, even though the
"natural" size for a Boolean in memory is a byte.

In DWARF, this is represented by putting a DW_AT_bit_stride onto the
array type itself.

This patch adds a bit stride to DICompositeType so that gnat-llvm can
emit DWARF for these sorts of arrays.
2025-03-25 17:14:07 -07:00
Julien Villette
f4bb9b53ad
[MCA] Extend -instruction-tables option with verbosity levels (#130574)
Option becomes: -instruction-tables=`<level>`
 
The choice of `<level>` controls number of printed information.
`<level>` may be `none` (default), `normal`, `full`.
Note: If the option is used without `<label>`, default is `normal`
(legacy).

When `<level>` is `full`, additional information are:
- `<Bypass Latency>`: Latency when a bypass is implemented between
operands
  in pipelines (see SchedReadAdvance).
  - `<LLVM Opcode Name>`: mnemonic plus operands identifier.
  - `<Resources units>`: Used resources associated with LLVM Opcode.
- `<instruction comment>`: reports comment if any from source assembly.

Level `full` can be used to better check scheduling info when TableGen
is modified.
LLVM Opcode name help to find right instruction regexp to fix TableGen
Scheduling Info.

-instruction-tables=full option is validated on
AArch64/Neoverse/V1-sve-instructions.s

Follow up of MR #126703

---------

Co-authored-by: Julien Villette <julien.villette@sipearl.com>
2025-03-25 09:19:57 -07:00
Sam Elliott
629ff2d7ba
[RISCV][Xqcili] Implement Load Immediate Support (#132496)
This is required to support `li`, but the code is also shared with
CodeGen so the compiler will now emit instructions from Xqcili when that
extension is enabled during compilation.

Also implemented some missed verifiers in
`RISCVInstrInfo::verifyInstruction`, some of which are required for this
change.
2025-03-25 07:59:44 -07:00
Juan Manuel Martinez Caamaño
db33978c46
[AMDGPU][GFX11] buffer_load_lds_{size} instructions do not exist (#132916)
According to the shader manual there are not buffer load lds
instructions of gfx11.

The tests for the regular `buffer_load ... lds` instructions for gfx11
are already present in AMDGPU/gfx11_asm_mubuf.s, where the compiler
fails to encode the instructions for this target.
2025-03-25 15:24:06 +01:00
Sam Elliott
4fb9650b21 [clang][docs] Release Note for RISC-V qci-(no)nest
These were omitted from the original PR (#129957)
2025-03-24 13:04:00 -07:00
Peter Collingbourne
11044de3dc Reapply "lit: Move RUN at line comment after the command."
This reverts commit 57e89c97c2c1b4e41f07a90c2f4d36649696e619.

Updated lit tests.
2025-03-24 12:01:49 -07:00
Peter Collingbourne
57e89c97c2 Revert "lit: Move RUN at line comment after the command."
This reverts commit 8d3dc1ed5656a3e69e4195d58684a7f4bf0ff5cc.

Test needs to be updated.
2025-03-24 11:47:56 -07:00
Peter Collingbourne
8d3dc1ed56
lit: Move RUN at line comment after the command.
When a developer copy/pastes a failing command line into their
shell to rerun it, they have to manually delete the "RUN: at line
N:" prefix. To make life easier for such developers, let's make it
possible to copy/paste a command without needing to modify it while
still showing the line number in the output by moving the line number
to a comment at the end of the command line.

Reviewers: jroelofs, MaskRay

Reviewed By: jroelofs, MaskRay

Pull Request: https://github.com/llvm/llvm-project/pull/132485
2025-03-24 11:29:57 -07:00
Sudharsan Veeravalli
e7107973b8
Recommit "[RISCV] Add Qualcomm uC Xqcisync (Sync Delay) extension (#132184)" (#132520)
With a minor fix for the build failures.

Original message:

This extension adds nine instructions, eight for non-memory-mapped devices synchronization and delay instruction.

The current spec can be found at:
https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.7.0

This patch adds assembler only support.

Co-authored-by: Sudharsan Veeravalli quic_svs@quicinc.com
2025-03-22 11:07:48 +05:30
Kazu Hirata
fe7776eab8 Revert "[RISCV] Add Qualcomm uC Xqcisync (Sync Delay) extension (#132184)"
This reverts commit 3840f787a21a66686f5d8bf61877d41f3a65f205.

Multiple builtbot failures have been reported:
https://github.com/llvm/llvm-project/pull/132184
2025-03-21 20:28:11 -07:00
quic_hchandel
3840f787a2
[RISCV] Add Qualcomm uC Xqcisync (Sync Delay) extension (#132184)
This extension adds nine instructions, eight for non-memory-mapped
devices synchronization and delay instruction.

The current spec can be found at:
https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.7.0

This patch adds assembler only support.

Co-authored-by: Sudharsan Veeravalli <quic_svs@quicinc.com>
2025-03-22 07:57:07 +05:30
Alexey Karyakin
c0b2c10e9f
[hexagon] Bump the default version to v68 (#132304)
Set the default processor version to v68 when the user does not specify
one in the command line. This includes changes in the LLVM backed and
linker (lld). Since lld normally sets the version based on inputs, this
change will only affect cases when there are no inputs.

Fixes #127558
2025-03-21 20:08:45 -05:00
Reid Kleckner
5b09079374
Minor developer policy edits for clarity (#132313)
There should be no substantial policy change here.

I reordered the breaking change docs after the major change docs, since
that flow made sense to me. I smoothed out some of the incremental
development policy wording to be a bit less black and white, and talk
about "preferred" and "discouraged" approaches.
2025-03-21 13:29:24 -07:00
Shilei Tian
f1ac2afe21
Reapply "[AMDGPU] Use COV6 by default (#118515)" (#130963)
This reverts commit 68bcba6d7a1cc18996c0bcb7c62267c62d2040d0.
2025-03-21 15:26:45 -04:00
Mallikarjuna Gouda
0ca10ef51b
[MIPS] Add MIPS i6400 and i6500 processors (#130587)
The i6400 and i6500 are high performance multi-core microprocessors from
MIPS that provide best in class power efficiency for use in
system-on-chip (SoC) applications. i6400 and i6500 implements Release 6
of the MIPS64 Instruction Set Architecture with full hardware
multithreading and hardware virtualization support.
2025-03-20 23:08:33 -04:00
hev
2d876ed33e
[llvm][LoongArch] Changing the default code model from small to medium for 64-bit (#132173)
Link: https://discourse.llvm.org/t/rfc-changing-the-default-code-model-for-loongarch
2025-03-21 10:15:31 +08:00
Cassandra Beckley
864a83deb0
[SPIR-V] Add support for inline SPIR-V types (#125316)
Using HLSL's [Inline
SPIR-V](https://microsoft.github.io/hlsl-specs/proposals/0011-inline-spirv.html)
features, users have the ability to use
[`SpirvType`](https://microsoft.github.io/hlsl-specs/proposals/0011-inline-spirv.html#types)
to have fine-grained control over the SPIR-V representation of a type.
As explained in the spec, this is useful because it enables vendors to
author headers with types for their own extensions.

As discussed in [Target Extension Types for Inline SPIR-V and Decorated
Types](https://github.com/llvm/wg-hlsl/pull/105), we would like to
represent the HLSL SpirvType type using a 'spirv.Type' target extension
type in LLVM IR. This pull request lowers that type to SPIR-V.
2025-03-20 15:49:44 -04:00
Craig Topper
eb77061a42
[RISCV] Add assembler support for Zvqdotq. (#132118)
Based on the 0.0.1 spec here
https://github.com/riscv/riscv-dot-product/releases/tag/v0.0.1
2025-03-20 08:38:15 -07:00
quic_hchandel
0744d4926a
[RISCV] Add Qualcomm uC Xqcilb (Long Branch) extension (#131996)
This extension adds two long branch instructions.

The current spec can be found at:
https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.7.0

This patch adds assembler only support.

Co-authored-by: Sudharsan Veeravalli <quic_svs@quicinc.com>
2025-03-20 11:14:53 +05:30