544916 Commits

Author SHA1 Message Date
Matt Arsenault
43206d1b2e
Hexagon: Add test for llvm.exp10 intrinsic (#148664)
This is mostly to test the libcall behavior
2025-07-15 08:56:35 +09:00
Craig Topper
f07107337f
[DAGCombiner] Pass SDNodeFlags to getSelect instead of modifying the node returned. (#148733) 2025-07-14 16:50:10 -07:00
Haohai Wen
6b7c6fd8b4
[PseudoProbe] use print to emit function name (#147873)
This PR is part of #123870.

For COFF Asm, function name should be wrapped in quotes.
MCSymbol::print will automatically do that.
2025-07-15 07:49:27 +08:00
Deric C.
352215c6eb
[DirectX] Simplify and correct the flattening of GEPs in DXILFlattenArrays (#146173)
In tandem with #146800, this PR fixes #145370

This PR simplifies the logic for collapsing GEP chains and replacing
GEPs to multidimensional arrays with GEPs to flattened arrays. This
implementation avoids unnecessary recursion and more robustly computes
the index to the flattened array by using the GEPOperator's
collectOffset function, which has the side effect of allowing "i8 GEPs"
and other types of GEPs to be handled naturally in the flattening /
collapsing of GEP chains.

Furthermore, a handful of LLVM DirectX CodeGen tests have been edited to
fix incorrect GEP offsets, mismatched types (e.g., loading i32s from a
an array of floats), and typos.
2025-07-14 16:39:01 -07:00
S. VenkataKeerthy
ec90786ad1
[NFC][IR2Vec] Exposing helpers in IR2Vec Vocabulary (#147841)
Minor refactoring IR2Vec vocabulary. This would help in upcoming PRs related to the IR2Vec tool.

(Tracking issue - #141817)
2025-07-14 16:38:50 -07:00
S. VenkataKeerthy
8ae8b50d36
[NFC][IR2Vec] Minor refactoring of opcode access in vocabulary (#147585)
Refactored IR2Vec vocabulary handling to improve code organization and error handling. This would help in upcoming PRs related to the IR2Vec tool.

(Tracking issue - #141817)
2025-07-14 16:35:24 -07:00
Matt Arsenault
d1db176e82
ARM: Stop setting sincos_stret calling convention (#147457)
This was going out of its way to explicitly mark these as
ARM_AAPCS_VFP. This has been explicitly set since 8b40366b54bd4,
where the commit message states that "sincos" (not sincos_stret)
has a special calling convention. However, that commit also sets
the calling convention for all libcalls to ARM_AAPCS_VFP, and
getEffectiveCallingConv returns the same for CCC anyway in tests
using isWatchABI triples.

The net result of this appears to be a change in behavior when
using -float-abi=soft with isWatchABI, which have no tests so
I assume this is a theoretical combination.

If I assert
```
  if (getTargetMachine().getTargetTriple().isWatchABI()) {
    assert(!useSoftFloat());
    assert(getEffectiveCallingConv(CallingConv::C, false) == CallingConv::ARM_AAPCS_VFP);
  }
```
Only 2 tests fail the second condition, which look like copy paste
accidents
using v7k triples with linux and only needed a filler triple. This is a
consequence
of strangely using the target architecture in place of the OS ABI check,
as was done in 042a6c1fe19caf48af7e287dc8f6fd5fec158093
2025-07-15 08:30:49 +09:00
Sudharsan Veeravalli
085e8f1e52
[RISCV] Relax destination instruction dag operand matching in CompresInstEmitter (#148660)
We have some 48-bit instructions in the `Xqci` spec that currently
cannot be compressed to their 32-bit variants due to the constraint in
`CompressInstEmitter` on destination instruction operands not being
allowed to mismatch with the DAG operands.

For eg. the` QC_E_ADDI` instruction can be compressed to the `ADDI`
instruction when the immediate is signed-12 bit but this is currently
not possible since the `QC_E_ADDI` instruction has `GPRNoX0` register
operands while the `ADDI` instruction has `GPR` register operands
leading to an operand type validation error.

I think we can remove the check that only source instruction operands
can mismatch with the corresponding DAG operands and rely on the fact
that we check if the DAG register operand type is a subclass of the
instruction register operand type.
2025-07-15 04:52:51 +05:30
Igor Kudrin
ad9a9537e6
[clang] Fix -Wuninitialized for values passed by const pointers (#147221)
This enables producing a "variable is uninitialized" warning when a
value is passed to a pointer-to-const argument:

```
void foo(const int *);
void test() {
  int *v;
  foo(v);
}
```

Fixes #37460
2025-07-14 16:03:08 -07:00
Stanislav Mekhanoshin
a32040e483
[AMDGPU] Use 64-bit literals in codegen on gfx1250 (#148727) 2025-07-14 15:47:24 -07:00
Uzair Nawaz
56a4f8d8c1
[libc] Wchar Stringconverter (#146388)
Implemented a string converter class to encapsulate the logic of
converting between utf8 <-> utf32
2025-07-14 15:45:46 -07:00
Igor Kudrin
00dacf8c22
[clang] Add -Wuninitialized-const-pointer (#148337)
This option is similar to -Wuninitialized-const-reference, but diagnoses
the passing of an uninitialized value via a const pointer, like in the
following code:
```
void foo(const int *);
void test() {
  int v;
  foo(&v);
}
```
This is an extract from #147221 as suggested in [this
comment](https://github.com/llvm/llvm-project/pull/147221#discussion_r2190998730).
2025-07-14 15:44:43 -07:00
Charitha Saumya
244ebef1dd
Reapply [mlir][vector] Refactor WarpOpScfForOp to support unused or swapped forOp results. (#148313)
Reapply attempt for : https://github.com/llvm/llvm-project/pull/148291
Fix for the build failure reported in :
https://lab.llvm.org/buildbot/#/builders/116/builds/15477

-----

This crash is caused by mismatch of distributed type returned by
`getDistributedType` and intended distributed type for forOp results.

Solution diff:
20c2cf6766

Example:
```
func.func @warp_scf_for_broadcasted_result(%arg0: index) -> vector<1xf32> {
  %c128 = arith.constant 128 : index
  %c1 = arith.constant 1 : index
  %c0 = arith.constant 0 : index
  %2 = gpu.warp_execute_on_lane_0(%arg0)[32] -> (vector<1xf32>) {
    %ini = "some_def"() : () -> (vector<1xf32>)
    %0 = scf.for %arg3 = %c0 to %c128 step %c1 iter_args(%arg4 = %ini) -> (vector<1xf32>) {
      %1 = "some_op"(%arg4) : (vector<1xf32>) -> (vector<1xf32>)
      scf.yield %1 : vector<1xf32>
    }
    gpu.yield %0 : vector<1xf32>
  }
  return %2 : vector<1xf32>
}
``` 
In this case the distributed type for forOp result is `vector<1xf32>`
(result is not distributed and broadcasted to all lanes instead).
However, in this case `getDistributedType` will return NULL type.

Therefore, if the distributed type can be recovered from warpOp, we
should always do that first before using `getDistributedType`
2025-07-14 15:41:56 -07:00
Stanislav Mekhanoshin
5277021c3c
[AMDGPU] Add gfx1250 v_fmac_f64 implementation (#148725) 2025-07-14 15:39:04 -07:00
Rahul Joshi
633728f3b5
[NFC][TableGen][DecoderEmitter] Eliminate indent for a few functions (#148718)
Eliminate the `indent` argument for functions which are always called
with `indent(0)`.
2025-07-14 15:23:41 -07:00
James Newling
99875733fc
[mlir][vector] Use vector.broadcast in place of vector.splat (#148028)
Part of deprecation of vector.splat

RFC:
https://discourse.llvm.org/t/rfc-mlir-vector-deprecate-then-remove-vector-splat/87143/4
More complete deprecation:
https://github.com/llvm/llvm-project/pull/147818
2025-07-14 15:12:21 -07:00
Daniel Paoliello
027f5ba24e
[win][aarch64] Enable the llvm/test/CodeGen/WinEH tests for AArch64 (#147860)
Enabled AArch64 runs for these tests where it made sense.

Also removed the "temporary" suffixes filter that was added over 10
years ago, I believe the "misched-copy.s output file" has been cleaned
from the runners by now...
2025-07-14 15:07:00 -07:00
Daniel Paoliello
13b720d255
[win][x64] Re-use fixed object if multiple catchpads use the same alloca for their catch objects (#147849)
Addresses
<https://github.com/llvm/llvm-project/pull/147421#discussion_r2191234968>
for x86

If more than one `catchpad ` uses the same `alloca` for their catch
objects, then we will allocate more than one object in the fixed area
resulting in wasted stack space.

As a follow up, Clang could be updated to re-use the same `alloca` for
all by-reference and by-pointer catch objects.
2025-07-14 15:06:31 -07:00
Nikita Popov
4b52d221a0
[Support][BLAKE3] Prefix blake3_xof_many_avx512 (#148607)
This symbol was introduced in #147948, but not prefixed, resulting in
conflicts if libblake3 and LLVM are both linked statically into the same
binary.
2025-07-14 14:32:47 -07:00
Amir Ayupov
0d5325bb20
[BOLT] Directly use call count in buildCallGraph (#134966)
In call graph construction, call block count is used for call graph edge
weight. Change that to use call count directly if it's available, 
falling back to block count if not.

Test Plan:
This change together with disabling `fix-block-counts` improves profile
quality metrics, e.g. for large binaries and sampled LBR profiles:

`br_inst_retired.near_taken:uppp` trigger event
- Ads1: 
  - Profiled functions 58096
  - CFG imbalance 2.63% -> 2.45%
  - CG imbalance 8.23% -> 7.44%

- Ads2:
  - Profiled functions 54358
  - CFG imbalance 3.12% -> 2.77%
  - CG imbalance 8.22% -> 7.06%

- uwsgi:
  - Profiled functions 78103
  - CFG imbalance 4.42% -> 4.03%
  - CG imbalance 100.00% -> 100.00%

`cycles:u` trigger event:
- web: 
  - Profiled functions 31306
  - CG flow imbalance: 31.16% -> 20.29%
  - CFG flow imbalance: 7.04% -> 6.44%
2025-07-14 14:28:52 -07:00
Nishant Patel
834591e062
[MLIR] [Vector] Linearization patterns for vector.load and vector.store (#145115)
This PR add inearizarion pattern for vector.load and vector.store. It is
follow up PR to
https://github.com/llvm/llvm-project/pull/143420#issuecomment-2967406606
2025-07-14 14:24:52 -07:00
Abid Qadeer
45fa0b29bc
Revert "[OMPIRBuilder] Don't use invalid debug loc in task proxy function." (#148728)
There is a sanitizer fail in CI after this which I need to investigate.
Reverting for now.
Reverts llvm/llvm-project#148284
2025-07-14 22:23:21 +01:00
Peter Klausler
40ceaf1d99
[flang][runtime] Fix bad instance of std::optional in runtime (#148724)
The runtime needs to use common::optional, not std::optional.
2025-07-14 14:12:49 -07:00
Victor Chernyakin
92ef8e3419
[clang-tidy] Teach cppcoreguidelines-interfaces-global-init about constinit (#148334)
This check already understands how `constexpr` makes initialization
order problems impossible, and C++20's `constinit` provides the exact
same guarantees.
2025-07-15 00:10:10 +03:00
Igor Kudrin
2464313eef
[clang] Fix suppressing diagnostics for uninitialized variables (#148336)
When one kind of diagnostics is disabled, this should not preclude other
diagnostics from displaying, even if they have lower priority. For
example, this should print a warning about passing an uninitialized
variable as a const reference:
```
> cat test.cpp
void foo(const int &);
int f(bool a) {
  int v;
  if (a) {
    foo(v);
    v = 5;
  }
  return v;
}
> clang test.cpp -fsyntax-only -Wuninitialized -Wno-sometimes-uninitialized
```
2025-07-14 14:01:11 -07:00
Susan Tan (ス-ザン タン)
ada514b0af
[flang][acc][NFC] Add deviation to the spec that declaring the same variable is permitted (#148288)
OpenACC spec says `A var may appear at most once in all the clauses of
declare directives for a function, subroutine, program, or module.` but
our implementation allows it with a warning generated. Add this to the
diviation list for record.
2025-07-14 16:55:40 -04:00
Craig Topper
19b2dd9d79
[RISCV] Use emplace_back instead of push_back+make_pair. NFC (#148711) 2025-07-14 13:47:40 -07:00
Razvan Lupusoru
c4fc358156
[flang][acc][nfc] Move FIROpenACCSupport to Support subfolder (#148710)
In order to prepare for adding FIROpenACCTransforms, move the FIR
OpenACC support library to its own subfolder.
2025-07-14 13:42:20 -07:00
Uzair Nawaz
711132dfa4
[libc] Implement widechar to integer public functions (#148683)
Implement public wchar -> integer public functions using templated
internal wcs_to_integer function
2025-07-14 13:33:12 -07:00
Shilei Tian
d7ec80c897
[AMDGPU] Add support for v_tanh_bf16 on gfx1250 (#147425)
Co-authored-by: Mekhanoshin, Stanislav <Stanislav.Mekhanoshin@amd.com>
2025-07-14 16:30:18 -04:00
Florian Hahn
5a4586f468
Reapply "[LAA] Remove loop-invariant check added in 234cc40adc61."
This reverts commit d43a80936d437d217d5a6dbbaa5fb131c27e7085.

With the correctness issue blocking the recommit finally fixed
(5d01697ec6cb), again unconditionally check if accesses are completely
before or after each other.
2025-07-14 21:21:22 +01:00
Kazu Hirata
a73aa721d6 [Analysis] Fix a warning
This patch fixes:

  llvm/lib/Analysis/IR2Vec.cpp:280:3: error: default label in switch
  which covers all enumeration values
  [-Werror,-Wcovered-switch-default]
2025-07-14 13:18:52 -07:00
Keith Smiley
455105f1c6
[clang-tidy] Improve --verify-config documentation (#148699)
Previously it wasn't clear that passing this disables otherwise running
clang-tidy.
2025-07-14 13:16:05 -07:00
Peter Collingbourne
de31584001
Reapply "compiler-rt: Introduce runtime functions for emulated PAC."
This reverts commit 0c0aa56cdcf1fe3970a5f3875db412530512fc07.

This time with the following fixes for buildbot failures:
- Add underscore prefixes to symbol names on Apple platforms.
- Modify the test so that it skips the crash tests on platforms where
  they are not expected to pass:
  - Platforms that implement FEAT_PAuth but not FEAT_FPAC (e.g.
    Apple M1, Cortex-A78C)
  - Platforms where DA key is disabled (e.g. older Linux kernels,
    Linux kernels with PAC disabled, likely Windows)

Original commit message follows:

The emulated PAC runtime functions emulate the ARMv8.3a pointer
authentication instructions and are intended for use in heterogeneous
testing environments. For more information, see the associated RFC:
https://discourse.llvm.org/t/rfc-emulated-pac/85557

Reviewers: mstorsjo, pawosm-arm, atrosinenko

Reviewed By: atrosinenko

Pull Request: https://github.com/llvm/llvm-project/pull/148094
2025-07-14 13:13:32 -07:00
YongKang Zhu
dadaa7941d
[BOLT][instr] Add optional arguments to __bolt_instr_data_dump() (#148700)
`__bolt_instr_data_dump()` will find instrumented binary name by
iterating through entries under directory `/proc/self/map_files`,
and then open the binary and memory map it onto heap in order
to locate `.bolt.instr.tables` section to read the descriptions.
If binary name is already known and/or binary is already opened
as memory mapped, we can pass binary name and/or memory
buffer directly to `__bolt_instr_data_dump()` to save some work.
2025-07-14 13:06:16 -07:00
Andrew Rogers
f5b6b896de
[llvm] annotate new symbols for DLL export (#148658)
## Purpose
This patch is one in a series of code-mods that annotate LLVM’s public
interface for export. This patch annotates symbols that were added to
LLVM in the last two weeks and were missed by previous code-mods. The
annotations currently have no meaningful impact on the LLVM build;
however, they are a prerequisite to support an LLVM Windows DLL (shared
library) build.

## Background
This effort is tracked in #109483. Additional context is provided in
[this
discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307),
and documentation for `LLVM_ABI` and related annotations is found in the
LLVM repo
[here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst).

## Overview
These changes were generated automatically using the [Interface
Definition Scanner (IDS)](https://github.com/compnerd/ids) tool,
followed formatting with `git clang-format`.

## Validation
Local builds and tests to validate cross-platform compatibility. This
included llvm, clang, and lldb on the following configurations:

- Windows with MSVC
- Windows with Clang
- Linux with GCC
- Linux with Clang
2025-07-14 13:05:19 -07:00
Abid Qadeer
9d778089db
[OMPIRBuilder] Don't use invalid debug loc in task proxy function. (#148284)
This is similar to https://github.com/llvm/llvm-project/pull/147950 but
for task proxy function.
2025-07-14 21:04:34 +01:00
Florian Hahn
08a8e1c6b6
[InstCombine] Move extends across identity shuffles. (#146901)
Add a new fold to instcombine to move SExt/ZExt across identity
shuffles, applying the cast after the shuffle. This sinks extends and
can enable more general additional folding of both shuffles (and
related instructions) and extends. If backends prefer splitting up doing
casts first, the extends can be hoisted again in VectorCombine for
example.

A larger example is included in the load_i32_zext_to_v4i32. The wider
extend is easier to compute an accurate cost for and targets (like
AArch64) can lower a single wider extend more efficiently than multiple
separate extends.

This is a generalization of a VectorCombine version
(https://github.com/llvm/llvm-project/pull/141109) as suggested by
@preames.

PR: https://github.com/llvm/llvm-project/pull/146901
2025-07-14 21:01:03 +01:00
Haojian Wu
2edd4a25dd [clang] NFC, avoid create a new FunctionTypeInfo object in the function call.
FunctionTypeInfo is a large object, no need to create a new one for this case.
2025-07-14 21:58:34 +02:00
Ahmad Yasin
671072e830
[AArch64] Unrolling of loops with vector instructions. (#147420)
This patch permits loops with vector instructions to be unrolled.

Today there is an early exit in `getUnrollingPreferences()` of AArch64
targets if a vector instruction is observed in any of the loop blocks.
This patch fixes that so common loops like this one get a chance to be
unrolled:

void saxpy (float * dst, const float * src, const float a, const int
len) {
        float32x4_t * vdst = (float32x4_t *)dst;
        float32x4_t * vsrc = (float32x4_t *)src;
        float32x4_t vk = vdupq_n_f32(a);
        for (int i = 0; i < (len >> 2); i++)
        {
            vdst[i] = vaddq_f32(vdst[i], vmulq_f32(vsrc[i], vk));
        }
    }

Auto-vectorized loops are still not unrolled, unless they were not
interleaved when vectorized.

The provided test case shows the enhancement on top of runtime/partial
unrolling, depending on the CPU.

PR: https://github.com/llvm/llvm-project/pull/147420
2025-07-14 20:53:09 +01:00
Jeremy Morse
641ff6db38
[DebugInfo] Add option for producing no source-file hash (#148657)
Clang can chose which sort of source-file hash is attached to a DIFile
metadata node. However, whenever hashing is possible, we /always/ attach
a hash. This patch permits users who want DWARF5 but don't want the file
hashes to opt out, by adding a "none" option to the -gsrc-hash option
that skips hash computation.
2025-07-14 20:48:41 +01:00
Guy David
db15c23a57
[DebugInfo][DWARF] Add DWARF/LowLevel to module.modulemap (#148693)
This ensures the generation of Attributes.inc when using
-DLLVM_ENABLE_MODULES=ON.
2025-07-14 22:46:43 +03:00
Simon Pilgrim
5d59cb6ae2
[AArch64] computeKnownBitsForTargetNode - add AArch64ISD::MOVIshift support (#148634)
Fixes #148596
2025-07-14 20:36:51 +01:00
Min-Yih Hsu
ae810dde5d
[IA][NFC] Factoring out helper functions that extract (de)interleaving factors (#148689)
Factoring out and combining `isInterleaveIntrinsic`,
`isDeinterleaveIntrinsic`, and `getIntrinsicFactor` into
`getInterleaveIntrinsicFactor` and `getDeinterleaveIntrinsicFactor`
inside VectorUtils.

NFC.
2025-07-14 12:36:42 -07:00
Michael Buch
d4f5ed6a23
Revert "[libc++][NFC] atomic::wait use public API on macOS" (#148705)
Reverts llvm/llvm-project#147146

This is failing to build on our public macOS CI:
https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake-sanitized/

```
06:48:56  FAILED: libcxx/src/CMakeFiles/cxx_shared.dir/atomic.cpp.o 
06:48:56  /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/lldb-build/bin/clang++ --target=arm64-apple-darwin23.1.0 -DLIBCXX_BUILDING_LIBCXXABI -DLIBC_NAMESPACE=__llvm_libc_common_utils -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/libcxx/src -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/lldb-build/include/c++/v1 -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/libcxxabi/include -I/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/cmake/Modules/../../libc -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -O3 -DNDEBUG -std=c++23 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -mmacosx-version-min=14.1 -fPIC -UNDEBUG -faligned-allocation -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wzero-length-array -Wdeprecated-redundant-constexpr-static-def -Wno-nullability-completeness -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -fdebug-prefix-map=/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/lldb-build/include/c++/v1=/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/libcxx/include -MD -MT libcxx/src/CMakeFiles/cxx_shared.dir/atomic.cpp.o -MF libcxx/src/CMakeFiles/cxx_shared.dir/atomic.cpp.o.d -o libcxx/src/CMakeFiles/cxx_shared.dir/atomic.cpp.o -c /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/libcxx/src/atomic.cpp
06:48:56  /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/libcxx/src/atomic.cpp:46:12: fatal error: 'os/os_sync_wait_on_address.h' file not found
06:48:56     46 | #  include <os/os_sync_wait_on_address.h>
06:48:56        |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
06:48:56  1 error generated.
```

This is the configuration the failing bots are running:
```
06:25:12  + sw_vers
06:25:12  ProductName:		macOS
06:25:12  ProductVersion:		14.1
06:25:12  BuildVersion:		23B74
06:25:12  + xcodebuild -version
06:25:12  Xcode 15.2
06:25:12  Build version 15C5500c
```


The Intel bots are building fine though. Probably because they're on a
newer OS where the headers are available?
```
10:03:35  + sw_vers
10:03:35  ProductName:		macOS
10:03:35  ProductVersion:		15.1.1
10:03:35  BuildVersion:		24B91
10:03:35  + xcodebuild -version
10:03:39  Xcode 16.2
10:03:39  Build version 16C5031c
10:03:39  + cmake --version
10:03:39  cmake version 3.30.2
```
2025-07-14 20:14:39 +01:00
Cyndy Ishida
0c2560b29b
[TextAPI] print symbols in a stable order in v5 format (#148687)
resolves: rdar://151765704
2025-07-14 12:13:43 -07:00
Baranov Victor
6ac286cd49
[clang-tidy] Improve bugprone-exception-escape: add stacktrace of escaped exception (#134375)
This PR add stacktrace of escaped exception to
`bugprone-exception-escape` check.
Changes:
1. Modified `ExceptionAnalyzer` and `ExceptionInfo` classes to hold
stacktrace of escaped exception in `llvm::MapVector`. `llvm::MapVector`
is needed to hold relative positions of functions in stack as well as
have fast lookup.
2. Added new diagnostics based of `misc-no-recursion` check.

Fixes https://github.com/llvm/llvm-project/issues/87422.
2025-07-14 21:59:28 +03:00
Naveen Seth Hanig
ce8c19ffc5
[clang][deps] Fix dependency scanner misidentifying 'import::' as module partition (#148674)
The dependency directive scanner was incorrectly classifying namespaces
such as `import::inner xi` as directives. According to P1857R3, `import` should
not be treated as a directive when followed by `::`.
This change fixes that behavior.
2025-07-15 00:07:30 +05:30
Michael Kruse
ec2e21a14d
[LangRef] No target-specific size limit for atomics (#136864)
According to the current LangRef, atomics of sizes larger than a
target-dependent limit are non-conformant IR. Presumably, that size
limit is `TargetLoweringBase::getMaxAtomicSizeInBitsSupported()`. As a
consequence, one would not even know whether IR is valid without
instantiating the Target backend.

To get around this, Clang's CGAtomic uses a constant "16 bytes" for the
maximally supported atomic. The verifier only checks the power-of-two
requirement.

In a discussion with jyknight, the intention is rather that the
AtomicExpandPass will just lower everything larger than the
target-supported atomic sizes to libcall (such as `__atomic_load`).
According to this interpretation, the size limit needs only be known by
the lowering and does not affect the IR specification.

The original "target-specific size limit" had been added in
59b66883eacbc62a09c09f08bcbfdce7af46cf31. The LangRef change is needed
for #134455 because otherwise frontends need to pass a TargetLowering
object to the helper functions just to know what the target-specific
limit is.

This also changes the LangRef for atomicrmw. Are there libatomic
fallbacks for these? If not, LLVM-IR validity still depends on
instantiating the actual backend. There are also some intrinsics such as
`llvm.memcpy.element.unordered.atomic` that have this constraint but do
not change in this PR.
2025-07-14 20:36:09 +02:00
Utkarsh Saxena
7615503409
[LifetimeSafety] Add script for performance benchmarking (#147315)
This patch introduces a new Python-based benchmarking tool for Clang's Lifetime Safety analysis. This script automates the process of generating targeted C++ test cases, measuring the performance of the analysis, and determining its empirical computational complexity.

The tool helps track and validate the performance of the dataflow analysis, ensuring that future optimizations have a measurable impact and that the analysis scales efficiently.

Components:

* **Generate**: Creates pathological C++ test cases with specific patterns (pointer cycles and CFG merges) designed to stress-test the analysis.

* **Compile & Trace**: Compiles the generated code using `-ftime-trace`.

* **Analyze & Report**: Performs a curve-fit on the timing data to determine the empirical complexity ( **O(n<sup>k</sup>)**) and outputs a markdown report.

---

**Usage**:
<details>
  <summary>ninja benchmark_lifetime_safety_analysis</summary>

[12/13] Running Lifetime Analysis performance benchmarks...
Benchmark files will be saved in: <BUILD_DIR_REDACTED>/tools/clang/test/Analysis/LifetimeSafety/benchmark_results

Running performance benchmarks...
--- Running Test: Cycle with N=10 ---
    Total: 10.11 ms | Analysis: 2.70 ms
--- Running Test: Cycle with N=25 ---
    Total: 61.51 ms | Analysis: 53.05 ms
--- Running Test: Cycle with N=50 ---
    Total: 688.56 ms | Analysis: 677.32 ms
--- Running Test: Cycle with N=75 ---
    Total: 3.09 s | Analysis: 3.07 s
--- Running Test: Cycle with N=100 ---
    Total: 9.31 s | Analysis: 9.30 s
--- Running Test: Cycle with N=150 ---
    Total: 44.92 s | Analysis: 44.91 s
--- Running Test: Merge with N=10 ---
    Total: 8.54 ms | Analysis: 0.00 ms
--- Running Test: Merge with N=50 ---
    Total: 38.79 ms | Analysis: 27.13 ms
--- Running Test: Merge with N=100 ---
    Total: 219.45 ms | Analysis: 205.20 ms
--- Running Test: Merge with N=200 ---
    Total: 1.67 s | Analysis: 1.65 s
--- Running Test: Merge with N=400 ---
    Total: 12.57 s | Analysis: 12.55 s
--- Running Test: Merge with N=800 ---
    Total: 100.48 s | Analysis: 100.43 s


Generating Markdown Report...
</details>

<details>
  <summary>Sample Report: </summary>

# Lifetime Analysis Performance Report
> Generated on: 2025-07-08 14:18:52 

---

## Test Case: Pointer Cycle in Loop

| N   | Analysis Time | Total Clang Time |
|:----|--------------:|-----------------:|
| 10  |       2.70 ms |         10.11 ms |
| 25  |      53.05 ms |         61.51 ms |
| 50  |     677.32 ms |        688.56 ms |
| 75  |        3.07 s |           3.09 s |
| 100 |        9.30 s |           9.31 s |
| 150 |       44.91 s |          44.92 s |

**Complexity Analysis:**
- The performance for this case scales approx. as **O(n<sup>3.88</sup>)**.
- **95% Confidence interval for exponent:** `[3.86, 3.90]`.

---

## Test Case: CFG Merges

| N   | Analysis Time | Total Clang Time |
|:----|--------------:|-----------------:|
| 10  |       0.00 ms |          8.54 ms |
| 50  |      27.13 ms |         38.79 ms |
| 100 |     205.20 ms |        219.45 ms |
| 200 |        1.65 s |           1.67 s |
| 400 |       12.55 s |          12.57 s |
| 800 |      100.43 s |         100.48 s |

**Complexity Analysis:**
- The performance for this case scales approx. as **O(n<sup>3.00</sup>)**.
- **95% Confidence interval for exponent:** `[2.99, 3.01]`.

---

</details>
2025-07-14 20:23:54 +02:00