526913 Commits

Author SHA1 Message Date
Jonas Devlieghere
f451d27b38
[lldb] Assert on invalid default {S,U}Int64 (NFC) (#126590)
Both the default value and the min/max value are within LLDB's control,
so an assert is more appropriate than a runtime check.
2025-02-10 15:10:21 -08:00
Jason Molenda
fb623a3524 [lldb] Fix two old UUID method calls in ObjectFileMachO
A section of ObjectFileMachO is ifdef compiled only when
building to run on iOS etc natively, so this old method
call rename wasn't detected by normal on-mac building.
2025-02-10 15:08:03 -08:00
Nico Weber
44fcc5cdac [clang] Disaqble test/Analysis/live-stmts.cpp on aarch64
See https://github.com/llvm/llvm-project/issues/126619 and discussion
on https://github.com/llvm/llvm-project/pull/125840
2025-02-10 18:04:01 -05:00
Rahul Joshi
0f674cce82
[NFC][LLVM] Remove unused TargetIntrinsicInfo class (#126003)
Remove `TargetIntrinsicInfo` class as its practically unused (its pure
virtual with no subclasses) and its references in the code.
2025-02-10 14:56:30 -08:00
Jason Molenda
d90399603c
[lldb] [darwin] Upstream a few DriverKit cases (#126604)
A DriverKit process is a kernel extension that runs in userland, instead
of running in the kernel address space/priv levels, they've been around
a couple of years. From lldb's perspective a DriverKit process is no
different from any other userland level process, but it has a different
Triple so we need to handle those cases in the lldb codebase. Some of
the DriverKit triple handling had been upstreamed to llvm-project, but I
noticed a few cases that had not yet. Cleaning that up.
2025-02-10 14:49:53 -08:00
Jonas Devlieghere
d81b604656
[lldb] Add a test for terminal dimensions (#126598)
Add a test for the `term-width` and `term-height` settings. I thought I
was hitting bug because in my statusline test I was getting the default
values when running under PExpect. It turned out hat the issue is that
we clear the settings at the start of the test. The Editline tests
aren't affected by this because Editline provides its own functions to
get the terminal dimensions and explicitly does not rely on LLDB's
settings (presumably exactly because of this behavior).
2025-02-10 14:46:03 -08:00
Gábor Horváth
3c6d1dd362
Revert "[analyzer] Remove some false negatives in StackAddrEscapeChec… (#126614)
…ker (#125638)"

This reverts commit 7ba3c55d91dcd7da5a5eb1c58225f648fb38b740.

Co-authored-by: Gabor Horvath <gaborh@apple.com>
2025-02-10 22:34:45 +00:00
Joseph Huber
07f2154142 [NVPTX] Remove unused static functions following #126544 2025-02-10 16:23:50 -06:00
Chelsea Cassanova
7c269cf0f6
[lldb][sbapi] Namespace CommandReturnObjectCallbackResult in SBDefines (#126606)
A new callback was added with the type
CommandReturnObjectCallbackResult, this commit namespaces that type to
match the format of other callback functions that have a non-primitive
return type in the lldb namespace.

rdar://144553496
2025-02-10 14:20:31 -08:00
Michael Flanders
7ba3c55d91
[analyzer] Remove some false negatives in StackAddrEscapeChecker (#125638)
Fixes https://github.com/llvm/llvm-project/issues/123459.

Previously, when the StackAddrEscapeChecker checked return values, it
did not scan into the structure of the return SVal. Now it does, and we
can catch some more false negatives that were already mocked out in the
tests in addition to those mentioned in
https://github.com/llvm/llvm-project/issues/123459.

The warning message at the moment for these newly caught leaks is not
great. I think they would be better if they had a better trace of why
and how the region leaks. If y'all are happy with these changes, I would
try to improve these warnings and work on normalizing this SVal checking
on the `checkEndFunction` side of the checker also.

Two of the stack address leak test cases now have two warnings, one
warning from return expression checking and another from`
checkEndFunction` `iterBindings` checking. For these two cases, I prefer
the warnings from the return expression checking, but I couldn't figure
out a way to drop the `checkEndFunction` without breaking other
`checkEndFunction` warnings that we do want. Thoughts here?
2025-02-10 22:20:10 +00:00
David Blaikie
b969726901 Rough attempt to fix lldb bazel BUILD file 2025-02-10 21:56:20 +00:00
Jacek Caban
94d956367e
[LLD][MinGW] Add support for wrapped symbols on ARM64X (#126296)
Apply `-wrap` arguments to both symbol tables.
2025-02-10 22:52:11 +01:00
youngd007
a80bccc684
Delete erroneously test not updated with dwarf verification JSON change (#126587)
Between a PR (124936) adding a base test for dwarf verification JSON
output and a modification of the same in changing the JSON (125062),
there ended up being two versions of the test. The base one and the
fixed one, when there should be only one copy. The base fails as the
JSON format has changed, so deleting that version.

test:
   ninja check-llvm-tools-llvm-dwarfdump
2025-02-10 13:21:37 -08:00
Jacek Caban
fdded8537d [LLD][COFF] Fix a typo in REQUIRES directive (NFC)
Fixes #126300.
2025-02-10 22:09:33 +01:00
Tom Stellard
cd26c112b2
[llvm][GitHub] Move PR project status to Done once backport PR is made (#126374)
It's common to use the /cherry-pick command on a PR to create a backport
request. However, this creates a lot of clutter in the LLVM Release
Status project, because we end up with two items in the project, one for
the original PR and one for the new PR.

This change will set the status of the original PR to Done once the new
PR (for the release branch) is created. This will save release managers
a lot of work of having to manually updated the status for PRs that
contain backport requests.
2025-02-10 13:06:51 -08:00
Sarah Spall
db1dd87642
[HLSL] Desugar type when converting from a ConstantArrayType to an ArrayParameterType (#126561)
Desugar type when converting from a ConstantArrayType to an
ArrayParameterType in getArrayParameterType
Closes #125743
2025-02-10 13:05:51 -08:00
Razvan Lupusoru
83edbd4958
[flang][acc] Ensure data exit action is generated for present & nocreate (#126560)
The acc.delete operation has semantics of decrementing present counter
and deleting the data when the counter reaches zero. Since both
acc.present and acc.nocreate are both intended to increment present
counter, this matching exit action must be inserted.

This is also what was specified in OpenACC dialect documentation:
https://mlir.llvm.org/docs/Dialects/OpenACCDialect/#operation-categories
2025-02-10 13:04:10 -08:00
Jacek Caban
6536579d80
[LLD][COFF] Add support for -includeoptional on ARM64X (#126300)
Include symbols from both symbol tables.
2025-02-10 22:01:53 +01:00
LLVM GN Syncbot
d11b9b7275 [gn build] Port f332455dd9a2 2025-02-10 20:26:39 +00:00
Joseph Huber
3d9409f5bc
[NVPTX] Make ctor/dtor lowering always enabled in NVPTX (#126544)
Summary:
Currently we conditionally enable NVPTX lowering depending on the
language (C/C++/OpenMP). Unfortunately this causes problems because this
option is only present if the backend was enabled, which causes this to
error if you try to make LLVM-IR.

This patch instead makes it the only accepted lowering. The reason we
had it as opt-in before is because it is not handled by CUDA. So, this
pach also introduces diagnostics to prevent *all* creation of
device-side global constructors and destructors. We already did this for
variables, now we do it for attributes as well.

This inverts the responsibility of blocking this from the backend to the
langauage like it should be given that support for this is language
dependent.
2025-02-10 14:25:44 -06:00
Louis Dionne
f332455dd9
[libc++] Extract destroy algorithms into separate headers (#126449)
This patch separates the destroy algorithms from the primitive
construct_at and destroy_at operations, which are conceptually not
algorithms. This makes it easier to start using these destroy algorithms
from upcoming relocation facilities.

As part of this, it also implements `std::destroy_at` for arrays without
relying on the `std::destroy` algorithm, which is conceptually a
higher-level facility.
2025-02-10 21:19:46 +01:00
Nico Weber
872aaddba9 Revert "Modify dwarfdump verification to allow sub-category counts (#125062)"
This reverts commit 13f63010784d8d55620fa7846ac2192f20f95113.
Breaks check-llvm.
2025-02-10 15:08:46 -05:00
Florian Hahn
f147d67524
[X86] Use StackArgTokenFactor for all stores when setting up tail calls. (#126244)
Before this patch, the stack argument token factor was used if any
outgoing stack slots needed to be written, but not when writing the
return address to a stack slot. Writing the return address stack slot
can also alias a stack slot for an input argument.

Always use StackArgumentTokenFactor, to ensure the store of the return
address will always use it, i.e. happen after all input arguments are
loaded.

PR: https://github.com/llvm/llvm-project/pull/126244
2025-02-10 20:01:14 +00:00
Thomas Preud'homme
d7fd2a2a3b
[MLIR] Fix LLVMIRTransforms build failure (#125485)
lib/libMLIRLLVMIRTransforms.a fails to build from scratch with the
following error:
In file included from llvm/include/llvm/Frontend/OpenMP/OMPConstants.h:19,
                 from llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:19,
                 from mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h:26,
                 from mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h:24,
                 from mlir/lib/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.cpp:17:
llvm/include/llvm/Frontend/OpenMP/OMP.h:16:10:
fatal error: llvm/Frontend/OpenMP/OMP.h.inc: No such file or directory

Use a forward declaration for OpenMPIRBuilder in ModuleTranslation.h to
avoid pulling OpenMP frontend header that require generated headers.
2025-02-10 19:37:58 +00:00
Paul Kirth
f290fc3df0
[Fuchsia] Disable building runtimes with LTO (#126306)
Temporarily disable LTO'd runtimes, while we investigate an issue
building Fuchsia with LTO.
2025-02-10 11:37:06 -08:00
Joseph Huber
a854c266b9
[Offload][NFC] Rename src/ -> libomptarget/ (#126573)
Summary:
The name `src` is confusing when combined with the plugins and the newly
added `liboffload`.
2025-02-10 13:22:10 -06:00
Joseph Huber
feb30f25c0
[Offload] Fix the offload cache file triggering libc++ / libstdc++ mixing (#126313)
Summary:
We originally wanted `-stdlib=libc++` by default so that it could use
offloading support in libc++, however this causes issues with out the
Offloading proejct itself is built. Is the user builds the LLVM libs
with libstdc++ then uses this cache it will enable this option by
default for the ensuing build of the offloading libraries with the newly
build clang. This will cause a lot of linker failured because the C++
library doesn't match.

Long term I think the proper solution to this is to make better use of
clang configuration files, but I don't know a good way to do that by
default. For now just make it build right.
2025-02-10 13:20:35 -06:00
youngd007
13f6301078
Modify dwarfdump verification to allow sub-category counts (#125062)
It was discovered that BOLT had several distinct issues of missing debug
information by various tags for debug names (119493 & 119023 as
examples), but the verification of a DWARF with llvm-dwarfdump prior to
those fixes only gave one 'missing name' category.
```
{"error-categories":{"Name Index DIE entry missing name":{"count":36355210}},"error-count":36355210}
```
To more easily leverage dwarf verification for debug health, the JSON
output will be improved to allow having detailed counts by a
sub-category when it makes sense.
For now, this is only implemented on the missing tags, but can be
extended to more.
```
{"error-categories":{"Name Index DIE entry missing name":{"count":10,"details":{"DW_TAG_inlined_subroutine":1,"DW_TAG_label":1,"DW_TAG_namespace":2,"DW_TAG_subprogram":2,"DW_TAG_variable":4}}},"error-count":10}
```

This diff also modifies the tests created in pull request 124936 (not
yet landed) to ensure the JSON switches. Ideally this lands after that
but it did not correctly create a stack of pull requests.
2025-02-10 11:06:15 -08:00
Vy Nguyen
50317ca13f
[lldb][telemetry] Implement LLDB Telemetry (part 1) (#119716)
Details:
- This is a subset of PR/98528.( Pavel's suggestion was to split up the
patch to make reviewing easier)
- This contains only the concrete implementation of the framework to be
used but no usages yet.
- I plan to send a few follow-up patches:
+ part2 : includes changes in the plugin-manager to set up the plugin
stuff (ie., how to create a default vs vendor impl)
  + part3 (all of the following can be done in parallel):
* part 3_a: define DebuggerTelemetryInfo and related methods to collect
data about debugger startup/exit
* part 3_b: define TargetTelemetryInfo and related methods to collect
data about debug target(s)
* part 3_c: define CommandTelemetryInfo and related methods to collect
data about debug-commands
* part 3_d: define ClientTelemtryInfo and related methods to collect
data about lldb-dap/any other client

---------

Co-authored-by: Pavel Labath <pavel@labath.sk>
Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-02-10 13:59:52 -05:00
Aiden Grossman
56b760cc47
[ELF] Add support for CREL locations for SHT_LLVM_BB_ADDR_MAP
This patch adds support for properly decoding SHT_LLVM_BB_ADDR_MAP
sections in relocatable object files when the relocation format is CREL.

Reviewers: rlavaee, jh7370, red1bluelost, MaskRay

Reviewed By: MaskRay

Pull Request: https://github.com/llvm/llvm-project/pull/126446
2025-02-10 10:58:56 -08:00
Aiden Grossman
808b1c11a2
[ELF] Add support for CREL to getSectionAndRelocations
This patch updates the getSectionAndRelocations function to also support
CREL relocation sections. Unit tests have been added. This patch also
updates consumers to say they explicitly do not support CREL format
relocations. Subsequent patches will make the consumers work with CREL
format relocations and also add in testing support.

Reviewers: red1bluelost, MaskRay, rlavaee

Reviewed By: MaskRay

Pull Request: https://github.com/llvm/llvm-project/pull/126445
2025-02-10 10:57:19 -08:00
Abid Qadeer
196a1acc7d
[OMPIRBuilder][debug] Fix debug info for variables in target region. (#118314)
When a new function is created to handle OpenMP target region, the
variables used in it are passed as arguments. The scope and the location
of these variable contains still point to te parent function of the
target region. Such variables will fail in Verifier as the scope of the
variables will be different from the containing functions.

Currently, flang is the only user of createOutlinedFunction and it does
not generate any debug data for the the variables in the target region
to avoid this error. When this PR is in, we should be able to remove
this limit in the flang (and anyother client) and have the better debug
experience for the target region.

This PR changes the location and scope of the variables in the target
region to point to correct entities. It is similar to what
fixupDebugInfoPostExtraction does for CodeExtractor. I initially tried
to re-use that function but found quickly that it would require quite a
bit of re-factoring and additions before it could be used. It was much
simpler to make the changes locally.
2025-02-10 18:56:35 +00:00
Aiden Grossman
f101899ae8
[libc++][Github] Remove workflow-scoped write permissions (#126447)
This patch removes the workflow-scoped package write permissions in the
libcxx-build-containers workflow. The relevant permissions are already
present in the job, so this raises the potential for new jobs being
added to the workflow that do not need the permissions but having them
anyways. Not having workflow-scoped write permissions is security best
practice.

Fixes #126230.
2025-02-10 10:54:46 -08:00
Nick Sarnie
5c42ccd726
[Clang][NFC] clang-format __has_builtin implementation (#126571)
Feedback from https://github.com/llvm/llvm-project/pull/126324

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-02-10 18:53:37 +00:00
Charlie Barto
73114e43ee
[compiler-rt][windows] Test fixups for MSVC. (#109887)
- add XFAIL/UNSUPPORTED annotations for tests run wtih real MSVC 
- macroify usages of clang-specific attributes in asan tests

- Add substitution for /Oy-/-fno-omit-frame-pointer
  This makes the dll_intercept_memset test work with mingw

These are most of the changes that are required to get things running
with MSVC, however there are some remaining build-flag tweaks.

Nothing in here should be a functional change.
2025-02-10 10:51:08 -08:00
Peter Rong
839002dd2d
[lld] Remove usage of %T in lld/test (#126133)
`%T` is not unique and deprecated
[[1](https://llvm.org/docs/CommandGuide/lit.html#substitutions)].

This patch replaces all `%T` in `lld/test` with `%t.dir` (`mkdir` if
necessary)

---------

Signed-off-by: Peter Rong <PeterRong@meta.com>
2025-02-10 10:35:44 -08:00
Thomas Sepez
7438a024b6
[-Wunsafe-buffer-usage] Fix assert when constexpr size passed to snprintf() (#119786) (#124022)
EvaluateAsConstExpr() can return an lvalue which is not compatible
with a subsequent getInt() call. Instead, use EvaluateAsInt() which
will use all techniques availble to get an int result compatible
with the subsequent getInt() call.
2025-02-10 19:34:50 +01:00
earnol
1e14edb898
[clang-tidy] Address false positives in misc-redundant-expression checker (#122841)
This patch addresses situations when misc-redundant-expression checker
provides excessive diagnostics for situations with different macros
having the same value. In particular it addresses situations described
in the initial report of
https://github.com/llvm/llvm-project/issues/118885 are addressed. The
situations which are popped inside discussion like if (A + B == B + A)
for macros are not properly addressed by this patch.
Those changes are also mentioned in Release Notes.
---------

Co-authored-by: Vladislav Aranov <vladislav.aranov@ericsson.com>
Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
2025-02-10 13:16:37 -05:00
Benoit Jacob
ced23aa540
[MLIR][Math] Add fine-grained populate-patterns functions for math function rewrites. (#126103)
The existing `mlir::populateMathPolynomialApproximationPatterns` is
coarse-grained and inflexible:
- It populates 2 distinct classes of patterns: (1) polynomial
approximations, (2) expansions of operands to f32.
- It does not offer knobs to select which math functions to apply the
rewrites to.

This PR adds finer-grained populate-patterns functions, which take a
predicate lambda allowing the caller to control which math functions to
apply rewrites to.

Signed-off-by: Benoit Jacob <jacob.benoit.1@gmail.com>
2025-02-10 09:52:24 -08:00
Fangrui Song
ad61e53333
[ARM] Move MCStreamer::emitThumbFunc to ARMTargetStreamer
MCStreamer should not declare arch-specific functions. Such functions
should go to MCTargetStreamer.

Move MCMachOStreamer::emitThumbFunc to ARMTargetMachOStreamer, which is
a new subclass of ARMTargetStreamer. (The new class is just placed in
ARMMachObjectWriter.cpp. The conventional split like
ARMELFObjectWriter.cpp/ARMELFObjectWriter.cpp is overkill.)

`emitCFILabel`, called by ARMWinCOFFStreamer.cpp, has to be made public.

Pull Request: https://github.com/llvm/llvm-project/pull/126199
2025-02-10 09:40:43 -08:00
Jinsong Ji
5d2e2847e0
MachineCopyPropagation: Do not remove copies preserved by regmask (#125868)
llvm/llvm-project@9e436c2daa tries to handle register masks and
sub-registers, it avoids clobbering RegUnit presreved by regmask. But it
then introduces invalid pointer issues.

We delete the copies without invalidate all the use in the CopyInfo, so
we dereferenced invalid pointers in next interation, causing asserts.

Fixes: #126107

---------

Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
2025-02-10 12:26:33 -05:00
Fangrui Song
0a470a9264
[ELF] --package-metadata: support %[0-9a-fA-F][0-9a-fA-F]
(This application-specific option is probably not appropriate as a
linker option (.o file offers more flexibility and decouples JSON
verification from linkers). However, the option has gained some traction
in Linux distributions, with support in GNU ld, gold, and mold.)

GNU ld has supported percent-encoded bytes and extensions like
`%[comma]` since November 2024.  mold supports just percent-encoded
bytes.  To prepare for potential adoption by Ubuntu, let's support
percent-encoded bytes.

Link: https://sourceware.org/bugzilla/show_bug.cgi?id=32003
Link: https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/2071468

Pull Request: https://github.com/llvm/llvm-project/pull/126396
2025-02-10 09:21:31 -08:00
Andreas Jonson
9e0077c921
[ValueTracking] Handle not in dominating condition. (#126423)
General handling of not in dominating condition.

proof: https://alive2.llvm.org/ce/z/FjJN8q
2025-02-10 18:14:09 +01:00
Luke Lau
e42fdcb41f
[RISCV] Match widening fp instructions with same fpext used in multiple operands (#125803)
Because the fpext has a single use constraint on it we can't match cases
where it's used for both operands.

Introduce a new PatFrag that allows multiple uses on a single user and
use it for the binary patterns, and some ternary patterns.

(For some of the ternary patterns there is a fneg that counts as a
separate user, we still need to handle these)
2025-02-11 01:11:44 +08:00
Rahul Joshi
55015e150b
[NFC][TableGen] Delete getLogicalOperandType from InstrInfoEmitter (#125951)
Delete `getLogicalOperandType` function from InstrInfoEmitter as no
backend seems to use it.
2025-02-10 09:08:49 -08:00
Mark de Wever
b319dfef21
[libc++][CI] Updates Clang HEAD version in Docker. (#126419)
This is a preparation to test Clang 21 in the CI,

Drive-by: Updated some outdated documentation.
2025-02-10 18:08:24 +01:00
Sam Elliott
62245aaa6b
[RISCV] Improve Errors for GPRNoX0X2/SP Reg Classes (#126394)
More adoption of better diagnostics for RISC-V register classes:
- GPRNoX0X2 (GPRs excluding `zero` and `x2`, used for `c.lui`)
- SP (only contains `sp`)
2025-02-10 09:07:51 -08:00
Mark de Wever
5b9e6c7993
[libc++] Improves type-safety in generator script. (#101880)
This changes the code to use dataclasses instead of dict entries. It
also adds type aliases to use in the typing information and updates the
typing information.
2025-02-10 18:03:44 +01:00
Prashanth
6a8439b593
[libc][docs] Add sys/statvfs to documentation and YAML definitions (#126413)
These changes ensure that the sys/statvfs header is documented properly
with respect to the issue (
https://github.com/llvm/llvm-project/issues/122006 ) .
2025-02-10 08:58:46 -08:00
Tai Ly
62ae876b1b
[mlir][tosa] Fix conv op build functions (#126321)
This patch fixes several issues:
  - buildConvOpWithQuantInfo: 
       call buildConvOpResultTypeInfo to get final output type
  - buildTransConvOpWithQuantInfo:
       add input_zp and weight_zp operands
       remove input_zp/weight_zp attributes
  - createZeroPointTensor:
       add getElementTypeOrSelf to get element type just in case
       remove bad auto-merge lines


Change-Id: Idbf88f500ce57a865da4b7be7b7b8bf2ba194b24

Signed-off-by: Tai Ly <tai.ly@arm.com>
2025-02-10 08:36:29 -08:00