547621 Commits

Author SHA1 Message Date
Jon Roelofs
a15b629527
Revert "Strip the full path from __FILE__ in the LDBG macro and keep only the filename (#150677)"
This reverts commit 5d26e3c227f4b4a1761a8b0001b3165198def479.

It breaks the modules build of clang, since every source file has a different
version of this macro, which causes
https://green.lab.llvm.org/job/clang-stage2-Rthinlto/ to run out of space. We
should probably be using __FILE_NAME__ instead when the host compiler supports
it, but until then let's revert-to-green, and un-block the bots.

see: https://github.com/llvm/llvm-project/pull/150677
see: https://github.com/llvm/llvm-project/pull/150677#issuecomment-3156779021

rdar://157465825
2025-08-05 18:47:46 -07:00
Matt Arsenault
342bf58f93
RuntimeLibcalls: Add entries for __security_check_cookie (#151843)
Avoids hardcoding string name based on target, and gets
the entry in the centralized list of emitted calls.
2025-08-06 10:26:36 +09:00
khaki3
8470027f25
[flang][acc] Add a semantic check for the validity of nested parallelism (#152225)
This PR implements a semantic checker to ensure the legality of nested
OpenACC parallelism. The following are quotes from Spec 3.3. We need to
disallow loops from having parallelism at the same level as or at a
sub-level of child loops.

>**2.9.2 gang clause**
>[2064] <ins>When the parent compute construct is a parallel
construct</ins>, or on an orphaned loop construct, the gang clause
behaves as follows. (...) The associated dimension is the value of the
dim argument, if it appears, or is dimension one. The dim argument must
be a constant positive integer with value 1, 2, or 3.
>[2112] The region of a loop with a gang(dim:d) clause may not contain a
loop construct with a gang(dim:e) clause where e >= d unless it appears
within a nested compute region.

>[2074] <ins>When the parent compute construct is a kernels
construct</ins>, the gang clause behaves as follows. (...)
>[2148] The region of a loop with the gang clause may not contain
another loop with a gang clause unless within a nested compute region.

>**2.9.3 worker clause**
>[2122]/[2129] The region of a loop with the worker clause may not
contain a loop with the gang or worker clause unless within a nested
compute region.

>**2.9.4 vector clause**
>[2141]/[2148] The region of a loop with the vector clause may not
contain a loop with a gang, worker, or vector clause unless within a
nested compute region.

https://openacc.org/sites/default/files/inline-images/Specification/OpenACC-3.3-final.pdf
2025-08-05 18:21:31 -07:00
tangaac
b05e26be8a
[LoongArch] Optimize extracting f32/f64 from 256-bit vector by using XVPICKVE. (#151914) 2025-08-06 09:11:34 +08:00
Steven Perron
fe0948c9a5
[HLSL][SPIRV] Add vk::binding attribute (#150957)
The vk::binding attribute allows users to explicitly set the set and
binding for a resource in SPIR-V without chaning the "register"
attribute, which will be used when targeting DXIL.

Fixes https://github.com/llvm/llvm-project/issues/136894
2025-08-05 21:00:06 -04:00
Peter Collingbourne
813e477155 Mention MTE in the HWASan design doc. 2025-08-05 17:49:05 -07:00
Mircea Trofin
f675483905
[profcheck] Annotate select instructions (#152171)
For `select`, we don't have the equivalent of the branch probability analysis to offer defaults, so we make up our own and allow their overriding with flags.

Issue #147390
2025-08-06 02:48:50 +02:00
Oliver Hunt
7268478295
[clang][PAC] Fix PAC codegen for final class dynamic_cast optimization (#152227)
The codegen for the final class dynamic_cast optimization fails to
consider pointer authentication. This change resolves this be simply
disabling the optimization when pointer authentication enabled.
2025-08-05 17:41:55 -07:00
Matt Arsenault
de09c27f5e
ARM: Simplify logic for default libcall calling convention (#152166) 2025-08-06 09:41:37 +09:00
Peter Collingbourne
ab209cafdc Add link to CFI design doc to the documentation index. 2025-08-05 17:31:15 -07:00
Rahul Joshi
7b9786b4a6
[NFC][TableGen] Capitalize comments in TGLexer.cpp (#152224) 2025-08-05 17:26:08 -07:00
Amy Huang
9e9bf7ac5b
Update the cmake options in libc windows build docs (#152205)
Add the LLVM_ENABLE_RUNTIMES option and remove some that are out of date
or already the default setting.
2025-08-05 16:57:16 -07:00
Matt Arsenault
d44754c344
ARM: Remove redundant or buggy config of __aeabi_d2h (#152126)
This was set if `TT.isTargetAEABI()`. This was previously set above
if `TM.isAAPCS_ABI() && (TT.isTargetAEABI() || TT.isTargetGNUAEABI() ||
                         TT.isTargetMuslAEABI() || TT.isAndroid())`.

So this could differ based on a manually specified -target-abi flag due
to the `isAAPCS_ABI` part of the original condition. I'm guessing
these should be consistent, so either this second group of
setLibcallImpl
calls should have been guarded by the `isAAPCS_ABI` check, or the first
condition should remove it.

There doesn't appear to be any meaningful test coverage using the
manually specified ABI option, so #152108 tries to remove it
2025-08-06 08:48:01 +09:00
Adam Nemet
124722bfe5
Revert "[CG] Add VTs for v[567]i1 and v[567]f16" (#152217)
Reverts llvm/llvm-project#151763

It caused: https://github.com/llvm/llvm-project/issues/152150
2025-08-05 16:47:50 -07:00
Rahul Joshi
315e1f59c8
[NFC] Run clang-format on TGLexer and TGParser (#151509)
In https://github.com/llvm/llvm-project/pull/149248, clang-format
applied some formatting to lines untouched by that PR, because the
existing code is not clang-format compliant. Hence applying clang-format
on the entire files here.
2025-08-05 16:37:29 -07:00
Thurston Dang
435b8b51dc
[sanitizer] Don't TestPTrace() if SPARC; don't give up if internal_fork() fails (#152072)
Fixes corner cases of https://github.com/llvm/llvm-project/pull/151406:
- Don't run TestPTrace() on SPARC, because internal_fork() on SPARC
actually calls __fork(). We can't safely __fork(), because it's possible
seccomp has been configured to disallow fork() but allow clone().
- if internal_fork() fails for whatever reason, we shouldn't give up. It
is strictly worse to give up early than to attempt StopTheWorld.

Also updates some comments/TODOs.
2025-08-05 16:31:35 -07:00
Stanislav Mekhanoshin
b8eb61adc9
[AMDGPU] Implement addrspacecast from flat <-> private on gfx1250 (#152218) 2025-08-05 16:25:23 -07:00
Jonas Devlieghere
4c2d56318f
[lldb] Drop PY_MINOR_VERSION >= 3 check (NFC)
The minimum supported Python version is now 3.8, so there's no supported
configuration where the minor version is less than 3.
2025-08-05 16:21:22 -07:00
Igor Kudrin
600976f4bf Revert "[lldb] Fix auto advance PC in EmulateInstructionARM64 if PC >= 4G (#151460)"
This reverts commit 64eba6ef9610a4a82e1610ecd806b8488144bad0.

It breaks on lldb-arm-ubuntu
2025-08-05 16:18:01 -07:00
Craig Topper
73685583c8
[VP][RISCV] Add a vp.load.ff intrinsic for fault only first load. (#128593)
There's been some interest in supporting early-exit loops recently.
https://discourse.llvm.org/t/rfc-supporting-more-early-exit-loops/84690

This patch was extracted from our downstream where we've been using it
in our vectorizer.
2025-08-05 16:12:42 -07:00
Igor Kudrin
64eba6ef96
[lldb] Fix auto advance PC in EmulateInstructionARM64 if PC >= 4G (#151460)
The `EmulateInstructionARM64::EvaluateInstruction()` method used
`uint32_t` to store the PC value, causing addresses greater than 2^32 to
be truncated.

As for now, the issue does not affect the mainline because the method is
never called with both `eEmulateInstructionOptionAutoAdvancePC` and
`eEmulateInstructionOptionIgnoreConditions` options set. However, it can
trigger on a downstream that uses software stepping.
2025-08-05 15:42:08 -07:00
Joseph Huber
3bc1b15235 [OpenMP] Fix weak linkage on malloc declaration
Summary:
This being weak forces the external reference to be weak. Either we
define it weak or not by pulling it from `libc`. Doing it here causes it
to not be extracted properly.
2025-08-05 17:38:59 -05:00
Jasmine Tang
9c6bb18040
[WebAssembly] Constant fold wasm.dot (#149619)
Constant fold wasm.dot of constant vectors/splats.

Test case added in
`llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/dot.ll`

Related to https://github.com/llvm/llvm-project/issues/55933
2025-08-05 15:22:37 -07:00
Stanislav Mekhanoshin
34aed0ed56
[AMDGPU] Add gfx1250 wmma_scale[16]_f32_32x16x128_f4 instructions (#152194) 2025-08-05 15:15:21 -07:00
Caslyn Tonelli
5a076e3b4d
[libc] Add dladdr to dlfcn.h (#149872)
A initial commit for #97929, this adds a stub implementation for
`dladdr` and includes the definition for the `DL_info` type used as one
of its arguments.

While the `dladdr` implementation relies on dynamic linker support, this
patch will add its prototype in the generated `dlfcn.h` header so that
it can be used by downstream platforms that have their own `dladdr`
implementation.
2025-08-05 15:06:08 -07:00
Daniel Paoliello
07da480614
[win][arm64ec] More fixes for building and testing Arm64EC Windows (#151409)
* `tools/llvm-objcopy/MachO/update-section-object.test` was failing on
Windows since the input file (`macho_sections.s`) might be checked out
with the wrong line ending, resulting in difference in the size of
sections being checked.
* Removed the check for Windows in `AArch64Arm64ECCallLowering`: when
`llc` is run without an explicit target, the module's target triple is
unknown so this assert fires.
* Expect `llvm/test/CodeGen/Generic/allow-check.ll` to fail for Arm64EC:
Global ISel is not supported.
2025-08-05 14:54:08 -07:00
keinflue
81ed75679d
[clang] Fix constant evaluation of member pointer access into sibling class. (#150829)
HandleMemberPointerAccess considered whether the lvalue path in a member
pointer access matched the bases of the containing class of the member,
but neglected to check the same for the containing class of the member
itself, thereby ignoring access attempts to members in direct sibling
classes.

Fixes #150705.
Fixes #150709.
2025-08-05 14:44:15 -07:00
Charitha Saumya
06884d0204
[mlir][xegpu] Bug fix in UpdateNdOffset distribution. (#150545)
Reason is UpdateNdOffset source operand not retaining the layouts when
it is yielded by the warp op. `warp_execute_on_lane0` op expects that
TensorDesc type is unchanged during distribution out of its region. we
use UnrealizedCasts to reconcile this mismatch outside the warpOp (via
`resolveDistributedTy`)
2025-08-05 14:42:14 -07:00
Stanislav Mekhanoshin
d08c2977e8
[AMDGPU] Add MC support for new gfx1250 src_flat_scratch_base_lo/hi (#152203) 2025-08-05 14:35:48 -07:00
Jonas Devlieghere
dbaa82b384
[lldb] Move the generic MCP code into Protocol/MCP (NFC) (#152188)
This moves all the generic MCP code into the new ProtocolMCP library so
it can be shared between the MCP implementation in LLDB (built on the
private API) and lldb-mcp (built on the public API).

This PR doesn't include the actual MCP server. The reason is that the
transport mechanism will be different between the LLDB implementation
(using sockets) and the lldb-mcp implementation (using stdio). The goal
s to abstract away that difference by making the server use
JSONTransport (again) but I'm saving that for a separate PR.
2025-08-05 14:10:31 -07:00
Peter Klausler
867602742c
[flang] Minor speed-up to module file parsing (#152178)
Module files shouldn't ever produce parsing errors, and if they did in
the case of a badly-generated module file, the compiler will notice and
crash. So we can run the parser on module files with message deferral
enabled, and that saves time that would otherwise be spent generating
messages on failed parsing alternatives that are discarded anyway when
backtracking. It's not a big savings (single digit percentage on overall
compilation time for a big application with lots of modules), but worth
doing.
2025-08-05 13:40:30 -07:00
Peter Klausler
fc9a080780
[flang][runtime] Handle empty NAMELIST value list (#151770)
InputNamelist() returns early if any value list read in by
InputDerivedType() or DescriptorIo<Input>() is empty, since they return
false. But an empty value list is okay, and the early return should
occur only on error.

Fixes https://github.com/llvm/llvm-project/issues/151756.
2025-08-05 13:40:11 -07:00
Peter Klausler
56051daaf0
[flang][runtime] Optimize Descriptor::FixedStride() (#151755)
Put the common cases on fast paths, and don't depend on IsContiguous()
in the general case path. Add a unit test, too.
2025-08-05 13:39:54 -07:00
Peter Klausler
effa35d240
[flang][runtime] Don't always accept a bare exponent letter (#151597)
For more accurate compatibility with other compilers' extensions, accept
a bare exponent letter as valid real input to a formatted READ statement
only in a fixed-width input field. So it works with (G1.0) editing, but
not (G)/(D)/(E)/(F) or list-directed input.

Fixes https://github.com/llvm/llvm-project/issues/151465.
2025-08-05 13:39:33 -07:00
Peter Klausler
aec90f2f27
[flang][runtime] Fix child input bugs under NAMELIST (#151571)
When NAMELIST input takes place on a derived type, we need to preserve
the type in the descriptor that is created for storage sequence
association. Further, the fact that any child list input in within the
context of a NAMELIST must be inherited so that input fields don't try
to consume later "variable=" strings.

Fixes https://github.com/llvm/llvm-project/issues/151222.
2025-08-05 13:39:08 -07:00
Caslyn Tonelli
cfd1ee781f
[libc] Add dlinfo + RTLD_DI_* macros to dlfcn.h (#149938)
An initial commit for #149911, this adds a stub implementation for
dlinfo and the enums list of `RTLD_DI_*` values.

While the dlinfo implementation relies on dynamic linker support, this
patch will add its prototype in the generated dlfcn.h header so that it
can be used by downstream platforms that have their own dlinfo
implementation.
2025-08-05 13:34:30 -07:00
Jann
da6424c9e3
[DebugInfo][DWARF] Don't emit bogus DW_AT_call_target for complex calls (#151378)
On X86-64, LLVM currently generates the same DWARF debug info for `call
rax` and `call [rax]`; in both cases, the generated DWARF claims that
the call goes to address RAX. This bug occurs because the X86 machine
instructions CALL64r and CALL64m both receive register operands, but
those register operands have different semantics.

To fix it, change DwarfDebug::constructCallSiteEntryDIEs() to validate
the callee operand's semantics (`OperandType`) and make sure it is not
semantically describing a memory location.

This fix will result in less DW_TAG_call_site and DW_AT_call_target
entries being generated.

There is an existing test in dwarf-callsite-related-attrs.ll that
asserts the broken behavior; remove the broken check, and instead add a
new test dwarf-callsite-related-attrs-indirect.ll that checks behavior
for indirect calls.

The existing test xray-custom-log.ll is validating something even more
broken: It checks the debug info generated by a PATCHABLE_EVENT_CALL.
`TII->getCalleeOperand()` assumes that the first argument of a call
instruction is always the destination, but the first argument of
PATCHABLE_EVENT_CALL is instead the event structure; and so we were
emitting debug info claiming the callee was stored in a register that
actually contains some kind of xray event descriptor, and the test
validates that this happens.
I am breaking and deleting this test.
I guess the intent there might have been to validate that we emit
debuginfo referencing the target of the direct call that LLVM emits
(which we don't do)? But I'm not sure.
2025-08-05 13:25:01 -07:00
Jeremy Kun
97dee32445
[MLIR][Presburger] add iterVarKind for convenient iterating over variables (#152091)
I find myself doing this alot

```
for (unsigned varIndex = rel.getVarKindOffset(VarKind::Domain);
     varIndex < rel.getVarKindEnd(VarKind::Domain); ++varIndex) {
  ...
}
```

Adding this convenience method so I can instead do

```
for (unsigned varIndex : rel.iterVarKind(VarKind::Domain)) {
  ...
}
```

---------

Co-authored-by: Jeremy Kun <j2kun@users.noreply.github.com>
2025-08-05 13:18:59 -07:00
Florian Hahn
d478502a42
[VPlan] Ensure that IV resume phi for epilogue is always first. (NFCI)
Update handling of canonical IV resume phi for the epilogue loop to make
sure the resume phi for the canonical IV is always the first phi in the
scalar preheader.

This makes it easier to retrieve it in preparePlanForEpilogueVectorLoop.

For now, we keep an assert to make sure we use the same resume phi as
before. This will be removed in the future.
2025-08-05 21:06:41 +01:00
moscickimilosz
c1add93e45
[mlir][spirv] Change Spirv.GlobalVariableOp builtin -> built_in (#152148)
GlobalVariableOp describes that built_in specifies SPIR-V BuiltIn
decoration associated with the op. The attribute was defined as builtin
in the tablegen (no uderscore). This was causing correct
GlobalVariableOp decorations like: built_in("GlobalInvocationId") to be
saved as a new attribute making it impossible to access the built_in
attribute through getBuiltinAttr.
2025-08-05 15:47:37 -04:00
Igor Kudrin
f8a4f61101
[lldb] Avoid a crash after selecting an unknown platform (#151803)
`PlatformList::Create()` added an item to the list even when
`Platform::Create()` returned `nullptr`. Other methods use these items
without checking, which can lead to a crash. For example:

```
> lldb
(lldb) platform select unknown
error: unable to find a plug-in for the platform named "unknown"
(lldb) file a.out-arm64
PLEASE submit a bug report to...
Stack dump:
0.      Program arguments: lldb
1.      HandleCommand(command = "file a.out-arm64 ")
...
```
2025-08-05 12:42:38 -07:00
Jorge Gorbe Moya
c19314f070
[bazel] Port fa39b67de01af189b59f9034ef6228a2951364b0 (#152191) 2025-08-05 12:39:54 -07:00
Martin Storsjö
f355a57728
[libcxx] Initialize vcruntime __std_exception_data in the exception copy ctor (#144329)
This fixes failures in a number of tests, in the
clang-cl-no-vcruntime configuration (where libcxx provides dummy, no-op
replacements of some vcruntime base exception classes), if building with
optimization enabled.

Previously, with optimization enabled, the compiler concluded that these
fields would be uninitialized at the points of asserts in the tests.

This fixes the following tests in this configuration:

llvm-libc++-shared-no-vcruntime-clangcl.cfg.in ::
std/language.support/support.dynamic/alloc.errors/bad.alloc/bad_alloc.pass.cpp
llvm-libc++-shared-no-vcruntime-clangcl.cfg.in ::
std/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_new_length.pass.cpp
llvm-libc++-shared-no-vcruntime-clangcl.cfg.in ::
std/language.support/support.exception/bad.exception/bad_exception.pass.cpp
llvm-libc++-shared-no-vcruntime-clangcl.cfg.in ::
std/language.support/support.exception/exception/exception.pass.cpp
llvm-libc++-shared-no-vcruntime-clangcl.cfg.in ::
std/language.support/support.rtti/bad.cast/bad_cast.pass.cpp
llvm-libc++-shared-no-vcruntime-clangcl.cfg.in ::
std/language.support/support.rtti/bad.typeid/bad_typeid.pass.cpp
2025-08-05 22:11:27 +03:00
Leandro Lacerda
cd0268063d
[Offload][Conformance] Add tests for single-precision math functions (#152013)
This patch adds a new set of conformance tests for single-precision math
functions provided by the LLVM libm for GPUs.

The functions included in this set were selected based on the following
criteria:
- An implementation exists in `libc/src/math/generic` (i.e., it is not
just a wrapper around a compiler built-in).
- The corresponding LLVM CPU libm implementation is correctly rounded.
- The function is listed in Table 65 of the OpenCL C Specification
v3.0.19.
2025-08-05 13:33:20 -05:00
Leandro Lacerda
448c88478d
[libc] Enable the acoshf math function on AMD GPUs (#152157)
This patch adds the `acoshf` math function to the AMDGPU build.
2025-08-05 13:33:11 -05:00
Florian Hahn
47258ca470
[VPlan] Use VPPhi instead of dyn_cast + opcode check in isPhi (NFC). 2025-08-05 19:20:12 +01:00
Florian Hahn
e3ededa0f1
[LV] Add tests with canonical widen IV, reductions in different order.
Add missing test coverage for re-using the resume value from the main
vector loop for the canonical IV in the epilogue.
2025-08-05 19:19:13 +01:00
LLVM GN Syncbot
87a7a9caaf [gn build] Port 8a2d3f5653eb 2025-08-05 18:10:23 +00:00
Kazu Hirata
40fbc76dc8 [lldb] Fix the build
This patch fixes:

  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:623:47:
  error: expected ';' after expression
2025-08-05 11:09:56 -07:00
Jonas Devlieghere
12da87bef1
[lldb] Use Python Bytes instead of Buffer for Binary I/O (NFC) (#152031)
Binary I/O (also called buffered I/O) expects bytes-like objects and
produces bytes objects [1]. Switch from using a Python buffer to using
Python bytes to read the data. This eliminates calls to functions that
aren't part of the Python stable C API.

[1] https://docs.python.org/3/library/io.html#binary-i-o
2025-08-05 10:58:59 -07:00