551738 Commits

Author SHA1 Message Date
tynasello
a205695de4
[Clang] Add template argument support for {con,de}structor attributes. (#151400)
Fixes: https://github.com/llvm/llvm-project/issues/67154

{Con, De}structor attributes in Clang only work with integer priorities
(inconsistent with GCC). This commit adds support to these attributes
for template arguments.

Built off of contributions from [abrachet](https://github.com/abrachet)
in [#67376](https://github.com/llvm/llvm-project/pull/67376).
2025-09-08 20:48:23 +00:00
Hervé Poussineau
0fb2f524f8
[LLD] Recognize 'mipspe' as a PE target name (#157305)
When compiling for target `mipsel-windows-gnu` triple, clang is calling
linker with `mipspe` machine.
Handle this case.
2025-09-08 23:28:54 +03:00
Philip Reames
db746c65b1
[RISCV] Allow constants in tryFoldSelectIntoOp (#157376)
For simm12 constants this allows the use of e.g. addi/xori, and for
non-simm12 constants seems to still produce better code than the default
lowering.
2025-09-08 13:11:34 -07:00
Nirvedh Meshram
daf8f9fc1c
[Linalg] Add rank zero operand support to push down extract slice pattern (#157532)
Currently the pattern would crash for rank 0 operand as it decides the
padding based on affine results, but for rank 0 there are no affine
results in the operand affine map

Signed-off-by: Nirvedh Meshram <nirvedh@gmail.com>
2025-09-08 14:53:02 -05:00
Cyndy Ishida
e7e4caf68d
[clang] Rename overloaded virtual member function to prevent shadowing, NFCI (#157501)
Resolves warnings triggered by `Woverloaded-virtual`
2025-09-08 12:44:46 -07:00
Kazu Hirata
ff33c3b4bb
[llvm] Proofread AdvancedBuilds.rst (#157393) 2025-09-08 12:32:35 -07:00
Kazu Hirata
fc726fbe84
[ADT] Replace Min with variadic std::min (#157390)
Without this patch, NumTagBits and MinTag use a recursive template Min
to compute Min.

This patch replaces Min with variadic std::min.

While I'm at it, this patch changes the type of NumTagBits to static
constexpr int.
2025-09-08 12:32:27 -07:00
Lei Huang
c883f82ce8
[PowerPC][CLANG] DMF VSX Vector float GER 2x (rank-2 update) (#147383)
Add clang builtins for DMF VSX Vector floats:

```
void __builtin_mma_dmxvf16gerx2 (__dmr1024 *, __vector_pair, vec_t);
void __builtin_mma_dmxvf16gerx2nn (__dmr1024 *, __vector_pair, vec_t);
void __builtin_mma_dmxvf16gerx2np (__dmr1024 *, __vector_pair, vec_t);
void __builtin_mma_dmxvf16gerx2pn (__dmr1024 *, __vector_pair, vec_t);
void __builtin_mma_dmxvf16gerx2pp (__dmr1024 *, __vector_pair, vec_t);
void __builtin_mma_pmdmxvf16gerx2 (__dmr1024 *, __vector_pair, vec_t, uint8, uint4, uint2);
void __builtin_mma_pmdmxvf16gerx2nn (__dmr1024 *, __vector_pair, vec_t, uint8, uint4, uint2);
void __builtin_mma_pmdmxvf16gerx2np (__dmr1024 *, __vector_pair, vec_t, uint8, uint4, uint2);
void __builtin_mma_pmdmxvf16gerx2pn (__dmr1024 *, __vector_pair, vec_t, uint8, uint4, uint2);
void __builtin_mma_pmdmxvf16gerx2pp (__dmr1024 *, __vector_pair, vec_t, uint8, uint4, uint2);

void __builtin_mma_dmxvbf16gerx2 (__dmr1024 *, __vector_pair, vec_t);
void __builtin_mma_dmxvbf16gerx2nn (__dmr1024 *, __vector_pair, vec_t);
void __builtin_mma_dmxvbf16gerx2np (__dmr1024 *, __vector_pair, vec_t);
void __builtin_mma_dmxvbf16gerx2pn (__dmr1024 *, __vector_pair, vec_t);
void __builtin_mma_dmxvbf16gerx2pp (__dmr1024 *, __vector_pair, vec_t);
void __builtin_mma_pmdmxvbf16gerx2 (__dmr1024 *, __vector_pair, vec_t, uint8, uint4, uint2);
void __builtin_mma_pmdmxvbf16gerx2nn (__dmr1024 *, __vector_pair, vec_t, uint8, uint4, uint2);
void __builtin_mma_pmdmxvbf16gerx2np (__dmr1024 *, __vector_pair, vec_t, uint8, uint4, uint2);
void __builtin_mma_pmdmxvbf16gerx2pn (__dmr1024 *, __vector_pair, vec_t, uint8, uint4, uint2);
void __builtin_mma_pmdmxvbf16gerx2pp (__dmr1024 *, __vector_pair, vec_t, uint8, uint4, uint2);
```
2025-09-08 15:29:32 -04:00
Maksim Levental
c4181e51d1
[MLIR][Python] remove unnecessary arg.none() = nb::none() pattern (#157519)
We have `arg.none() = nb::none()` in a lot of places but this is no
longer necessary (as of
~[2022](62a23bb87b)).
2025-09-08 12:16:35 -07:00
Morris Hafner
2d1ded20df
[CIR] Fix LLVM lowering crashes after #155244 (#157471)
This patch replaces all uses of `replaceAllUseWith` with `replaceOp`.
This fixes a number of regressions post #155244.
2025-09-08 21:11:22 +02:00
agozillon
e9f5a43d48 [Flang][Test] Attempt to fix target-private-implicit-scalar-map-2.f90 for SLES builds
Attempt to fix the Flang test target-private-implicit-scalar-map-2.f90 for SLES builds
as it is currently failing on the openmp-offload-sles-build-only bot, but seems fine
everywhere else so far.
2025-09-08 14:01:22 -05:00
cmtice
a348588a00
[clang-tools-extra] Remove 'REQUIRES: shell' from lit tests. (#156950)
As preparation for making lit use the internal shell by default in
clang-tools-extra (with significant expected performance gains), this
removes 'REQUIRES: shell' from the clang-tools-extra lit tests that have
it, and updates the one test that was not passing with
'LIT_USE_INTERNAL_SHELL=1' to now pass with the internal shell.
2025-09-08 11:40:17 -07:00
flovent
3b452e0565
[clang-tidy][NFC] Enable modernize-use-auto in clang-tidy config and fix warnings (#157468)
Closes [#156154](https://github.com/llvm/llvm-project/issues/156154)
2025-09-08 21:37:03 +03:00
Nathan Chancellor
df430c33a7
[Frontend] Define __SANITIZE__ macros for kernel address variants (#156543)
GCC defines these macros for both userspace and kernel address
sanitizers:

$ gcc -E -dM -fsanitize=address -x c /dev/null &| string match -er
SANITIZE
    #define __SANITIZE_ADDRESS__ 1
$ gcc -E -dM -fsanitize=kernel-address -x c /dev/null &| string match
-er SANITIZE
    #define __SANITIZE_ADDRESS__ 1
$ gcc -E -dM -fsanitize=hwaddress -x c /dev/null &| string match -er
SANITIZE
    #define __SANITIZE_HWADDRESS__ 1
$ gcc -E -dM -fsanitize=kernel-hwaddress -x c /dev/null &| string match
-er SANITIZE
    #define __SANITIZE_HWADDRESS__ 1

PR #153888 added these same defines for clang but only for the userspace
address sanitizers:

$ clang -E -dM -fsanitize=address -x c /dev/null &| string match -er
SANITIZE
    #define __SANITIZE_ADDRESS__ 1
$ clang -E -dM -fsanitize=kernel-address -x c /dev/null &| string match
-er SANITIZE
$ clang -E -dM -fsanitize=hwaddress -x c /dev/null &| string match -er
SANITIZE
    #define __SANITIZE_HWADDRESS__ 1
$ clang -E -dM -fsanitize=kernel-hwaddress -x c /dev/null &| string
match -er SANITIZE

Match GCC's behavior so that the Linux kernel can eventually drop its
own internal defines.
2025-09-08 11:33:57 -07:00
Louis Dionne
c424468dbf
[libc++] Parse Google Benchmark results into LNT-compatible format (#157466)
This is a step towards being able to easily report benchmark results to
a LNT instance. The LNT format can also be the basis for other tools to
perform A/B comparisons when doing experiments.
2025-09-08 14:32:46 -04:00
Roland McGrath
1f39435567
[gwp_asan] Use anonymous namespace for test helper code (#157205)
Tests can be at top-level or inside an anonymous namespace,
doesn't matter.  But putting their helper code inside anonymous
namespaces both makes the code compatible with compiling using
-Wmissing-declarations and might let the compiler optimize the
test good a bit better.
2025-09-08 11:30:23 -07:00
Roland McGrath
8ddd8045ac
[scudo] Use anonymous namespace for test helper code (#157207)
Tests can be at top-level or inside an anonymous namespace,
doesn't matter.  But putting their helper code inside anonymous
namespaces both makes the code compatible with compiling using
-Wmissing-declarations and might let the compiler optimize the
test good a bit better.
2025-09-08 11:29:52 -07:00
Michael Buch
bdf645bb9b [lldb][test] TestTsanBasic.py: fix function name assertion
Since https://github.com/llvm/llvm-project/pull/133079 we no longer stop
in the stanitizer library when hitting a sanitizer breakpoint. Adjust
the test accordingly.
2025-09-08 19:27:18 +01:00
Daniel Kuts
31199459f4
[DFAJumpThreading] Fix possible null dereference (#157461)
Fixes #157450

---------

Co-authored-by: Nikita Popov <github@npopov.com>
2025-09-09 02:15:06 +08:00
Ryosuke Niwa
49f1751522
[alpha.webkit.UncheckedCallArgsChecker] Don't emit a warning for passing a temporary object as an argument. (#155033)
Since a temporary object lives until the end of the statement, it's safe
to pass such an object as a function argument without explicitly
creating a CheckedRef/CheckedPtr in stack.
2025-09-08 11:13:55 -07:00
Alexey Samsonov
05502de64c
[libc] Clean up errno header usage in a few math/smoke tests. (#157517)
Most of the unit tests don't (or don't need to) read/write libc_errno
code directly - it's cleared by the ErrnoCheckingTest harness, and is
verified by framework-provided scripts such as EXPECT_MATH_ERRNO.

Use the following rule of thumb for header inclusion:
* if you use libc_errno in code literally, include
src/__support/libc_errno.h
* if you only rely on errno constants, include hdr/errno_macros.h

This PR only updates a few tests for acos/asin variants, as a
proof-of-concept. If it goes in, a follow-up PR would update the rest.
2025-09-08 11:09:34 -07:00
Mehdi Amini
1961beaf47 [MLIR] Apply clang-tidy fixes for llvm-prefer-isa-or-dyn-cast-in-conditionals in SimplifyAffineMinMax.cpp (NFC) 2025-09-08 10:48:22 -07:00
Farzon Lotfi
1dbade85cb
[DirectX] Add emulation for fp16 types of llvm.is.fpclass (#157505)
fixes #157504

This changes adds the emulation we need for IsNaN, IsNormal, & IsFinite
This change only applies these emulations to the llvm.is.fpclass cases
of fp16.

Since there is no DX intrinsics yet for these cases, applying the
emulation to the necessary intrinsics is left for future implementers of
- https://github.com/llvm/llvm-project/issues/99132
- https://github.com/llvm/llvm-project/issues/156069
- https://github.com/llvm/llvm-project/issues/99131
2025-09-08 13:47:50 -04:00
Andrei Safronov
393bc0cc9f
[Xtensa] Fix lowering FP compare operations. (#156740)
Implement lowering of the SETONE/SETOGT/SETOGE/SETUGT/SETUGE operations.
This fixes f32 "copysign" and "ueq" tests.

This PR fixes
https://github.com/llvm/llvm-project/issues/149666#event-18712363149
2025-09-08 20:42:52 +03:00
Jason Molenda
693146dcc0 [lldb][yaml2macho-core] Address bug when run on Windows
The two API tests I converted to use yaml2macho-core were failing
on windows.  I was writing the output corefile with fopen(filename,
"w"), and it turns out there was some newline conversion happening
on Windows if a linefeed character was present. Charles Zablit
helped to identify the issue and confirm the fix.  Re-enabling the
two tests on all platforms.

https://github.com/llvm/llvm-project/pull/153911
2025-09-08 10:37:16 -07:00
Daniel Sanders
50b0c34dfb
[lldb] Fix assertion when opcodes are exactly the length of the buffer (#157196) 2025-09-08 10:37:00 -07:00
Simon Pilgrim
d2646cac85
[llvm-mca][x86] Sync resource tests using generic base references (#157511)
Some of the targets isa test coverage seems to have bitrotted or is just missing - resync with the generic reference test files
2025-09-08 17:21:12 +00:00
Andreas Jonson
e11f93e9fd
[SimplifyCFG] Support not in chain of comparisons. (#156497)
Proof: https://alive2.llvm.org/ce/z/cpXuCb
2025-09-08 19:16:41 +02:00
Michael Buch
879f40ab04
[lldb][Instrumentation] Set selected frame to outside sanitizer libraries (#133079)
When hitting a sanitizer breakpoint, LLDB currently displays the frame
in the sanitizer dylib (which we usually don't have debug-info for),
which isn't very helpful to the user. A more helpful frame to display
would be the first frame not in the sanitizer library (we have a
[similar heuristic when we trap inside
libc++](https://github.com/llvm/llvm-project/pull/108825)). This patch
does just that, by implementing the `GetSuggestedStackFrameIndex` API

Depends on https://github.com/llvm/llvm-project/pull/133078
2025-09-08 17:03:31 +00:00
agozillon
262e994c8b
[Flang][OpenMP] Fix default firstprivatization miscategorization of mod file symbols (#157009)
In at least certain cases, notably when equivalence is used (at least
for the example this showed up as a problem in) we currently
miscategorize symbols as firstprivate when they may not be, as they can
throw a false positive when a use symbol from a mod file is picked up.

The fix to this is to chase up the appropriate symbol to access the
correct details.
2025-09-08 18:52:59 +02:00
julianmorillo
f1fa037e2c
Mark test in optimization-remark.f90 as UNSUPPORTED on RISC-V (#157036)
Make the test more tolerant (needed for RISC-V, as this target is not
expected to emit optimization remarks)
2025-09-08 16:36:13 +00:00
Michael Buch
39572f5e91
[lldb][Target] Clear selected frame index after a StopInfo::PerformAction (#133078)
The motivation for this patch is that
`StopInfo::GetSuggestedStackFrameIndex` would not take effect for
`InstrumentationRuntimeStopInfo` (which we plan to implement in
https://github.com/llvm/llvm-project/pull/133079). This was happening
because the instrumentation runtime plugins would run utility
expressions as part of the stop that would set the
`m_selected_frame_idx`. This means `SelectMostRelevantFrame` was never
called, and we would not be able to report the selected frame via the
`StopInfo` object.

This patch makes sure we clear the `m_selected_frame_idx` to allow
`GetSuggestedStackFrameIndex` to take effect, regardless of what the
frame recognizers choose to do.
2025-09-08 17:18:25 +01:00
Slava Zakharin
3ea39a5899
[utils] Process attribute references in lines defining attrs. (#156541)
Here is an example of TBAA attributes generated by Flang:
```
#tbaa_root = #llvm.tbaa_root<id = "Flang function root _QPtest6">
#tbaa_type_desc = #llvm.tbaa_type_desc<id = "any access", members = {<#tbaa_root, 0>}>
```

We have to process the text after `=` to replace the attribute
references with proper check variables.
2025-09-08 09:07:57 -07:00
Twice
aac4eb5c3c
[MLIR][Python] Add a python function to apply patterns with MlirOperation (#157487)
In https://github.com/llvm/llvm-project/pull/94714, we add a python
function `apply_patterns_and_fold_greedily` which accepts an
`MlirModule` as the argument type. However, sometimes we want to apply
patterns with an `MlirOperation` argument, and there is currently no
python API to convert an `MlirOperation` to `MlirModule`.

So here we overload this function `apply_patterns_and_fold_greedily` to
do this (also a corresponding new C API
`mlirApplyPatternsAndFoldGreedilyWithOp`)
2025-09-08 16:05:45 +00:00
Ramkumar Ramachandra
9f7877ffa3
[HashRecognize] Clarify hdr comment on GF(2^n) (NFC) (#157482)
Unify explanation for GF(2^n) and GF(2), which was previously
convoluted.
2025-09-08 15:57:16 +00:00
Sirui Mu
990fe80ce5
[CIR] Add support for atomic compare-and-swap (#156253)
This patch adds support for atomic compare-and-swap operations,
including the following C/C++ instrinsics:

  - `__atomic_compare_exchange`
  - `__atomic_compare_exchange_n`
  - `__c11_atomic_compare_exchange_strong`
  - `__c11_atomic_compare_exchange_weak`
2025-09-08 23:49:10 +08:00
Felipe de Azevedo Piovezan
54b3dc1dad
[lldb][NFC] Fix style issues with StackID.h (#157483)
Some comments were "suffixed" to member variable declarations; these are
moved to before the variable.

Some constructors and operators were just defaulted and not necessary.

Some comments dividing the class into logical sections, like "//
constructors and destructors", were not applied everywhere. These were
removed. They are used in some parts of LLDB, but are the exception.

An include was not needed.

The operator != can be defined in terms of ==.
2025-09-08 08:47:42 -07:00
Finn Plummer
659ed245ed
[DirectX] Add only-section to llvm-objcopy for DXContainer (#156372)
This pr implements the `only-section` option for a `DXContainer` object
in `llvm-objcopy`.

It extends the base `removeParts` of the minimal object representation
of a `DXContainerObject`.

This a pre-requisite step to implement
https://github.com/llvm/llvm-project/issues/150286 as a way to strip all
other information away.
2025-09-08 09:45:41 -06:00
Trevor Gross
79d2961626
[WebAssembly] Update the test for half (NFC) (#152832)
Replace the existing `f16` test with the version that is uses for other
architectures (typically as `half.ll`). This still covers the
conversions from the existing test, but also adds checks for most simple
ops.

Additionally, rename `half-precision.ll` to `fp-intrinsics.ll` to keep
the name similar to this test.
2025-09-08 15:43:51 +00:00
Matthias Springer
216bf6e065
[mlir][Transforms][NFC] Delete dead code (#157491) 2025-09-08 15:43:00 +00:00
Nikita Popov
3eb8a5a589
[TypeSize] Inline conversion to uint64_t (NFC) (#157454)
After #156336 this cast operator has become trivial, so inline it into
the header. This is a minor compile-time improvement.
2025-09-08 17:33:37 +02:00
Victor Chernyakin
ab898f32c6
[clang-tidy][NFC] Do less unnecessary work in NoLintDirectiveHandler (#147553)
Summary:
- `NoLintBlockToken` is too big: it stores a whole `NoLintToken` inside
itself, when all it needs from that `NoLintToken` is its `Pos` and
`ChecksGlob`.
- `formNoLintBlocks` builds up a vector of unmatched tokens, which are
later transformed into errors. We can skip the middle step and make
`formNoLintBlocks` create errors directly.
- In `generateCache`, the line `Cache[FileName] = ...;`
default-constructs a cache entry only to immediately overwrite it. We
can avoid that by using `Cache.try_emplace(FileName, ...);` instead.
- `NoLintToken`'s constructor takes `const std::optional<std::string>&`
when all it needs is `const std::optional<StringRef>&`. This forces its
caller, `getNoLints`, to create temporary strings.
- `NoLintToken::checks` returns `std::optional<std::string>` by value,
creating unnecessary copies in `formNoLintBlocks`.
2025-09-08 08:30:01 -07:00
Ramkumar Ramachandra
ee312fc182
[HashRecognize] Strip excess-TC check (#157479)
Checking if trip-count exceeds 256 is no longer necessary, as we have
moved away from KnownBits computations to pattern-matching, which is
very cheap and independent of TC.
2025-09-08 16:23:13 +01:00
jeanPerier
3beec2f687
[flang] do not rely on existing fir.convert in TargetRewrite (#157413)
TargetRewrite is doing a shallow rewrite of function signatures. It is
only rewriting function definitions (FuncOp), calls (CallOp) and
AddressOfOp. It is not trying to visit each operations that may have an
operand with a function type.
It therefore needs function signature casts around the operations it is
rewriting.

Currently, these casts were not inserted after AddressOfOp rewrites
because lowering tends to always insert function cast after generating
AddressOfOp to the void type so the pass relied on implicitly updating
this cast operand type to get the required cast. This is brittle because
there is no guarantee such convert must be here and canonicalization and
passes may remove them.

Insert a cast after on the result of rewritten operations. If it is
redundant, it will be canonicalized away later.
2025-09-08 17:22:25 +02:00
David Spickett
b45f1fb377 [lldb][test] Disable part of TestDAP_stepInTargets.py
Flakey on our Windows on Arm bot:
https://lab.llvm.org/buildbot/#/builders/141/builds/11378

======================================================================

ERROR: test_supported_capability_other_archs (TestDAP_stepInTargets.TestDAP_stepInTargets.test_supported_capability_other_archs)

----------------------------------------------------------------------

Traceback (most recent call last):

  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py", line 2090, in tearDown

    Base.tearDown(self)

  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py", line 1105, in tearDown

    hook()  # try the plain call and hope it works

    ^^^^^^

  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\packages\Python\lldbsuite\test\tools\lldb-dap\lldbdap_testcase.py", line 521, in cleanup

    self.dap_server.terminate()

  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\packages\Python\lldbsuite\test\tools\lldb-dap\dap_server.py", line 1602, in terminate

    raise DebugAdapterProcessError(process.returncode)

dap_server.DebugAdapterProcessError: lldb-dap returned non-zero exit status 1.

Config=aarch64-C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe

----------------------------------------------------------------------

See #137660
2025-09-08 15:20:15 +00:00
guan jian
83af24dd85
[DAG] Generalize fold (not (neg x)) -> (add X, -1) (#154348)
Generalize `fold (not (neg x)) -> (add X, -1)` to `fold (not (sub Y, X)) -> (add X, ~Y)`

---------

Co-authored-by: Yui5427 <785369607@qq.com>
Co-authored-by: Simon Pilgrim <llvm-dev@redking.me.uk>
2025-09-08 15:12:59 +00:00
Simon Pilgrim
dfbefe4a65
[CostModel][X86] Add missing AVX1 costs for PMULUDQ v4i64 pattern (#157475)
We need to account for AVX1 targets splitting 256-bit PMULUDQ style
patterns - we included a AVX2 cost, but missed out AVX1 despite v4i64
being a legal type

Noticed while working on #156568
2025-09-08 15:06:33 +00:00
Erich Keane
2946879c49
[CIR] Fix assertion order in 'Address' (#157477)
We are checking the 'type' of 'pointer' before we are checking whether
it is null or not! This is clearly incorrect, so this patch reorders the
asserts.
2025-09-08 14:59:31 +00:00
Alexey Bataev
d0ea176cce [SLP]Do not consider SExt/ZExt profitable for demotion, if the user is a bitcast to float
If the user node of the SExt/ZExt node is a bitcast to a float point
type, the node itself should not be considered legal to demote, since
still the casting is required to match the size of the float point type.

Fixes #157277
2025-09-08 07:59:01 -07:00
Joseph Huber
5d550bf41c
[OpenMP] Move `__omp_rtl_data_environment' handling to OpenMP (#157182)
Summary:
This operation is done every time we load a binary, this behavior should
be moved into OpenMP since it concerns an OpenMP specific data struct.
This is a little messy, because ideally we should only be using public
APIs, but more can be extracted later.
2025-09-08 09:58:38 -05:00