Commit Graph

557745 Commits

Author SHA1 Message Date
nerix
44fefe70e4 [LLDB][NativePDB] Estimate symbol sizes (#165727)
In #165604, a test was skipped on Windows, because the native PDB plugin
didn't set sizes on symbols. While the test isn't compiled with debug
info, it's linked with `-gdwarf`, causing a PDB to be created on
Windows. This PDB will only contain the public symbols (written by the
linker) and section information. The symbols themselves don't have a
size, however the DIA SDK sets a size for them.
It seems like, for these data symbols, the size given from DIA is the
distance to the next symbol (or the section end).

This PR implements the naive approach for the native plugin. The main
difference is in function/code symbols. There, DIA searches for a
corresponding `S_GPROC32` which have a "code size" that is sometimes
slightly smaller than the difference to the next symbol.
2025-10-31 10:33:37 +01:00
Simon Tatham
f2443861d7 [lld][ARM] Don't emit veneers for wraparound branches. (#165263)
If an instruction at the high end of the 32-bit address space branches
to one at the low end, then the branch can be within range for a B or BL
instruction, and doesn't need a veneer. `ARM::inBranchRange` was failing
to detect this because it calculated the offset as an int64_t, so that
the offset was a small value ± 2^32 instead of just the small value.

Fixes #165211.
2025-10-31 09:31:18 +00:00
Jens Reidel
331b3eb489 [PowerPC] Take ABI into account for data layout (#149725)
Prior to this change, the data layout calculation would not account for
explicitly set `-mabi=elfv2` on `powerpc64-unknown-linux-gnu`, a target
that defaults to `elfv1`.

This is loosely inspired by the equivalent ARM / RISC-V code.

`make check-llvm` passes fine for me, though AFAICT all the tests
specify the data layout manually so there isn't really a test for this
and I am not really sure what the best way to go about adding one would
be.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-10-31 10:30:53 +01:00
Fabian Ritter
a85e84b854 [SDAG] Preserve InBounds in DAGCombines (#165424)
This PR preserves the InBounds flag (#162477) where possible in PTRADD-related
DAGCombines. We can't preserve them in all the cases that we could in the
analogous GISel change (#152495) because SDAG usually represents pointers as
integers, which means that pointer provenance is not preserved between PTRADD
operations (see the discussion at PR #162477 for more details). This PR marks
the places in the DAGCombiner where this is relevant explicitly.

For SWDEV-516125.
2025-10-31 10:25:39 +01:00
aokblast
2ccfc5176d [Object,ELF] Implement PN_XNUM extension for program headers (#162288)
In ELF file, there is a possible extended header for those phnum, shnum,
and shstrndx larger than the maximum of 16 bits. This extended header
use section 0 to record these fields in 32 bits. 

We implment this feature so that programs rely on
ELFFile::program_headers() can get the
correct number of segments. Also, the consumers don't have to check the
section 0 themselve, insteead, they can use the getPhNum() as an
alternative.
2025-10-31 09:18:28 +00:00
David Green
215aca4432 [GlobalISel] SBFX/UBFX does not create poison (#165675)
This adds G_SBFX/G_UBFX to the list of instructions that do not generate
poison, to allowing freeze to be hoisted above one.
2025-10-31 09:18:07 +00:00
Michael Buch
a6eac9e729 [lldb][TypeSystem] Remove count parameter from TypeSystem::GetEncoding (#165702)
There were a couple of quirks with this parameter:
1. It wasn't being set consistently. E.g., vector types would be of
count `1` but complex types would be `2`. Hence, it wasn't clear what
count was referring to.
2. `count` was not being set if the input type was invalid, possibly
leaving the input reference uninitialized.
3. Only one callsite actually made use of `count`, and that in itself
seems like it could be improved (added a FIXME).

If we ever need a "how many elements does this type represent", we can
implement one with a new `TypeSystem` API that does exactly that.
2025-10-31 09:08:12 +00:00
Michael Buch
40fab664d0 🍒 [lldb] Fix TestRealDefinition on older DWARF versions (#165729)
Cherry-picks this fix from the Apple LLDB fork. Ever since we upstreamed
https://github.com/llvm/llvm-project/pull/164011, this test is failing
on our pre-DWARFv5 bots:
```
13:47:54  ======================================================================
13:47:54  FAIL: test_frame_var_after_stop_at_implementation_dsym (TestRealDefinition.TestRealDefinition)
13:47:54     Test that we can find the implementation for an objective C type
13:47:54  ----------------------------------------------------------------------
13:47:54  Traceback (most recent call last):
13:47:54    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1804, in test_method
13:47:54      return attrvalue(self)
13:47:54    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/objc/real-definition/TestRealDefinition.py", line 60, in test_frame_var_after_stop_at_implementation
13:47:54      self.expect(
13:47:54    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2416, in expect
13:47:54      self.runCmd(
13:47:54    File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1006, in runCmd
13:47:54      self.assertTrue(self.res.Succeeded(), msg + output)
13:47:54  AssertionError: False is not true : Variable(s) displayed correctly
13:47:54  Error output:
13:47:54  error: <user expression 0>:1:12: "_hidden_ivar" is not a member of "(id) _bar"
13:47:54     1 | foo->_bar->_hidden_ivar
13:47:54       | ^
```

Original commit message:

For a while, tests were run with `target.prefer-dynamic-value`
overridden to `no-dynamic-values` – but the override was removed in
[D132382](https://reviews.llvm.org/D132382). At that time, tests that
failed were individually opted in to `no-dynamic-values`.

I don't recall specifics about `TestRealDefinition`, but it currently
fails with `no-dynamic-values`, and that is correct behavior. This
change removes the `no-dynamic-values` override.
2025-10-31 09:03:23 +00:00
Haocong Lu
37cf1fc62c [mlir][vector] Fix missed return in ExtractStridedSliceOp::fold (#165669)
Fix missed `return` when folding splat ConstantOp, it could work well
probably because of good compatibility of
`foldExtractStridedSliceNonSplatConstant`.
2025-10-31 16:43:25 +08:00
Brad Smith
8754e0a102 [OpenMP] Remove OS checks for ARM and AArch64 (#165640) 2025-10-31 04:24:37 -04:00
Dan Blackwell
817796589d [Fuzzer][Test-Only][Darwin] Mark coverage.test and exit_on_src_pos.test unsupported (#165408)
These tests are currently failing on some CI macOS instances due to an
issue with the system symbolizer.

This patch marks the tests unsupported on Darwin while we wait for all
CI machines to be updated to a newer OS.

rdar://160410051
2025-10-31 08:15:23 +00:00
Wenju He
efb84586da [clang][SPIR][SPIRV] Don't generate constant NULL from addrspacecast generic NULL (#165353)
Fix a regression caused by 1ffff05a38.
OpenCL/SPIRV generic address space doesn't cover constant address space.

---------

Co-authored-by: Alexey Bader <alexey.bader@intel.com>
2025-10-31 15:35:41 +08:00
Mehdi Amini
e75af45a7a [MLIR] Apply clang-tidy fixes for readability-simplify-boolean-expr in SuperVectorize.cpp (NFC) 2025-10-30 23:56:32 -07:00
Mehdi Amini
81ad8fbc2b [MLIR] Apply clang-tidy fixes for bugprone-argument-comment in ConvertVectorToLLVM.cpp (NFC) 2025-10-30 23:56:32 -07:00
Jianjian Guan
314754c725 [RISCV][GISel] Support select vector store instrinsics (#165500)
Include Unit-stride, Strided, Mask store.
2025-10-31 14:42:56 +08:00
ZhaoQi
2fac5a9f2c [LoongArch][NFC] Pre-commit tests for vector type avg{floor/ceil}{s/u} (#165821) 2025-10-31 14:13:30 +08:00
Aiden Grossman
7de242b72b Revert "[compiler-rt] Default to Lit's Internal Shell"
This reverts commit 16ab8c0026.

It appears this broke a couple of buildbots:
1. https://lab.llvm.org/buildbot/#/builders/193/builds/11847
2. https://lab.llvm.org/buildbot/#/builders/161/builds/8736

Reverting for now so I have a chance to investigate.
2025-10-31 05:59:24 +00:00
Zhaoxin Yang
2981b5d45c [LoongArch][NFC] Pre-commit tests for vector ceil,floor,trunc,roundeven (#165213) 2025-10-31 13:57:34 +08:00
Matt Arsenault
973ef39c2d AArch64: Add more 3 element vector sincos tests (#165816) 2025-10-30 22:49:44 -07:00
pkarveti
dc06d69871 [Hexagon] Handle truncate of v64i32 -> v64i1 when Hvx is enabled (#164931)
Fixes #160806
2025-10-31 00:11:06 -05:00
quic_hchandel
fa21fcbb5b [RISCV] Add short forward branch support for min, max, maxu and minu (#164394) 2025-10-31 10:19:25 +05:30
Mehdi Amini
86f35da690 [MLIR] Apply clang-tidy fixes for misc-use-internal-linkage in LinalgTransformOps.cpp (NFC) 2025-10-30 21:44:21 -07:00
Mehdi Amini
a8abf813eb [MLIR] Apply clang-tidy fixes for performance-unnecessary-value-param in ViewOpGraph.cpp (NFC) 2025-10-30 21:44:21 -07:00
Florian Hahn
317b42ef5c [VPlan] Remove original recipe after narrowing to single-scalar.
Directly remove RepOrWidenR after replacing all uses. Removing the dead
user early unlocks additional opportunities for further narrowing.
2025-10-31 04:38:16 +00:00
Aiden Grossman
16ab8c0026 [compiler-rt] Default to Lit's Internal Shell
All of the tests should work with the internal shell now, at least on
x86 Linux. Enable it by default for the performance/debuggability
advantages.

Reviewers: vitalybuka, fmayer

Reviewed By: fmayer, vitalybuka

Pull Request: https://github.com/llvm/llvm-project/pull/165148
2025-10-30 21:35:04 -07:00
Matt Arsenault
5ba0b91a62 RuntimeLibcalls: Whitespace fix 2025-10-30 21:04:00 -07:00
Alexey Samsonov
42a8ff877d [libc] Add "struct tm" declaration to <wchar.h> (#165795)
`<wchar.h>` should at least include the forward declaration of `struct tm`,
since it's needed for the `wcsftime` declaration (also, see
https://man7.org/linux/man-pages/man0/wchar.h.0p.html).

Even though we don't yet have `wcsftime`, some downstream users (notably
- libcxx) expects to see `struct tm` declaration there, to re-declare it under
`std` namespace:
c46bfed1a4/libcxx/include/cwchar (L135)

So, add this type declaration to llvm-libc version of `wchar.h` now.
2025-10-30 20:30:49 -07:00
Yu Hao
067e205069 [clang][transformer] Change name range-selector to return Error instead of an invalid range. (#164715)
Previously, when the text in selected range was different from the
decl's name, `name` returned an invalid range, which could cause crashes
if `name` was nested in other range selectors that assumed always valid
ranges. With this change, `name` returns an `Error` if it can't get the
range.
2025-10-31 03:18:08 +00:00
Congcong Cai
e65d52ab5a [clang-tidy][readability-redundant-parentheses] add option to prevent widely used work around (#164827)
Part of #164125
Add a new option to ignore some decls.

---------

Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
2025-10-31 10:51:58 +08:00
quic-likaid
bf99f6693e lsan: fix allocator on arm64 Android (#165656)
The default config is too large for arm64 Android devices, which are
typically configured with 39-bit address space. This change brings it
inline with sanitizer_allocator_test.cpp.
2025-10-30 19:43:07 -07:00
Yingwei Zheng
56777e7da2 [SimplifyCFG] Avoid use-after-free when removing incoming values from PHI nodes (#165744)
`PHINode::removeIncomingValue` removes itself when there are no incoming
edges. Then we cannot use it to retrieve the next instruction.

Closes https://github.com/llvm/llvm-project/issues/165301.
2025-10-31 10:30:29 +08:00
Jinjie Huang
6ba2127a5c [BOLT] Add constant island check in scanExternalRefs() (#165577)
The [previous patch](https://github.com/llvm/llvm-project/pull/163418)
has added a check to prevent adding an entry point into a constant
island, but only for successfully disassembled functions.

Because scanExternalRefs() is also called when a function fails to be
disassembled or is skipped, it can still attempt to add an entry point
at constant islands. The same issue may occur if without a check for it

So, this patch complements the 'constant island' check in
scanExternalRefs().
2025-10-31 10:29:00 +08:00
ZhaoQi
27eabd5219 [LoongArch] Add patterns to support vector type average instructions generation (#161079)
NOTE: For simplicity and convenience, `v2i64/v4i64` types on LA32 is not
optimized. If hoping to implement this in the future, special handling
for `bitcast` and `build_vector` is needed.
2025-10-31 10:27:01 +08:00
Zhaoxin Yang
d9e5e725ed [LoongArch] Lowering flog2 to flogb (#162978)
According to LoongArch ISA Volume 1 V1.11, FLOGB.S/D is unsupported in LA32.
2025-10-31 10:25:51 +08:00
Florian Hahn
683b00bb50 [VPlan] Limit VPScalarIVSteps to step == 1 in getSCEVExprForVPValue.
For now, just support VPScalarIVSteps with step == 1 in
getSCEVExprForVPValue. This fixes a crash when the step would be != 1.
2025-10-31 02:22:56 +00:00
A. Jiang
73b092ff33 [libc++][test] Make deallocate_size.pass.cpp MSVC-friendly (#165162)
This patch contains several changes to `deallocate_size.pass.cpp`:
1. `static_cast`-ing some parameters to `size_t` to avoid narrowing.
2. Changing the type of loop variable `i` to `unsigned int` avoid
signedness mismatch with the constructor parameter.
3. Separately counting allocations and deallocations in variables
`allocated_` and `deallocated_`, and changing their type to `uint64_t`.
4. Avoiding `assert`-ing count of allocations when a `basic_string` is
allocated, just `assert`-ing after destruction instead.
2025-10-31 10:07:38 +08:00
Aiden Grossman
f8b5f86cd9 Reapply "[TSan] Make Test work with Internal Shell"
This reverts commit 39f08eb997.

This was causing buildbot failures because we were using an explicit
python call instead of the python substitution. This leads to failures
on platforms that do not have a binary called python.
2025-10-31 00:41:37 +00:00
Eli Friedman
c8fd662bfa Update Qualcomm email addresses. (#165799)
Updating email IDs to align with employer mandate.
2025-10-30 17:18:18 -07:00
Aiden Grossman
1f702d4ee8 [lit] Mark ulimit test as unsupported on Solaris
160058fc19 broke the Solaris bots because
they do not support RLIMIT_FSIZE despite it being in POSIX 2004. Disable
it there for now as the loss of test coverage should not be significant.
2025-10-31 00:02:59 +00:00
agozillon
09318c6bff [MLIR][OpenMP] Fix and simplify bounds offset calculation for 1-D GEP offsets (#165486)
Currently this is being calculated incorrectly and will result in
incorrect index offsets in more complicated array slices. This PR tries
to address it by refactoring and changing the calculation to be more
correct.
2025-10-31 00:54:31 +01:00
Alexey Samsonov
45b1a4bb8d Add <stdbool.h> to llvm-libc-types headers that need it. (#165798)
We need `<stdbool.h>` to support having "bool" members inside pthread
structs that may get included through `<pthread.h>` from C code prior to
C23.
2025-10-30 16:37:00 -07:00
Tom Stellard
1099d2839e workflows/release-binaries: Drop x86_64 Mac OS builds (#165645)
We don't have the resources to test this and the builds are very
expensive. If someone is interested in providing x86_64 macOS they can
submit this as third-party binaries or provide resources to test the
builds.
2025-10-30 16:20:54 -07:00
Razvan Lupusoru
9077522b2b [acc][flang] Define hasUnknownDimensions in MappableType (#165794)
The MappableType interface currently defines a `generateAccBounds`
method which examines a variable and generates `acc.bounds` operations
that encode its dimensions. The implementation can extract bounds
information in various ways: either from the MLIR type itself or by
analyzing the IR to find dimension information from defining operations.

However, we need to distinguish between cases where dimensional
information is not directly available from the type itself. This new
`hasUnknownDimensions` API returns true when the MLIR type does not
encode dimensional information and there is no associated descriptor or
metadata that would make this information extractable from the visible
ssa value the represents the variable. The expected use case is calling
`generateAccBounds` only when this returns true, as it indicates that
bounds must be extracted from the IR (by walking back from current
variable to its defining spots or its descriptor).

This supports cases such as raw references to arrays with non-constant
bounds (e.g., explicit-shape arrays in Fortran where bounds are passed
as arguments). This functionality could also be leveraged for CIR VLA
support in the future.

For FIR types:
- Box types return false (descriptor encodes dimensions)
- Reference types check if the pointee has dynamic size using
fir::hasDynamicSize()
2025-10-30 16:17:00 -07:00
Michael Jones
f7a21a837c [libc] Remove optimization flags on entrypoints (#165782)
Optimization flags are now handled through a common flag. These are no
longer necessary.

Fixes #112409
2025-10-30 15:52:50 -07:00
Richard Smith
1e3a1ce911 Add tests for CWG issues 6, 212, 232, 2823. (#165633)
Unfortunately this adds two more "no"s to cxx_dr_status for 232 and
2823.

---------

Co-authored-by: Vlad Serebrennikov <serebrennikov.vladislav@gmail.com>
2025-10-30 15:50:45 -07:00
Florian Hahn
b2d12d6f2b [VPlan] Extend getSCEVForVPV, use to compute VPReplicateRecipe cost. (#161276)
Update getSCEVExprForVPValue to handle more complex expressions, to use
it in VPReplicateRecipe::comptueCost.

In particular, it supports construction SCEV expressions for
GetElementPtr VPReplicateRecipes, with operands that are
VPScalarIVStepsRecipe, VPDerivedIVRecipe and VPCanonicalIVRecipe. If we
hit a sub-expression we don't support yet, we return
SCEVCouldNotCompute.

Note that the SCEV expression is valid VF = 1: we only support
construction AddRecs for VPCanonicalIVRecipe, which is an AddRec
starting at 0 and stepping by 1. The returned SCEV expressions could be
converted to a VF specific one, by rewriting the AddRecs to ones with
the appropriate step.

Note that the logic for constructing SCEVs for GetElementPtr was
directly ported from ScalarEvolution.cpp.

Another thing to note is that we construct SCEV expression purely by
looking at the operation of the recipe and its translated operands, w/o
accessing the underlying IR (the exception being getting the source
element type for GEPs).

PR: https://github.com/llvm/llvm-project/pull/161276
2025-10-30 15:46:19 -07:00
Ebuka Ezike
c46bfed1a4 [lldb] Add alternative SBThread::GetStopDescription (#165379)
the function signature for `GetStopDescription` is
`lldb::SBThread::GetStopDescription(char *dst_or_null, size_t len)`.
To get a description you need to call the function first time to get the
buffer size. a second time to get the description.

This is little worse from the python size as the signature is
`lldb.SBThread.GetStopDescription(int: len) -> list[str]` the user has
to pass the max size as possible with no way of checking if it is
enough.

This patch adds a new api
`lldb.SBThread.GetStopDescription(desc: lldb.SBStream()) -> bool` `bool
lldb::SBThread::GetStopDescription(lldb::SBStream &description)` which
handles this case.

Adds new Test case for lua.
2025-10-30 21:43:53 +00:00
Baranov Victor
6c1678abce [CI] Remove unused variable in code-format job (#165454)
`comments` were never used plus generated pylint error
2025-10-31 00:42:31 +03:00
Rahman Lavaee
4afb0e6f51 Simplify the basic-block-sections-bb-hash.ll test.
The original test which uses grep,sed,tr commands fails on darwin: https://github.com/llvm/llvm-project/issues/165781
2025-10-30 21:30:59 +00:00
Raul Tambre
21041c9292 [NFCI][lldb][test] Fix mismatched C/C++ substitutions (#165773)
Most of the cases were where a C++ file was being compiled with the C substitution.
There were a few cases of the opposite though.

LLDB seems to be the only real culprit in the LLVM codebase for these mismatches.
Rest of the LLVM presumably sticks at least language-specific options in the common substitutions
making the mistakes immediately apparent.

I found these by using Clang frontend configuration files containing language-specific options for
both C and C++ (e.g. `-std=c2y` and `-std=c++26`).
2025-10-30 23:18:32 +02:00