Commit Graph

542711 Commits

Author SHA1 Message Date
Ramkumar Ramachandra
1e2ddc8a3d [CostModel/RISCV] Add tests for ldexp, [l]lround (#146108) 2025-06-28 11:40:41 +01:00
Tomer Shafir
b6515ae684 [AArch64] Align 0-cycle reg-mov model of GPR64, GPR32 reg classes (#146051)
Aligns 0-cycle register MOV model of GPR64 and GPR32 register classes to
that of FPR64 and FPR32 resolved in:
https://github.com/llvm/llvm-project/pull/144152.

- Splits `FeatureZCRegMove` into `FeatureZCRegMoveGPR64` and
`FeatureZCRegMove32` and fix Apple processors and `AArch64InstrInfo`
accordingly
- Aligns the test `arm64-zero-cycle-regmov-gpr.ll` to the FPR one

The target feature name change is effectively a breaking change. The
absolute most of users shouldn't use `-mzcm` directly, so I think it
should be ok to make an immediate switch, unless this doesn't align with
the conventions in this project. The patch adds a release note for that.
2025-06-28 12:36:40 +03:00
Antonio Frighetto
69b8e59f29 [ValueTracking] Forward-declare class instead of including header (NFC)
The header inclusion was previously causing a build time regression.
2025-06-28 11:21:24 +02:00
Yao Zi
0ba456fcc6 [Clang][LoongArch] Match GCC behaviour when parsing FPRs in asm clobbers (#138391)
There're four possible formats to refer a register in inline assembly,

1. Numeric name without dollar sign ("f0")
2. Numeric name with dollar sign ("$f0")
3. ABI name without dollar sign ("fa0")
4. ABI name with dollar sign ("$fa0")

LoongArch GCC accepts 1 and 2 for FPRs before r15-8284[1] and all these
formats after the chagne. But Clang supports only 2 and 4 for FPRs. The
inconsistency has caused compatibility issues, such as QEMU's case[2].

This patch follows 0bbf3ddf5f ("[Clang][LoongArch] Add GPR alias
handling without `$` prefix") and accepts FPRs without dollar sign
prefixes as well to keep aligned with GCC, avoiding future compatibility
problems.

Link:
https://gcc.gnu.org/cgit/gcc/commit/?id=d0110185eb78f14a8e485f410bee237c9c71548d
[1]
Link:
https://lore.kernel.org/qemu-devel/20250314033150.53268-3-ziyao@disroot.org/
[2]
2025-06-28 16:47:05 +08:00
Michał Górny
e34e02128e [clang] Fix tests requiring Z3 headers in standalone builds (#146200)
Fix running tests that require Z3 headers in standalone build. They were
wrongly relying on `Z3_INCLUDE_DIR` being passed through from LLVM,
which is not the case for a standalone build. Instead, perform
`find_package(Z3)` again to find Z3 development files and set
`Z3_INCLUDE_DIR`. While at it, handle the possibility that Z3
development package is no longer installed -- run the tests only if both
LLVM has been built against Z3, and the headers are still available.

https://github.com/llvm/llvm-project/pull/145731#issuecomment-3009487525

Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-06-28 09:10:49 +02:00
Sirui Mu
3c4e730802 [Sema][clangd] add noexcept to override functions during code completion (#75937)
If a virtual function is declared with `noexcept`, functions that
override this function in the derived classes must be declared with
`noexcept` as well. This PR updates code completion in clang Sema. It
adds `noexcept` specifier to override functions in the code completion
result if the functions override a `noexcept` virtual function.
2025-06-28 14:37:20 +08:00
Björn Svensson
8351752dbc [clang-tidy] Fix false positives in readability-redundant-inline-specifier (#135391)
The out-of-line explicitly-defaulted definition is not the first
declaration, so it is not implicitly inline.

Alt. reference:
9.5.2 (3) Explicitly-defaulted functions in
[N4950](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4950.pdf).
or https://timsong-cpp.github.io/cppwp/n4861/dcl.fct.def.default#3

Fixes #130745

---------

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
2025-06-28 09:10:34 +03:00
Fangrui Song
18e9cfd56b Hexagon: Remove getVariantKind 2025-06-27 23:05:51 -07:00
Fangrui Song
b9ca4c5fab MCExpr: Make COFF-specific VK_SECREL target-specific
to align with ELF targets, where the relocation specifier constants are
all target-specific.
2025-06-27 22:54:02 -07:00
SahilPatidar
3f531552e6 [REAPPLY][Clang-Repl] Add support for out-of-process execution. #110418 (#144064)
This PR introduces out-of-process (OOP) execution support for
Clang-Repl. With this enhancement, two new flags, oop-executor and
oop-executor-connect, are added to the Clang-Repl interface. These flags
enable the launch of an external executor (llvm-jitlink-executor), which
handles code execution in a separate process.
2025-06-28 08:42:59 +03:00
Fangrui Song
ac9204de7d MCExpr: Remove VK_None
`enum VariantKind` is deprecated. Targets are encouraged to use their
own relocation specifier constants. MCSymbolRefExpr::create callers with
a VK_None argument should switch to the overload with a VariantKind
parameter.
2025-06-27 22:36:43 -07:00
Fangrui Song
e121f72c94 X86: Rename X86MCExpr::VK_ to X86::S_
Rename these relocation specifier constants, aligning with the naming
convention used by other targets (`S_` instead of `VK_`).

Move constants to X86MCAsmInfo.h, with the goal of eventually removing
X86MCExpr.h.

Similar to #144633 for AArch64.
2025-06-27 22:22:43 -07:00
Kazu Hirata
1a94bcf90f [llvm] Remove unused includes (NFC) (#146199)
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.
2025-06-27 22:08:06 -07:00
Kazu Hirata
094a7087b8 [Target] Use range-based for loops (NFC) (#146198) 2025-06-27 22:07:58 -07:00
Kazu Hirata
56da4a9628 [llvm] Use std::tie to implement comparison functors (NFC) (#146197)
std::tie clearly expresses the intent while slightly shortening the
code.
2025-06-27 22:07:50 -07:00
Kazu Hirata
f90af1c9e8 [MC] Drop const from a return type (NFC) (#146196)
We don't need const on a return type.
2025-06-27 22:07:43 -07:00
Kazu Hirata
7f6d7391cf [Basic] Use StringRef::drop_back (NFC) (#146195) 2025-06-27 22:07:34 -07:00
Kazu Hirata
eff28bdd46 [AMDGPU] Use StringRef::consume_back (NFC) (#146194)
Note that StringRef::consume_back returns true while consuming the
given prefix if present.
2025-06-27 22:07:27 -07:00
Fangrui Song
c73906ec69 MCParser: Reduce VK_None uses 2025-06-27 22:02:22 -07:00
Uday Bondhugula
80625c16f0 [MLIR][Affine] Fix memref replacement in affine-data-copy-generate (#139016)
Fixes: https://github.com/llvm/llvm-project/issues/130257

Fix affine-data-copy-generate in certain cases that involved users in
multiple blocks. Perform the memref replacement correctly during copy
generation.

Improve/clean up memref affine use replacement API. Instead of
supporting dominance and post dominance filters (which aren't adequate
in most cases) and computing dominance info expensively each time in
RAMUW, provide a user filter callback, i.e., force users to compute
dominance if needed.
2025-06-28 10:27:11 +05:30
Fangrui Song
28d4cc6d7b MC: Reduce MCSymbolRefExpr::VK_None uses 2025-06-27 21:55:36 -07:00
Craig Topper
4d7510c335 [RISCV] Remove untested code from SelectAddrRegRegScale. (#146185)
This code handled load/store addresses that are a SHL instruction. That
seems very unlikely to occur unless you're accessing an array that
starts at address 0. I'm not even sure if you can represent that in llvm
IR.
2025-06-27 21:55:11 -07:00
Fangrui Song
0e558239b8 LoongArch: Remove unneeded VK_None check
Expressions with relocation specifier are encoded as MCSpecifierExpr,
so MCSymbolRefExpr expressions have no specifier.
2025-06-27 21:53:37 -07:00
Fangrui Song
5aa3e6baa0 MC: Reduce MCSymbolRefExpr::VK_None uses 2025-06-27 21:46:36 -07:00
Fangrui Song
109b7d965c MC: Remove unneeded VK_None argument to MCSymbolRefExpr::create calls
The MCSymbolRefExpr::create overload with the specifier parameter is
discouraged and being phased out. Expressions with relocation specifiers
should use MCSpecifierExpr instead.
2025-06-27 21:22:46 -07:00
Brian Cain
c6bd020714 Revert "[Hexagon] NFC: Reduce the amount of version-specific code" (#146193)
Reverts llvm/llvm-project#145812
2025-06-27 23:13:36 -05:00
Maksim Panchenko
54a7d53227 [BOLT] Fix program-header.test 2025-06-27 19:51:51 -07:00
Jordan Rupprecht
163ad0bcda [bazel] Add lldb deps for #144627 (#146192) 2025-06-27 21:26:20 -05:00
Qinkun Bao
3923dd4484 Fix uncaught-exception.test. (#146190)
See https://github.com/llvm/llvm-project/pull/125924
To match a literal plus sign, it must be escaped with a backslash (`\`).
2025-06-27 22:23:51 -04:00
Qinkun Bao
72060f1cfd Fix uncaught-exception.test. (#146181)
See https://github.com/llvm/llvm-project/pull/125924

I didn't test it as I don't have access to a windows machine.
2025-06-27 21:59:58 -04:00
Jason Molenda
a64db49371 [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers (#144627)
The "process metadata" LC_NOTE allows for thread IDs to be specified in
a Mach-O corefile. This extends the JSON recognzied in that LC_NOTE to
allow for additional registers to be supplied on a per-thread basis.

The registers included in a Mach-O corefile LC_THREAD load command can
only be one of the register flavors that the kernel (xnu) defines in
<mach/arm/thread_status.h> for arm64 -- the general purpose registers,
floating point registers, exception registers.

JTAG style corefile producers may have access to many additional
registers beyond these that EL0 programs typically use, for instance
TCR_EL1 on AArch64, and people developing low level code need access to
these registers. This patch defines a format for including these
registers for any thread.

The JSON in "process metadata" is a dictionary that must have a
`threads` key. The value is an array of entries, one per LC_THREAD in
the Mach-O corefile. The number of entries must match the LC_THREADs so
they can be correctly associated.

Each thread's dictionary must have two keys, `sets`, and `registers`.
`sets` is an array of register set names. If a register set name matches
one from the LC_THREAD core registers, any registers that are defined
will be added to that register set. e.g. metadata can add a register to
the "General Purpose Registers" set that lldb shows users.

`registers` is an array of dictionaries, one per register. Each register
must have the keys `name`, `value`, `bitsize`, and `set`. It may provide
additional keys like `alt-name`, that
`DynamicRegisterInfo::SetRegisterInfo` recognizes.

This `sets` + `registers` formatting is the same that is used by the
`target.process.python-os-plugin-path` script interface uses, both are
parsed by `DynamicRegisterInfo`. The one addition is that in this
LC_NOTE metadata, each register must also have a `value` field, with the
value provided in big-endian base 10, as usual with JSON.

In RegisterContextUnifiedCore, I combine the register sets & registers
from the LC_THREAD for a specific thread, and the metadata sets &
registers for that thread from the LC_NOTE. Even if no LC_NOTE is
present, this class ingests the LC_THREAD register contexts and
reformats it to its internal stores before returning itself as the
RegisterContex, instead of shortcutting and returning the core's native
RegisterContext. I could have gone either way with that, but in the end
I decided if the code is correct, we should live on it always.

I added a test where we process save-core to create a userland corefile,
then use a utility "add-lcnote" to strip the existing "process metadata"
LC_NOTE that lldb put in it, and adds a new one from a JSON string.

rdar://74358787

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-06-27 18:43:41 -07:00
Chris B
67a5fc8e12 Update references from llvm-beanz to llvm (#146177)
This fixes the HLSL actions to pull from the LLVM organization instead
of the original repository under my personal GitHub.
2025-06-27 20:12:27 -05:00
Andy Kaylor
32180cf9f9 [CIR] Upstream support for operator assign (#145979)
This adds support for assignment operators, including implicit operator
definitions.
2025-06-27 16:56:26 -07:00
Valentin Clement (バレンタイン クレメン)
570b95218c [flang][cuda] Do not generate section checks in device context (#146170)
This check is only useful on the host side. Also the function is bot
built for the device.
2025-06-27 16:19:40 -07:00
Erick Velez
6d817810da [clang-doc] serialize IsBuiltIn and IsTemplate for types (#146149)
IsBuiltIn and IsTemplate were being emitted as their default values.
2025-06-27 16:17:39 -07:00
Peter Collingbourne
71d4c9ce70 cmake: Allow CLANG_RESOURCE_DIR to be absolute.
Currently an absolute CLANG_RESOURCE_DIR is treated as being relative
to bin. Fix that by using cmake_path(APPEND) to append the path to bin.

The prepending of PREFIX is left as-is because callers passing PREFIX
are usually forming a path within the build directory and would not
want build products to be written to an absolute resource directory
that is likely to be an installation prefix. One exception is the caller
in lldb/cmake/modules/LLDBStandalone.cmake; for now it is not possible
to build LLDB with an absolute resource directory until the users are
disambiguated.

Reviewers: petrhosek

Reviewed By: petrhosek

Pull Request: https://github.com/llvm/llvm-project/pull/145996
2025-06-27 16:04:35 -07:00
AmirHossein PashaeeHir
5ecd21a46a [NFC] Make unwind table internal data structures more accessible (#145804)
All these changes are being used in
[PR#145633](https://github.com/llvm/llvm-project/pull/145633)

`CFIProgram`:
- `addInstruction` methods already exists, but more convenient ones are
private, this PR makes them public

`UnwindLocation`:
- Added a field accessor method for `Dereference` like other field
access methods.
2025-06-27 15:54:47 -07:00
dianqk
c43282ab69 [RelLookupTableConverter] Drop unnamed_addr for GVs in entries to avoid generating GOTPCREL relocations (#146068)
The entry in a relative lookup table is a global variable with a
constant offset, such as `@gv`, `GEP @gv, 1`, and so on.

We cannot only consider the case of a trivial global variable. This PR
handles all cases using the existing `IsConstantOffsetFromGlobal`
function.
2025-06-28 06:42:42 +08:00
Valentin Clement (バレンタイン クレメン)
75175e7230 [flang][cuda] Inline this_thread_block() calls (#146144) 2025-06-27 14:59:29 -07:00
Craig Topper
9a93de58f7 [TableGen] Simplify copying OperandMap entries for tied operands in CompressInstEmitter. NFC
Copy the whole struct instead of copying both fields.
2025-06-27 14:58:53 -07:00
Craig Topper
457c9aec9e [TableGen] Simplify how we calculate NumMIOperands in addDagOperandMapping. NFC
We can use the MIOperandNo and NumMIOperands from the last operand
instead using a loop.
2025-06-27 14:58:39 -07:00
Shafik Yaghmour
8bc61cbfde [Clang][ByteCode][NFC] Avoid copies by using move in Disasm.cpp (#146127)
Static analysis flagged some cases we could avoid copies by using
std::move in Disasm.cpp.
2025-06-27 14:53:20 -07:00
sribee8
f58caed1bc [libc] Changed CharacterConverter returns (#146130)
changed internal CharacterConverter returns to return errno macro when
necessary for consistency.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-27 21:50:09 +00:00
joaosaffran
171aa34e43 [DirectX] Add static sampler support to root signature (#143422)
Implements static samplers parsing from root signature metadata
representation. This is required to support Root Signatures in HLSL.
Closes: #[126641](https://github.com/llvm/llvm-project/issues/126641)

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-06-27 14:30:48 -07:00
Igor Kudrin
442f99d769 [lldb] Fix evaluating expressions without JIT in an object context (#145599)
If a server does not support allocating memory in an inferior process or
when debugging a core file, evaluating an expression in the context of a
value object results in an error:

```
error: <lldb wrapper prefix>:43:1: use of undeclared identifier '$__lldb_class'
   43 | $__lldb_class::$__lldb_expr(void *$__lldb_arg)
      | ^
```

Such expressions require a live address to be stored in the value
object. However, `EntityResultVariable::Dematerialize()` only sets
`ret->m_live_sp` if JIT is available, even if the address points to the
process memory and no custom allocations were made. Similarly,
`EntityPersistentVariable::Dematerialize()` tries to deallocate memory
based on the same check, resulting in an error if the memory was not
previously allocated in `EntityPersistentVariable::Materialize()`.

As an unintended bonus, the patch also fixes a FIXME case in
`TestCxxChar8_t.py`.
2025-06-27 14:30:24 -07:00
Kazu Hirata
9f5061d4f0 [lldb] Fix a typo in documentation (#146115) 2025-06-27 14:26:32 -07:00
Valentin Clement (バレンタイン クレメン)
b2f504ff15 [flang][cuda] Inline this_warp() calls (#146134) 2025-06-27 14:12:17 -07:00
Brad Smith
68239b76f1 [gtest] Fix building on OpenBSD/sparc64 (#145225)
Cherry pick a patch from 1.15.0

Add missing include for raise(3)

7f036c5563
2025-06-27 16:56:17 -04:00
Christopher McGirr
29b1054835 [mlir][linalg] Update pack and unpack documentation (#143903)
* Clarified the `inner_dim_pos` attribute in the case of high
dimensionality tensors.
* Added a 5D examples to show-case the use-cases that triggered this
updated.
* Added a reminder for linalg.unpack that number of elements are not
required to be the same between input/output due to padding being
dropped.

I encountered some odd variations of `linalg.pack` and `linalg.unpack`
while working on some TFLite models and the definition in the
documentation did not match what I saw pass in IR verification.

The following changes reconcile those differences.

---------

Signed-off-by: Christopher McGirr <mcgirr@roofline.ai>
2025-06-27 13:55:26 -07:00
Erich Keane
33d20828d1 [OpenACC][CIR] Implement enter-data + clause lowering (#146146)
'enter data' is a new construct type that requires one of the data
clauses, so we had to wait for all clauses to be ready before we could
commit this. Most of the clauses are simple, but there is a little bit
of work to get 'async' and 'wait' to have similar interfaces in the ACC
dialect, where helpers were added.
2025-06-27 13:47:42 -07:00