Commit Graph

560708 Commits

Author SHA1 Message Date
Lang Hames
bfc732efbd [orc-rt] Add ControllerAccess interface. (#169598)
ControllerAccess provides an abstract interface for bidirectional RPC
between the executor (running JIT'd code) and the controller (containing
the llvm::orc::ExecutionSession). ControllerAccess implementations are
expected to implement IPC / RPC using a concrete communication method
(shared memory, pipes, sockets, native system IPC, etc).

Calls from executor to controller are made via callController, with
"handler tags" (addresses in the executor) specifying the target handler
in the controller. A handler must be associated in the controller with
the given tag for the call to succeed. This ensures that only registered
entry points in the controller can be used, and avoids leaking
controller addresses into the executor.

Calls in both directions are to "wrapper functions" that take a buffer
of bytes as input and return a buffer of bytes as output. In the ORC
runtime these must be `orc_rt_WrapperFunction`s (see
Session::handleWrapperCall). The interpretation of the byte buffers is
up to the wrapper functions: the ORC runtime imposes no restrictions on
how the bytes are to be interpreted.

ControllerAccess objects may be detached from the Session prior to
Session shutdown, in which case no further calls may be made in either
direction, and any pending results (from calls made that haven't
returned yet) should return errors. If the ControllerAccess class is
still attached at Session shutdown time it will be detached as part of
the shutdown process. The ControllerAccess::disconnect method must
support concurrent entry on multiple threads, and all callers must block
until they can guarantee that no further calls will be received or
accepted.
2025-11-26 14:53:00 +11:00
Jan Voung
222ba6f5ce [clang][dataflow] Handle more glvalue cases of the ConditionalOperator transfer (#168994)
In the dataflow framework, the builtin transfer function currently only
handles the GLValue result case of ConditionalOperator when the
true and false expression StorageLocations are exactly the same.

Ideally / we have wanted to introduce alias sets to handle when the Locs
are different. However, that is a larger change to the framework
(and we may need to introduce weak updates).

For now, do something simpler to at least handle when the GLValue is
immediately cast to an RValue, by making up a distinct StorageLocation
that holds the join of the true and false expression values (when not a
record). This seems like the most common case, so seems worth covering.
The case when an LValue is needed and can be updated later (and
thus needs a link to the original storage locations) seems more rare,
and we currently do not handle such updates either, so this intermediate
step is no different (for that case).
2025-11-25 22:34:43 -05:00
Wenju He
1ea4aa1b91 [libclc] Use __scoped_atomic_udec/uinc_wrap to implement _clc_atomic_dec/inc (#168327) 2025-11-26 11:22:47 +08:00
Brandon Wu
40f21a7b2f [llvm][RISCV] Support P Extension CodeGen (#167895)
This patch supports: PSLLI_B, PSLLI_H, PSLLI_W, PSSLAI_H and PSSLAI_W
2025-11-26 03:10:28 +00:00
Aiden Grossman
175168c620 [Analysis] Make ThreadSafety correctly handle base class destructors (#169593) 2025-11-25 18:50:11 -08:00
Florian Mayer
44c8a01176 [compiler-rt] [UBSan] remove unneeded test cases (#169594)
the target handling will be done in the driver, so removing codegen
tests.
2025-11-26 02:37:55 +00:00
Brandon Wu
d889b97f2b [RISCV][llvm] Support BUILD_VECTOR codegen for P extension (#169083) 2025-11-26 10:35:04 +08:00
Wenju He
5d38cddc3b [Clang] Add __scoped_atomic_uinc_wrap and __scoped_atomic_udec_wrap builtins (#168666)
This PR extends __scoped_atomic builtins with inc and dec functions.
They map to LLVM IR `atomicrmw uinc_wrap` and `atomicrmw udec_wrap`.
These enable implementation of OpenCL-style atomic_inc / atomic_dec with
wrap semantics on targets supporting scoped atomics (e.g. GPUs).

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-26 09:29:55 +08:00
Alex Duran
3f22ed1152 [OFFLOAD] Add support for indexed per-thread containers (#164263)
Split from #158900 it adds a PerThreadContainer that can use STL-like
indexed containers based on a slightly refactored PerThreadTable.

---------

Co-authored-by: Joseph Huber <huberjn@outlook.com>
2025-11-26 02:21:09 +01:00
Aiden Grossman
bd04ef6df5 Revert "[clangd] Make lit tests work with the internal shell"
This reverts commit 9c414c428d.

This one is causing buildbot failures too at CMake configure time:
1. https://lab.llvm.org/buildbot/#/builders/193/builds/12452
2025-11-26 01:16:10 +00:00
Aiden Grossman
4cfbc44ebe Revert "[clangd] Enable lit internal shell by default"
This reverts commit c51c382c87.

This breaks at least one buildbot:
1. https://lab.llvm.org/buildbot/#/builders/134/builds/30460
2025-11-26 00:56:44 +00:00
Aiden Grossman
c51c382c87 [clangd] Enable lit internal shell by default
Enable it now that all of the tests pass under the internal shell. The
internal shell is slightly faster (10-15%) and also provides a better
debugging experience.

Reviewers: petrhosek, ilovepi, kadircet, HighCommander4

Reviewed By: ilovepi

Pull Request: https://github.com/llvm/llvm-project/pull/169540
2025-11-25 16:47:06 -08:00
Aiden Grossman
9c414c428d [clangd] Make lit tests work with the internal shell
This makes all of the clangd tests work with the internal shell.
Modifications needed for each test are as follows:
1. system-include-extractor.test was using variable expansion which is
   not supported in the internal shell. This patch rewrites it to use
   the readfile mechanism along with python. This isn't super pretty but
   is readily understandable and there are only two tests across the
   monorepo that use this construction, so making it prettier is hard to
   justify.
2. include-cleaner-batch-fix.test - Was using $'' construction to create
   new lines in a string. Simply replace it with multiple echo commands
   to be canonical with the rest of the repository.
3. index-tools.test - Just add IndexBenchmark to the clangd test
   depends, so the test now just works unconditionally. This should
   significantly increase test coverage at little cost.

Reviewers: ilovepi, HighCommander4, petrhosek, kadircet

Reviewed By: ilovepi

Pull Request: https://github.com/llvm/llvm-project/pull/169539
2025-11-25 16:46:25 -08:00
Florian Mayer
1c034a3724 [compiler-rt] [UBsan] precommit test (#169579) 2025-11-25 15:46:50 -08:00
Valentin Clement (バレンタイン クレメン)
f7a9fcad99 [flang][cuda] Use PTX instruction for atomicAdd with 4xf32 (#169581)
Implementation similar to the clang one in
`clang/lib/Headers/__clang_cuda_intrinsics.h`
2025-11-25 23:45:24 +00:00
Krzysztof Parzyszek
fd22706e93 [flang][OpenMP] Skip compiler directives in getCollapsedLoopEval (#169565)
Use `getNestedDoConstruct` from Utils to get the nested DoConstructs.

Fixes https://github.com/llvm/llvm-project/issues/169532
2025-11-25 17:30:28 -06:00
Lang Hames
9534ed9f30 [orc-rt] Add ErrorAsOutParameter convenience constructor. (#169467)
Allows construction of ErrorAsOutParameters from Error references.
2025-11-26 09:58:53 +11:00
Alan Li
ebf5d9ef7d Revert "Redesign Straight-Line Strength Reduction (SLSR) (#162930)" (#169546)
This reverts commit f67409c3ec.

cc @fiigii 
Including us, several separate groups are experiencing regressions with
this change. This is the smallest reproducer pasted by @akuegel :
https://github.com/llvm/llvm-project/pull/162930#issuecomment-3574307330
2025-11-25 17:44:12 -05:00
Andres-Salamanca
97023fba55 [CIR] Emit ready and suspend branches for cir.await (#168814)
This PR adds codegen for `cir.await` ready and suspend. One notable
difference from the classic codegen is that, in the suspend branch, it
emits an `AwaitSuspendWrapper`(`.__await_suspend_wrapper__init`)
function that is always inlined. This function wraps the suspend logic
inside an internal wrapper that gets inlined. Example here:
https://godbolt.org/z/rWYGcaaG4
2025-11-25 17:16:21 -05:00
daniilavdeev
5f777b2c8f [dwarf] make dwarf fission compatible with RISCV relaxations 1/2 (#166597)
Currently, -gsplit-dwarf and -mrelax are incompatible options in Clang.
The issue is that .dwo files should not contain any relocations, as they
are not processed by the linker. However, relaxable code emits
relocations in DWARF for debug ranges that reside in the .dwo file when
DWARF fission is enabled.

This patch makes DWARF fission compatible with RISC-V relaxations. It
uses the StartxEndx DWARF forms in .debug_rnglists.dwo, which allow
referencing addresses from .debug_addr instead of using absolute
addresses. This approach eliminates relocations from .dwo files.
2025-11-26 00:52:22 +03:00
Razvan Lupusoru
4f39a4ff0a [acc][flang] Add getInitRegion() to GlobalVariableOpInterface (#169569)
Some globals (e.g., fir.global) have initialization regions that may
transitively reference other globals or type descriptors. Add
getInitRegion() to GlobalVariableOpInterface to retrieve these regions,
returning Region* (nullptr if the global uses attributes for
initialization, as with memref.global).
2025-11-25 13:44:11 -08:00
Haowei
49828c23b5 [Fuchsia] Bump minimal OS X target to 11.0 (#169568)
libcxx requires minimal macOS 11 to build. This patch bumps the minimal
OS X target in Fuchsia's cmake cache file to 11.0 to satisfy this
requirement.
2025-11-25 13:40:53 -08:00
Md Abdullah Shahneous Bari
9bf78ab8dd Revert "[GPUToXeVMPipeline][Pipeline] Modify pipeline to add convert-vector-to-llvm." (#169570)
Reverts llvm/llvm-project#166204

There was a build issue due to a missing dependency.
2025-11-25 15:36:54 -06:00
Florian Hahn
e894654532 [SCEV] Add tests for UDiv canonicalization of AddRecs that may wrap.
Add test cases for canonicalizing AddRecs that may wrap.
2025-11-25 21:33:26 +00:00
Christopher Ferris
074d17e9c8 [scudo] Lock/unlock MutexTSDs in disable/enable. (#169440)
It is possible that a fork could occur while MutexTSDs is being held and
then cause a deadlock in a forked process when something attempts to
lock it again. Instead add it to the enable/disable list of mutexes.
2025-11-25 13:20:09 -08:00
Alexey Bataev
00ffc70ba1 [SLP][NFC]Add a test with commutative instruction with non-commutative op, NFC 2025-11-25 12:58:20 -08:00
Florian Hahn
091aece72b [VPlan] Remove redundant transferFlags call from replicateByVF (NFC).
Flags are now passed on construction/cloning. Remove unnecessary
transferFlags call, and make code independent of VPRecipeWithIRFlags, to
support additional recipes in the future.
2025-11-25 20:57:42 +00:00
Helena Kotas
c475f8e5d8 [HLSL] Update vector swizzle elements individually (#169090)
When individual elements of a vector are updated via vector swizzle, it needs to be handled as separate store operations to the individual vector elements.

Clang treats vectors as one unit, so if a part of a vector needs to be updated, the whole vector is loaded, some elements modified, and then the whole vector is stored.

In HLSL vector elements are handled separately. We need to avoid this load/modify/store sequence to prevent overwriting other vector elements that might be getting updated in parallel.

Fixes #152815
2025-11-25 12:50:25 -08:00
Andy Kaylor
1c9368e01e [CIR] Upstream non-record array init handling (#169429)
This upstreams the code to handle member initialization for non-record
arrays.
2025-11-25 12:33:18 -08:00
Jay Foad
dbcf5688cc [AMDGPU] Simplify VT comparisons. NFC. (#169526)
Automated with `sed -i 's/\.Value//g' lib/Target/AMDGPU/*.td` plus a
tiny bit of manual reformatting.
2025-11-25 20:22:56 +00:00
Sam Elliott
8d920725ca [RISCV] Use FMV.D for moving GPRPairs on RV32_Zdinx (#169556)
This is noted by the specification, and should save a dynamic
instruction.

Code size should be no worse than before, as the pairs of moves can
usually be turned into two 16-bit moves, but `fmv.d` is always a 32-bit
instruction.

LLVM can look through a `FSGNJ_D_IN32X`, in
`RISCVInstrInfo::isCopyInstrImpl` which helps copy propagation.
2025-11-25 20:03:56 +00:00
Petr Penzin
ad3d9fb3ca [RISCV] tt-ascalon-d8 vector scheduling (#167066)
Add the vector scheduling model for tt-ascalon-d8 and corresponding
llvm-mca tests.

---------

Co-authored-by: Craig Topper <craig.topper@sifive.com>
2025-11-25 11:44:52 -08:00
Valentin Clement (バレンタイン クレメン)
0f941f6866 [flang][cuda] Add support to allocate scalar character types (#169550)
Add support for character declared like: 

```
subroutine sub1()
  character*4, device :: b
end subroutine
```
2025-11-25 11:41:35 -08:00
Sergei Druzhkov
3694798210 [lldb-dap] Add format support for evaluate request (#169132)
This patch adds support for format option in the `evaluate` request
according to
[DAP](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Evaluate)
specification. Also, fixed typo in `LLDB_DAP_INVALID_VARRERF` constant.
2025-11-25 22:38:25 +03:00
Krzysztof Drewniak
af0fcf85c8 [mlir][tblgen] Don't echo absolute paths into rewrite pattern source (#168984)
Currently, the declarative pattern rewrite generator will always print
the [source]:[line](s) from which a pattern came. This is a useful
debugging hint, but it causes problem when absolute paths are used as
arguments to mlir-tblgen (which LLVM's build rules automatically do).
Specifially, it causes the source to be tied to the build location,
harning reproducability and our collective ability to get ccache hits
from, say, separate worktrees.

This commit resolves the issue by replacing absolute paths in thes
"Generated from:" comments with their filenames. (The alternative would
have been to implement an entire file-prefix-map the way the C compilers
do, but since this is an isolated incident, I chose to resolve it
locally.)
2025-11-25 11:30:43 -08:00
Kazu Hirata
0917a38c69 [PowerPC] Fix a warning
This patch fixes:

  llvm/lib/Target/PowerPC/PPCISelLowering.cpp:15676:17: error: unused
  variable 'CC' [-Werror,-Wunused-variable]
2025-11-25 11:22:31 -08:00
Maksim Panchenko
6c48fbc1dc [BOLT][Tests] Use AT&T assembler syntax only for X86 tests (#169541)
Enabling AT&T syntax for all tests is broken when X86 target is not
enabled as reported in #167225.
2025-11-25 11:15:24 -08:00
Krzysztof Parzyszek
ebe4006654 [mlir] Fix build failure with BUILD_SHARED_LIBS=ON
/usr/bin/ld: tools/mlir/lib/Dialect/GPU/Pipelines/CMakeFiles/obj.MLIRGP
UPipelines.dir/GPUToXeVMPipeline.cpp.o: in function `mlir::gpu::buildLo
werToXeVMPassPipeline(mlir::OpPassManager&, mlir::gpu::GPUToXeVMPipelin
eOptions const&)':
GPUToXeVMPipeline.cpp:(.text._ZN4mlir3gpu28buildLowerToXeVMPassPipeline
ERNS_13OpPassManagerERKNS0_24GPUToXeVMPipelineOptionsE+0x1293): undefin
ed reference to `mlir::createConvertVectorToLLVMPass()'
2025-11-25 13:05:14 -06:00
Craig Topper
eab23e199a [RISCV] Don't add Zilsd pairing hints if other part of the pair is reserved. (#169538) 2025-11-25 10:58:45 -08:00
Craig Topper
3a27fc4811 [RISCV] Omit VTYPE in VSETVLIInfo::print() when state is uninit or unknown. (#169459) 2025-11-25 10:57:17 -08:00
Matt Arsenault
2ee12f191a AMDGPU: Use RegClassByHwMode to manage GWS operand special case (#169373)
On targets that require even aligned 64-bit VGPRs, GWS operands
require even alignment of a 32-bit operand. Previously we had a hacky
post-processing which added an implicit operand to try to manage
the constraint. This would require special casing in other passes
to avoid breaking the operand constraint. This moves the handling
into the instruction definition, so other passes no longer need
to consider this edge case. MC still does need to special case this,
to print/parse as a 32-bit register. This also still ends up net
less work than introducing even aligned 32-bit register classes.

This also should be applied to the image special case.
2025-11-25 18:55:34 +00:00
Jez Ng
20ca85b69f [lld] macho: Support section branch relocations, including the 1-byte form (#169062)
I noticed that we had a hardcoded value of 4 for the pcrel section
relocations, which seems like an issue given that we recently added
support for 1-byte branch relocations in
https://github.com/llvm/llvm-project/pull/164439. The code included an
assert that the relevant relocation had the BYTE4 attribute, but that is
actually not enough to use a hardcoded value of 4: we need to assert
that the *other* `BYTE<n>` attributes are not set either.

However, since we did not support local branch relocations, that doesn't
seem to have mattered in practice. That said, local branch relocations
can be emitted by compilers, and ld64 does handle the 4-byte version of
them, so I've added support for it here.

ld64 actually seems to reject 1-byte section relocations, so the
questionable code is actually probably fine (minus the incorrect
assert). So we have two options: add an equivalent check in LLD, or just
support 1-byte local branch relocations. Supporting it actually requires
less code, so I've gone with that option here.
2025-11-25 13:54:46 -05:00
Matt Arsenault
622dbb372b AMDGPU: Add more tests for 32-bit constant address space (#168976)
The sub-dword cases just assert now, so comment those out.
2025-11-25 18:53:28 +00:00
Zahira Ammarguellat
2d78b1409e [OpenMP][Clang] Parsing/Sema support for need_device_ptr(fb_nullify/fb_preserve). (#168905)
This patch adds parsing, semantic handling, and diagnostics for the
`OpenMP 6.1 fb_nullify` and` fb_preserve` fallback modifiers used with
the `need_device_ptr` map modifier.
2025-11-25 13:48:37 -05:00
Amr Hesham
a8e0afe988 [CIR] ArraySubscriptExpr on ExtVectorElementExpr (#169158)
Implement ArraySubscriptExpr support for ExtVectorElementExpr
2025-11-25 19:44:13 +01:00
Erich Keane
dce95b2ea4 [OpenACC][CIR][NFC] Remove 'NYI' diagnostics, since we're done with t… (#169543)
…hese

We've finished all of the clauses/etc that we're going to use this
visitor for, so we can remove the SourceLocation we used just for that,
and replace all NYI with unreachables.
2025-11-25 18:43:15 +00:00
Walter Lee
6c8ff4f2bb [NVPTX] Fix maybe unused variable in 17852ded (#169542) 2025-11-25 18:35:15 +00:00
Drew Kersnar
8f1bb92bbf [NVPTX] Fix lit test issues from masked load/store implementation (#169535)
From this commit:
17852deda7,
Build was broken here:
https://lab.llvm.org/buildbot/#/builders/155/builds/15135/steps/7/logs/stdio.
I think this should fix things.
2025-11-25 12:27:31 -06:00
Matt Arsenault
1d30ae6e40 AMDGPU: Stop forcing RequiresCodeGenSCCOrder (#169522)
This hasn't been strictly necessary since c897c13dde.
Practically this makes little difference; we still enable IPRA
by default which implies this option. By removing this explicit
force, -enable-ipra=0 has the expected change in the pass pipeline
to remove the DummyCGSCC runs.
2025-11-25 13:23:55 -05:00
Ellis Hoag
d7dcc108fc [GitHub] Add review instructions for commit access requests (#168971)
As discussed in
https://discourse.llvm.org/t/clarification-on-how-to-accept-commit-access-requests/88728,
clarify reviewer instructions for how to accept commit access requests.
2025-11-25 10:22:23 -08:00