531239 Commits

Author SHA1 Message Date
Jonas Devlieghere
7b3455e24a
[lldb] Fix double free in CommandPluginInterfaceImplementation (#131658)
The class was taking ownership of the SBCommandPluginInterface pointer
it was passed in, by wrapping it in a shared pointer. This causes a
double free in the unit test when the object is destroyed and the same
pointer gets freed once when the SBCommandPluginInterface goes away and
then again when the shared pointer hits a zero refcount.
2025-03-18 09:48:34 -07:00
Nikita Popov
93df3e8166 [BasicAA] Add additional test for call AA (NFC) 2025-03-18 17:36:50 +01:00
Morris Hafner
27d8bd3dca
[CIR] Upstream CastOp and scalar conversions (#130690)
This patch upstreams ClangIR's CastOp with the following exceptions:
- No Fixed/FP conversions
- No casts between value categories
- No complex casts
- No array_to_ptrdecay
- No address_space
- No casts involving record types (member pointers, base/derived casts)
- No casts specific to ObjC or OpenCL

---------

Co-authored-by: Morris Hafner <mhafner@nvidia.com>
Co-authored-by: Erich Keane <ekeane@nvidia.com>
2025-03-18 09:36:43 -07:00
Matt Arsenault
dea5aa73fa
AMDGPU: Move insertion into V2SCopies map (#130776)
Insert the start instruction directly into the map before the uses. This
prevents improperly re-visting sgpr->vgpr phi inputs multiple times
which
would trigger a use after free.

I don't particularly trust the iteration scheme here. This is also
unnecessarily revisting transitive users of a phi or reg_sequence for
every
input operand, but I will address that separately.

Fixes #130646. I also believe it fixes #130119, although that test fails
less consistently for me.
2025-03-18 23:28:49 +07:00
Igor Kudrin
6542cf1973
[lldb/platform-gdb] Do not assume a persistent connection (#131736)
After https://reviews.llvm.org/D116539, when `m_gdb_client_up` in
`PlatformRemoteGDBServer` is not null, the connection to a server is
expected to exist. However,
`PlatformRemoteGDBServer::DisconnectRemote()` is not the only way to
close the connection;
`GDBRemoteCommunication::WaitForPacketNoLock()` can disconnect if the
server stops responding, and in this case `m_gdb_client_up` is not
cleared. The patch removes this assumption and checks the connection
status directly.
2025-03-18 09:25:35 -07:00
Simon Pilgrim
33e5d013b7
[CostModel][X86] merge vector shuffle costs tests using -cost-kind=all (#131819) 2025-03-18 16:19:51 +00:00
Christian von Elm
70357a2137
[OpenMP] [OMPD] gdb plugin: remove 'imp' import (#112331)
The 'imp' library was removed in Python 3.12.

As the code never uses the imp library, the import is simply removed.
2025-03-18 17:17:18 +01:00
OverMighty
3d083777ef
[libc] Fix compile error in MPFRWrapper when float128 is long double (#131821)
See https://lab.llvm.org/buildbot/#/builders/104/builds/18422.
2025-03-18 12:12:44 -04:00
Luke Lau
a4dc02c0e7
[VPlan] Rename VPReverseVectorPointerRecipe to VPVectorEndPointerRecipe. NFC (#131086)
After #128718 lands there will be two ways of performing a reversed
widened memory access, either by performing a consecutive unit-stride
access and a reverse, or a strided access with a negative stride.

Even though both produce a reversed vector, only the former needs
VPReverseVectorPointerRecipe which computes a pointer to the last
element of each part. A strided reverse still needs a pointer to the
first element of each part so it will use VPVectorPointerRecipe.

This renames VPReverseVectorPointerRecipe to VPVectorEndPointerRecipe to
clarify that a reversed access may not necessarily need a pointer to the
last element.
2025-03-19 00:09:15 +08:00
Peng Liu
b391e80f52
[libc++] Remove redundant assignments in bitset string-like constructors (#121424)
The following three string-like constructors for `std::bitset` 
- `bitset(const CharT* str, std::size_t n, CharT zero, CharT one)`;
- `bitset(const std::basic_string<CharT, Traits, Alloc>& str, typename
std::basic_string<CharT, Traits, Alloc>::size_type pos, CharT zero,
CharT one)`;
- `bitset(std::basic_string_view<CharT, Traits> str, std::size_t pos,
std::size_t n, CharT zero, CharT one)`

already initialize the underlying storage array to all zeroes via
default-constructor of the base class `__bitset`. Therefore,
re-assigning the storage array to zeroes via `std::fill_n` in the
string-like constructors is truly redundant.
2025-03-18 12:05:40 -04:00
Sudharsan Veeravalli
467e5a1d41
[RISCV] Add Qualcomm uC Xqcisim (Simulation Hint) extension (#128833)
This extension adds 10 instructions that provide hints to the interface
simulation environment.

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

This patch adds assembler only support.
2025-03-18 09:05:22 -07:00
Craig Topper
4f7dc99a8a
[RISCV] Use MnemonicAlias instead of InstAlias for some vector instructions. NFC (#131732)
To make this work we have to apply mnemonic aliases before looking up
custom operand parsing.
2025-03-18 08:49:08 -07:00
cor3ntin
e4d910e80d
[Clang] Demote mixed enumeration arithmetic error to a warning (#131811)
In C++, defaulted to an error.

C++ removed these features but the removal negatively impacts users.

Fixes #92340
2025-03-18 16:45:37 +01:00
Simon Pilgrim
e8f79eb898
[CostModel][X86] merge cttz costs tests using -cost-kind=all (#131810) 2025-03-18 15:43:21 +00:00
Simon Pilgrim
df544b73e4
[CostModel][X86] merge vector shifts costs tests using -cost-kind=all (#131806) 2025-03-18 15:32:00 +00:00
Philip Reames
2175c6cb38
[RISCV] Set AllocationPriority in line with LMUL (#131176)
This mechanism causes the greedy register allocator to prefer allocating
register classes with higher priority first. This helps to ensure that
high LMUL registers obtain a register without having to go through the
eviction mechanism. In practice, it seems to cause a bunch of code
churn, and some minor improvement around widening and narrowing
operations.

In a few of the widening tests, we have what look like code size
regressions because we end up with two smaller register class copies
instead of one larger one after the instruction. However, in any larger
code sequence, these are likely to be folded into the producing
instructions. (But so were the wider copies after the operation.)

Two observations:
1) We're not setting the greedy-regclass-priority-trumps-globalness flag
   on the register class, so this doesn't help long mask ranges.  I
   thought about doing that, but the benefit is non-obvious, so I
   decided it was worth a separate change at minimum.
2) We could arguably set the priority higher for the register classes
   that exclude v0.  I tried that, and it caused a whole bunch of
   further churn.  I may return to it in a separate patch.
2025-03-18 08:25:49 -07:00
Piotr Fusik
6ada38b248 [RISCV][test] Add tests for sinking NOT to be fold into ANDN/ORN/XNOR/VANDN 2025-03-18 16:23:09 +01:00
Simon Pilgrim
05dbabe329
[CostModel][X86] merge ctpop costs tests using -cost-kind=all (#131802) 2025-03-18 15:22:20 +00:00
Craig Topper
c33ef4f2d4
[RISCV] Reorder RISCVInstrInfoXCV.td to separate Operands, SDNodeXForms, formats, and instructions into separate sections. NFC (#131411)
This is more consistent with some of our other InstrInfo.td file.
2025-03-18 08:17:02 -07:00
Donát Nagy
ea107d5c63
[NFC][analyzer] Use CheckerBase::getName in checker option handling (#131612)
The virtual method `ProgramPointTag::getTagDescription` had two very
distinct use cases:
- It is printed in the DOT graph visualization of the exploded graph
(that is, a debug printout).
- The checker option handling code used it to query the name of a
checker, which relied on the coincidence that in `CheckerBase` this
method is defined to be equivalent with `getName()`.

This commit switches to using `getName` in the second use case, because
this way we will be able to properly support checkers that have multiple
(separately named) parts.

The method `reportInvalidCheckerOptionName` is extended with an
additional overload that allows specifying the `CheckerPartIdx`. The
methods `getChecker*Option` could be extended analogously in the future,
but they are just convenience wrappers around the variants that directly
take `StringRef CheckerName`, so I'll only do this extension if it's
needed.
2025-03-18 16:11:43 +01:00
LLVM GN Syncbot
64cf6f9721 [gn build] Port 127eb39a8ca9 2025-03-18 15:03:57 +00:00
Louis Dionne
351bcd9fe2 [libc++][NFC] Add a comment that an include is a workaround 2025-03-18 11:03:42 -04:00
Slava Zakharin
e0bcf3aa0b
[flang] Allow no type parameters for fir.pack_array. (#131662)
Arrays with assumed-length types are represented with a box
without explicit length parameters. This patch fixes the verification
to allow it for `fir.pack_array`.
2025-03-18 07:59:04 -07:00
Slava Zakharin
02b4522358
[NFC][flang] Added deduction guide for StaticDescriptor class. (#131690)
I keep getting these warnings when building with clang-17:
`warning: 'StaticDescriptor' may not intend to support class template
argument deduction [-Wctad-maybe-unsupported]`

This change should help avoiding them.
2025-03-18 07:58:35 -07:00
Aleksandr Korepanov
127eb39a8c
[LLVM][PDB] Use IsUnsigned flag for APInt correctly (#131598)
This patch fixes an assertion that occurs in `APInt`.

The assertion can be reproduced with LLDB test
`python_api/thread/TestThreadAPI.py` (it fails).
2025-03-18 15:57:00 +01:00
Kazu Hirata
695a007310
[X86] Avoid repeated hash lookups (NFC) (#131725) 2025-03-18 07:55:35 -07:00
Kazu Hirata
2c56383de5
[Hexagon] Avoid repeated hash lookups (NFC) (#131719) 2025-03-18 07:54:54 -07:00
Kazu Hirata
075324461d
[ADT] Use separate variables in a unit test for SmallPtrSet (NFC) (#131748) 2025-03-18 07:53:52 -07:00
Kazu Hirata
f179daf77b [mlir] Fix a warning
This patch fixes:

  mlir/lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp:121:3:
  error: default label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]
2025-03-18 07:52:46 -07:00
David Sherwood
f6b1b91a3d
[LV][NFC] Regenerate CHECK lines in some tests (#131799)
Regenerates CHECK lines in tests that are affected by
PR #130565 to aid reviews.
2025-03-18 14:38:01 +00:00
Joel Wee
3ea89e0611 Fix Bazel after 1fbfef9 2025-03-18 14:36:43 +00:00
Simon Pilgrim
034dd4c26f
[CostModel][X86] merge ctlz costs tests using -cost-kind=all (#131797) 2025-03-18 14:34:44 +00:00
Tony Varghese
aab4ce4d5e
[NFC][shrinkwrap] Add test point to capture the prologue and epilogue insertion by shrinkwrap pass for powerpc. (#131192)
This is NFC patch to capture the insertion of prologue and epilogue by
`shrinkwrap` pass for Powerpc target for functions that contain llvm
`__builtin_frame_address`.

---------

Co-authored-by: Tony Varghese <tony.varghese@ibm.com>
2025-03-18 10:26:44 -04:00
Shilei Tian
d85a81b4e4
[OffloadBundler] Rework the ctor of OffloadTargetInfo to support AMDGPU's generic target (#122629)
The current parsing logic for the target string assumes it follows the
format `<kind>-<triple>-<target id>:<feature>`, such as
`hipv4-amdgcn-amd-amdhsa-gfx1030:+xnack`.
Specifically, it assumes that `<target id>` does not contain any `-`,
relying on `rsplit` for parsing.
However, this assumption breaks for AMDGPU's generic targets, which may
contain one or more `-`, such as `gfx10-3-generic` or `gfx12-generic`.
As a result, the existing approach using `rstrip` is no longer reliable.

This patch reworks the parsing logic to handle target strings more
robustly, including support for generic targets.
The bundler now strictly requires a 4-field target triple.
Additionally, a new Python helper function has been added to `config.py`
to normalize the target triple into the 4-field format when it is not,
ensuring tests pass reliably.
2025-03-18 10:09:37 -04:00
Vy Nguyen
ca87823438
[LLDB][NFC]Refactor common test setup into SetUp method (#131203) 2025-03-18 10:09:03 -04:00
Nikita Popov
8f66fb7842 [GlobalMerge] Fix handling of const options
For the NewPM, the merge-const option was assigned to an unused
option field. Assign it to the correct one. The merge-const-aggressive
option was not supported -- and invalid options were silently ignored.
Accept it and error on invalid options.

For the LegacyPM, the corresponding cl::opt options were ignored when
called via opt rather than llc.
2025-03-18 15:06:39 +01:00
OverMighty
1bb8b656a9
[libc][math] Fix incorrect logic in fputil::generic::add_or_sub (#116129)
Fixes incorrect logic that went unnoticed until the function was tested
with output and input types that have the same underlying floating-point
format.
2025-03-18 15:04:18 +01:00
Nikita Popov
2fbfbf499e
[cmake] Resolve symlink when finding install prefix (#124743)
When determining the install prefix in LLVMConfig.cmake etc resolve
symlinks in CMAKE_CURRENT_LIST_FILE first. The motivation for this is to
support symlinks like `/usr/lib64/cmake/llvm` to
`/usr/lib64/llvm19/lib/cmake/llvm`. This only works correctly if the
paths are relative to the resolved symlink.

It's worth noting that this *mostly* already works out of the box,
because cmake automatically does the symlink resolution when the library
is found via CMAKE_PREFIX_PATH. It just doesn't happen when it's found
via the default prefix path.
2025-03-18 14:48:40 +01:00
Maryam Moghadas
22c6674f1d
[PowerPC] Add Dense Math binary integer outer-Product accumulate to DMR Instructions (#130791)
This commit adds the following Dense Math Facility integer calculation
instructions: dmxvi8gerx4, dmxvi8gerx4pp, dmxvi8gerx4spp, pmdmxvi8gerx4,
pmdmxvi8gerx4pp, and pmdmxvi8gerx4spp, along with their corresponding
intrinsics and tests.
2025-03-18 09:40:07 -04:00
Simon Pilgrim
a2d7451a13
[CostModel][X86] merge bitreverse costs tests using -cost-kind=all (#131791) 2025-03-18 13:30:01 +00:00
Simon Pilgrim
4f5eed0a37
[CostModel][X86] merge bswap costs tests using -cost-kind=all (#131784) 2025-03-18 13:29:25 +00:00
Akash Banerjee
cbc5c11fec
[MLIR][OpenMP] Add Lowering support for implicitly linking to default declare mappers (#131006) 2025-03-18 13:17:10 +00:00
Kareem Ergawy
83658ddb1b
[flang][OpenMP] Enable delayed privatization by default for omp.distribute (#131574)
Switches delayed privatization for `omp.distribute` to be on by default:
controlled by the `-openmp-enable-delayed-privatization` instead of by
`-openmp-enable-delayed-privatization-staging`.

### GFortran & Fujitsu test suite results:

#### gfotran test-suite (this PR):
```
Testing Time: 34.51s
  Passed: 6569
```

#### Fujitsu without changes (commit: 0813c5cf5f52):
```
Testing Time: 155.39s
  Passed            : 88325
  Failed            :   156
  Executable Missing:   408
```

#### Fujitsu with changes (this PR):
```
Testing Time: 158.54s
  Passed            : 88325
  Failed            :   156
  Executable Missing:   408
```
2025-03-18 14:07:41 +01:00
Vladislav Dzhidzhoev
84e44ae6b7
[llvm-objdump] Pass MCSubtargetInfo to findPltEntries (NFC) (#131773)
It allows access to subtarget features, collected in llvm-objdump.cpp,
from findPltEntries, which will be used in
https://github.com/llvm/llvm-project/pull/130764.
2025-03-18 14:00:34 +01:00
Louis Dionne
428b320bf3
[libc++] Fix allocate_at_least test that assumes the size_type of the allocator (#131682)
If the size_type of the allocator is not the same as std::size_t, this
test would fail.
2025-03-18 08:55:43 -04:00
SivanShani-Arm
23743f5bf9
[readobj][ELFExtendedAttrParser] Add destructor with error handling (#131783)
ELFExtendedAttrParser lacked a destructor that properly handled errors,
causing `llvm-readobj --arch-specific` to crash when the AArch64 Build
Attributes section was empty.

This commit adds error handling in the destructor and introduces test
files for `--arch-specific` to cover both an empty AArch64 Build
Attributes section and a populated one.

Fixes:

b1ebfac185
2025-03-18 12:29:37 +00:00
Phoebe Wang
3d63191467
[X86] Ignore NSW when DstSVT is i32 (#131755)
We don't have PACKSS for i64->i32.

Fixes: https://godbolt.org/z/qb8nxnPbK, which was introduced by ddd2f57b
2025-03-18 20:04:23 +08:00
David Sherwood
2586e7fcd8
[LV][NFC] Tidy up partial reduction tests with filter-out-after option (#129047)
A few test files seemed to have been edited after using the
update_test_checks.py script, which can make life hard for
developers when trying to update these tests in future
patches. Also, the tests still had this comment at the top

; NOTE: Assertions have been autogenerated by ...

which could potentially be confusing, since they've not
strictly been auto-generated.

I've attempted to keep the spirit of the original tests by
excluding all CHECK lines after the scalar.ph IR block,
however I've done this by using a new option called
--filter-out-after to the update_test_checks.py script.
2025-03-18 11:39:55 +00:00
Simon Pilgrim
aea3ad8bd3
[X86] canCreateUndefOrPoisonForTargetNode - add handling for VPERMV3 intrinsic opcodes (#131768)
We already handle the X86ISD::VPERMV3 node type, but if we can handle equivalent cases before intrinsic lowering we can simplify the code further - e.g. #109272 before constant BUILD_VECTOR nodes gets lowered to constant pool loads.
2025-03-18 11:35:58 +00:00
Fabian Ritter
332f060363
[SeparateConstOffsetFromGEP] Don't set unsound inbounds flag (#130616)
The language reference says about inbounds geps that "if the
getelementptr has any non-zero indices[...] [t]he base pointer has an in
bounds address of the allocated object that it is based on [and]
[d]uring the successive addition of offsets to the address, the
resulting pointer must remain in bounds of the allocated object at each
step."

If (gep inbounds p, (a + 5)) is translated to (gep [inbounds] (gep p,
a), 5) with p pointing to the beginning of an object and a=-4, as the
example in the comments suggests, that's the case for neither of the
resulting geps. Therefore, we need to clear the inbounds flag for both
geps.

We might want to use ValueTracking to check if a is known to be
non-negative to preserve the inbounds flags.

For the AMDGPU tests with scratch instructions, removing the unsound
inbounds flag means that AMDGPUDAGToDAGISel::isFlatScratchBaseLegal sees
no NUW flag at the pointer add, which prevents generation of scratch
instructions with immediate offsets.

For SWDEV-516125.
2025-03-18 12:30:20 +01:00