530575 Commits

Author SHA1 Message Date
Joseph Huber
8437b7f558
[libc] Make RPC server handling header only (#131205)
Summary:
This patch moves the RPC server handling to be a header only utility
stored in the `shared/` directory. This is intended to be shared within
LLVM for the loaders and `offload/` handling.

Generally, this makes it easier to share code without weird
cross-project binaries being plucked out of the build system. It also
allows us to soon move the loader interface out of the `libc` project so
that we don't need to bootstrap those and can build them in LLVM.
2025-03-13 19:23:21 -05:00
Vasileios Porpodas
214d47af9b [SandboxVec][PassManager][NFC] Fix PM printing
It currently prints '(' instead of '<'. This patch fixes it.
2025-03-13 17:09:13 -07:00
Min-Yih Hsu
299cb5d88f
[LLVM] Update llvm-mca / MCA maintainers (#131187)
Adding myself as a co-maintainer alongside @adibiagio , who invited me
to take on this role.
2025-03-13 17:04:32 -07:00
Saleem Abdulrasool
dcec224240
Lex: add support for i128 and ui128 suffixes (#130993)
Microsoft's compiler supports an extension for 128-bit literals. This is
referenced in `intsafe.h` which is included transitievly. When building
with modules, the literal parsing causes a failure due to the missing
support for the extension. To alleviate this issue, support parsing this
literal, especially now that there is the BitInt extension.

Take the opportunity to tighten up the code slightly by ensuring that we
do not access out-of-bounds characters when lexing the token.
2025-03-13 16:36:07 -07:00
Lang Hames
3b5842c9c4 [ORC] Make runAllocActions and runDeallocActions asynchorous.
Part of ongoing work to make core ORC operations asynchronous.

This only affects the runner utilities, not the AllocationActions themselves.
The AllocationActions will be made asynchronous in a future patch.
2025-03-14 10:32:00 +11:00
Alan Zhao
864a53b4a4
Reapply "Use global TimerGroups for both new pass manager and old pass manager timers" (#131173) (#131217)
This reverts commit 31ebe6647b7f1fc7f6778a5438175b12f82357ae.

The reason for the test failure is likely due to
`Name2PairMap::getTimerGroup(...)` not holding a lock.
2025-03-13 16:20:39 -07:00
Jan Svoboda
d0c869521c
[Support] Prevent leaking unique lock files (#130984)
Prior to this PR, failing to get the host ID would leave the unique lock
file on the file system. This is now fixed by constructing
`RemoveUniqueLockFileOnSignal` earlier. This PR also removes one call to
`sys::fs::remove()` that is now redundant and another that was redundant
even before this patch.
2025-03-13 16:15:42 -07:00
Philip Reames
e26bcf1627 [CodeGen] Use early return to simplify SplitEditor::defFromParent [NFC] 2025-03-13 16:13:26 -07:00
Kai Sasaki
befa037c13
[mlir][affine] Guard invalid dim attribute in the test-reify-bound pass (#129013)
Computing the bound of affine op
(ValueBoundsConstraintSet::computeBound) crashes due to the invalid dim
value given to the op. It is necessary for the pass to check the dim
attribute not to be greater than the rank of the input type.

Fixes https://github.com/llvm/llvm-project/issues/128807
2025-03-14 08:09:01 +09:00
Jeffrey Byrnes
fc28f83bf5
[SLP] Precommit test (#131236)
Precommit test for https://github.com/llvm/llvm-project/pull/131229
2025-03-13 16:03:46 -07:00
Mariusz Borsa
ab58a3c35b
XFAIL malloc_zone.cpp for darwin/lsan (#131234)
Silence darwin bot while we investigate the problem

rdar://145873843

Co-authored-by: Mariusz Borsa <m_borsa@apple.com>
2025-03-13 16:01:32 -07:00
Craig Topper
55e5e749ce
[RISCV] Remove some unnecessary hasSideEffects = 0 and sink some to their base class. NFC (#131044)
Some of these were already present in their base class and therefore
redundant. Others were missing from their base classes. Maybe leftover
from when VXRM was modeled with side effects?
2025-03-13 15:56:22 -07:00
David Peixotto
d1deaed0d2
[lldb] Split some lldb-server tests to avoid timeout (#129614)
Split test cases out of TestLldbGdbServer.py and TestGdbRemoteFork.py
into separate files to avoid hitting the 600s timeout limit. The
inferior used by these tests (main.cpp) takes approximately 20s to
compile with a Debug build of clang, causing timeouts when a single test
file contains many tests. By grouping similar tests into separate files,
we can prevent timeouts and improve overall test efficiency.
2025-03-13 15:54:45 -07:00
Adrian Vogelsgesang
8b9031f245
[lldb-dap] Support vscode launch URLs (#125843)
This commit adds support for starting debug sessions through special
`vscode://llvm-vs-code-extensions.lldb-dap/start?config={launch-config}`
URIs. This allows tighter integration with custom scripts. One potential
use case is providing similar functionality to `xcdebug`, see #125777
for some discussion on that use case.

The functionality was inspired by @vadimcn's CodeLLDB extension, which
[provides similar
functionality](https://github.com/vadimcn/codelldb/blob/master/MANUAL.md#debugging-externally-launched-code).
2025-03-13 23:49:05 +01:00
Julian Lettner
2a244bb839
Simplify Target::RunStopHooks() (#129578)
Introduce `StopHookResult::NoPreference` and
simplify control flow in `Target::RunStopHooks()`.

The algorithm is (in order):
1. "Auto continue" set on any hook -> continue
2. "Stop demanded" by any hook -> stop
3. "Continue requested" by any hook -> continue
4. No hooks, or "no preference" only (default
   stance) -> stop

The new `NoPreference` lets us keep the default
stance, distinguishing case 3. and 4.
2025-03-13 15:32:41 -07:00
PiJoules
662bd4ca47
[stdio][baremetal] Fix templating for print functions (#131232)
This addresses build errors from https://github.com/llvm/llvm-project/pull/111559.
2025-03-13 15:30:45 -07:00
Hubert Tong
e0e80dbe43
[Clang codegen][PPC] Produce AIX-specific "target features" only for AIX (#130864)
Listing AIX-specific "target features" in the IR are a source of
confusion on PPC Linux. Generate them only for AIX (at least by
default).
2025-03-13 18:13:03 -04:00
Jonas Devlieghere
998511c8ef
[debugserver] Fix mutex scope in RNBRemote::CommDataReceived (#131077)
The mutex in RNBRemote::CommDataReceived protects m_rx_packets and
should extend to the end of the function to cover the read where we
check if the list is empty.
2025-03-13 15:12:19 -07:00
PeterChou1
08d15e3f64
Revert "reapply [llvm] add support for mustache templating language" (#131228)
This broke:

https://lab.llvm.org/buildbot/#/builders/64/builds/2486
https://lab.llvm.org/buildbot/#/builders/146/builds/2476
2025-03-13 18:08:58 -04:00
Nicolas van Kempen
0ab9f78957
[docs] Fix link appearing improperly (#131225)
See current live website:
https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access

![image](https://github.com/user-attachments/assets/f3212ca6-b2a6-4d83-9323-11ba4148d991)

Building locally, it appears correctly:

![image](https://github.com/user-attachments/assets/68f5e932-1abf-48cf-93f0-30dacb0910c6)

Feel free to merge immediately.
2025-03-13 14:51:35 -07:00
PiJoules
0f8c075f7c
[llvm] Match llvm.type.checked.load.relative semantics to llvm.load.r… (#129583)
…elative

The semantics of `llvm.type.checked.load.relative` seem to be a little
different from that of `llvm.load.relative`. It looks like the semantics
for `llvm.type.checked.load.relative` is `ptr + offset + *(ptr +
offset)` whereas the semantics for `llvm.load.relative` is `ptr + *(ptr
+ offset)`. That is, the offset for the former is added to the offset
address whereas the later has the offset added to the original pointer.

It really feels like the checked intrinsic was meant to match the
semantics of the non-checked intrinsic, but I think for all cases the
checked intrinsic is used (swift being the only use I know of), the
calculation just happens to be the same because swift always uses an
offset of zero. Likewise, all llvm tests for this intrinsic happen to
use an offset of zero.

Relative vtables in clang happens to be the first time where we're using
this intrinsic and using it with non-zero values. This updates the
semantics of the checked intrinsic to match the non-checked one.
Effectively this shouldn't change any codegen by any users of this since
all current users seem to use a zero offset.

This PR also updates some tests with non-zero offsets.
2025-03-13 14:50:41 -07:00
Florian Hahn
dfb661cd1c
[LAA] Add extra tests for #128061.
Extend test coverage for
https://github.com/llvm/llvm-project/pull/128061.
2025-03-13 21:42:32 +00:00
quic_hchandel
c59c387417
[RISCV] Improve Disassembler test xqci-invalid.txt (#130039)
Some test lines were added in #129504 for Qualcomm uC Xqcibm extension.
This patch improves those test lines.
2025-03-13 14:40:17 -07:00
Valentin Clement (バレンタイン クレメン)
57d87ed7f0
[flang][NFC] Add parenthesis to avoid warning (#131219)
Remove warning introduced in 369da8421c2f7
2025-03-13 14:28:35 -07:00
Kai Nacke
37d99e9c6e
[GOFF] Refactor GOFFOstream (#131143)
GOFFOstream writes the physical 80 byte records. The records are
connected by flags indicating if there is a successor or a predecessor.
Using the length of the logical record is prone to errors. The new
implementation buffers the last physical record, and writes it out when
new data is written. In this way, the flags can be easily determined.
No obversable change in functionality, therefore no tests.
2025-03-13 16:55:47 -04:00
Jonas Devlieghere
e823449f66
[lldb][debugserver] Synchronize interrupt and resume signals (#131073)
This PR fixes a race condition in debugserver where the main thread
calls MachProcess::Interrupt, setting `m_sent_interrupt_signo` while the
exception monitoring thread is checking the value of the variable.

I was on the fence between introducing a new mutex and reusing the
existing exception mutex. With the notable exception of
MachProcess::Interrupt, all the other places where we were already
locking this mutex before accessing the variable. I renamed the mutex to
make it clear that it's now protecting more than the exception messages.

Jason, while investigating a real issue, had a suspicion there was race
condition related to interrupts and I was able to narrow it down by
building debugserver with TSan.
2025-03-13 13:54:13 -07:00
Philip Reames
bbb244c0fd
[RISCV] Set CopyCost on register classes [NFC] (#131185)
This change sets up CopyCost to reflect the cost of copying a vector
register group, a vector segment, or a register pair.

This is NFC because the only actual usage of this field in tree is
simply checking that cost is not negative. That heuristic is around ABI
copy elimination during instruction emission + scheduling, and doesn't
immediately seem like it should apply for us.
2025-03-13 13:45:44 -07:00
Simon Pilgrim
688d7a5d0a
[X86] combineConcatVectorOps - extend ISD::VECTOR_SHUFFLE handling to support 512-bit types (#131189)
Limit cases to AVX512 targets that support two-operand crosslane
shuffles
2025-03-13 20:36:49 +00:00
Brian Ledger
4bcf1e61eb
Update the libc BUILD.bazel file with selects for Windows builds. (#131172)
The Windows toolchain needs to build libc targets in order to support
libc++. Currently, some targets fail to resolve, due to non-exhaustive
select statements, not accounting for Windows builds.

This change adds clauses to select statements so that Windows builds can
proceed.

Additionally, `__support_osutil_exit`, is configured to pass nothing to
`srcs` for non-Linux builds. `__support_osutil_exit `is unconditionally
included in the transitive dependencies of `extern_libc_shared`.

---------

Co-authored-by: Brian Ledger <brianpl@google.com>
2025-03-13 15:19:13 -05:00
Luke Hutton
1c45514748
[mlir][tosa] Fix bug causing quantized pad const creation crash (#131125)
This commit ensures the storage type is retrieved correctly which fixes
a crash when creating a quantized pad const tensor.

Testing is completed via the `tosa-optional-decompositions` pass which
makes use of the `createPadConstTensor` function.

Also includes some cleanup.
2025-03-13 13:17:47 -07:00
Thurston Dang
c30ff922ca
[msan] Handle llvm.x86.vcvtps2ph.128/256 explicitly (#130705)
Check whether each lane is fully initialized, and propagate the shadow
per lane instead of using the strict handling of visitInstruction.

Updates the tests from https://github.com/llvm/llvm-project/pull/129807
2025-03-13 16:15:37 -04:00
higher-performance
8c7f0eaa6e
Reduce memory usage in AST parent map generation by lazily checking if nodes have been seen (#129934)
This mitigates a regression introduced in #87824.

The mitigation here is to store pointers the deduplicated AST nodes, rather than copies of the nodes themselves. This allows a pointer-optimized set to be used and saves a lot of memory because `clang::DynTypedNode` is ~5 times larger than a pointer.

Fixes #129808.
2025-03-13 16:02:39 -04:00
Mircea Trofin
8aa835c2b5
[ctxprof] Fix warnings post PR #130655 (#131198) 2025-03-13 12:54:48 -07:00
aankit-ca
d642eec78f
[HEXAGON] Fix semantics of ordered FP compares (#131089)
For the ordered FP compare bitcode instructions, the Hexagon backend was
assuming that no operand could be a NaN. This assumption is flawed. This
patch fixes the code-generation to produce fpcmp.uo and and appropriate
bit comparison operators to account for the case when an operand to a FP
compare is a NaN.

Fix for https://github.com/llvm/llvm-project/issues/129391

Co-authored-by: aankit-quic <aankit@quicinc.com>
2025-03-13 14:48:31 -05:00
Daniel Hernandez-Juarez
64f67f870d
[mlir][AMDGPU] Enable emulating vector buffer_atomic_fadd for bf16 on gfx942 (#129029)
- Change to make sure architectures < gfx950 emulate bf16
buffer_atomic_fadd
- Add tests for bf16 buffer_atomic_fadd and architectures: gfx12, gfx942
and gfx950

---------

Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com>
2025-03-13 14:30:45 -05:00
Vy Nguyen
b36bf47b25
[LLDB][Telemetry]Init field to nullptr. (#131191)
The field is currently un-initialised and can cause a crash in some
build configs (where it got random values)
2025-03-13 15:24:55 -04:00
Nirvedh Meshram
ca4399036f
[mlir][linalg] Add FoldReshapeWithGenericOpByCollapsing pattern (#131029)
This pattern to bubble up collapse shapes was missing in
`populateFoldReshapeOpsByCollapsingPatterns` .

Signed-off-by: Nirvedh Meshram <nirvedh@gmail.com>
2025-03-13 14:22:50 -05:00
Florian Hahn
f13d58303f
[VPlan] Pass some functions directly to all_of (NFC).
Remove some unneeded lambdas.
2025-03-13 18:50:11 +00:00
Christopher Di Bella
933ecf5f30
[mlir] adds [[maybe_unused]] to variables that might not be used (#131184)
This should suppress an unused variable warning that was seemingly
pervasive.
2025-03-13 11:44:53 -07:00
Adam Siemieniuk
a16c225b40
[mlir][xegpu] Convert Vector contraction to XeGPU (#122115)
Adds pattern to lower vector.contract to XeGPU operation.
2025-03-13 19:41:53 +01:00
Simon Tatham
6fea340023
[libc] Fix non-templated uses of printf_core::Writer (#131149)
Commit 598e882ee88a1e3 turned `Writer` into a template, and updated most
of the call sites that use it. But not all. The alternative FP printf
system in `float_dec_converter_limited.h` wasn't updated, and neither
was `baremetal/printf.cpp` or `baremetal/vprintf.cpp`.

This patch updates `float_dec_converter_limited.h` in the same way that
the previous commit updated `float_dec_converter.h`: propagate the
templatedness through everything in the header, so that anything using a
`Writer` at all has a `write_mode` template parameter to pass on to it.

`printf.cpp` and `vprintf.cpp` are updated in the same way that the
previous commit updated `printf_core/vfprintf_internal.h`: the
`WriteBuffer` has parameter `WriteMode::FLUSH_TO_STREAM`, and `Writer`
picks it up implicitly from that.
2025-03-13 13:37:18 -05:00
Florian Hahn
02575f887b
[VPlan] Use VPInstruction for VPScalarPHIRecipe. (NFCI) (#129767)
Now that all phi nodes manage their incoming blocks through the
VPlan-predecessors, there should be no need for having a dedicate
recipe, it should be sufficient to allow PHI opcodes in VPInstruction.

Follow-ups will also migrate VPWidenPHIRecipe and possibly others,
building on top of https://github.com/llvm/llvm-project/pull/129388.

PR: https://github.com/llvm/llvm-project/pull/129767
2025-03-13 18:35:07 +00:00
Joseph Huber
e8e267ec42
[libc] Remove use of C++ STL features from rpc_server.cpp (#131169)
Summary:
This is done in preparation for making this header only so we can use it
without an object library. This will be a transient interface that
internal LLVM stuff with use. External people can use it too if they go
through the LLVM libc interface for shared stuff but there's no backward
compatibility guarantees.

Patch just cleans it up prior to the move.
2025-03-13 13:24:42 -05:00
Peng Liu
3bd71cbec7
[libc++] Fix ambiguous call in {ranges, std}::find (#122641)
This PR fixes an ambiguous call encountered when using the `std::ranges::find` or `std::find`
algorithms with `vector<bool>` with small `allocator_traits::size_type`s, an issue reported
in #122528. The ambiguity arises from integral promotions during the internal bitwise
arithmetic of the `find` algorithms when applied to `vector<bool>` with small integral
`size_type`s. This leads to multiple viable candidates for small integral types:
__libcpp_ctz(unsigned), __libcpp_ctz(unsigned long), and __libcpp_ctz(unsigned long long),
none of which represent a single best viable match, resulting in an ambiguous call error.

To resolve this, we propose invoking an internal function __countr_zero as a dispatcher
that directs the call to the appropriate overload of __libcpp_ctz. Necessary amendments
have also been made to __countr_zero.
2025-03-13 14:15:03 -04:00
u4f3
e61859f14d
[RISCV] Add Qualcomm uC Xqcili (load large immediates) extension (#130012)
The Xqcili extension includes a two instructions that load large
immediates than is available with the base RISC-V ISA.

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.
2025-03-13 11:13:02 -07:00
Kelvin Li
c2b66ce655
[flang][OpenMP] Silence unused-but-set-variable message (NFC) (#130979) 2025-03-13 14:09:47 -04:00
Peng Liu
4baf1c03fa
[libc++] Optimize ranges::rotate for vector<bool>::iterator (#121168)
This PR optimizes the performance of `std::ranges::rotate` for
`vector<bool>::iterator`. The optimization yields a performance
improvement of up to 2096x.

Closes #64038.
2025-03-13 14:07:23 -04:00
Valentin Clement (バレンタイン クレメン)
369da8421c
[flang][cuda] Allow assumed-size declaration for SHARED variable (#130833)
Avoid triggering an assertion for shared variable using the assumed-size
syntax.

```
attributes(global) subroutine sharedstar()
  real, shared :: s(*) ! ok. dynamic shared memory.
end subroutine
```
2025-03-13 11:06:17 -07:00
Kuo, Mei-Chun
e93e0dd10c
[NFC] Fix formatting for #80963 (#131100)
This PR fixes formatting issues in `constructor-template.cpp` introduced
in #130866.

Changes:  
- Ran `clang-format` to adhere to LLVM style guidelines.  
- No functional changes.  

CC: @cor3ntin @shafik 
Thanks
2025-03-13 19:02:42 +01:00
Aaron Ballman
5af5fb0555 [C2y] Claim conformance to WG14 N3482
This paper makes it a constraint violation (instead of UB) to call
va_start from a function with a fixed (non-variadic) parameter list.
This is something Clang has always diagnosed as an error.
2025-03-13 13:59:17 -04:00