529994 Commits

Author SHA1 Message Date
Jason Molenda
cec36e279c Revert "Add LDFLAGS to fix bot failure"
This reverts commit 00fdc5297e2ac325eeaa08e1bc8ebe3b8b5f7977.
2025-03-06 17:19:43 -08:00
Rifet-c
4a0212b9fc
[CodeGen] Combine two loops in SlotIndexes.cpp file (#127631)
Merged two loops that were iterating over the same machine basic block
into one, also did some minor readability improvements (variable
renaming, commenting and absorbing if condition into a variable)
2025-03-07 08:17:23 +07:00
Adrian Prantl
ca0850f916
[lldb] Objective-C runtime: Work around a bug in the shared cache builder (#130209)
where it can overflow a 2GB offset by just a little bit by applying a
heuristic.

rdar://145888306
2025-03-06 17:15:49 -08:00
Jason Molenda
00fdc5297e Add LDFLAGS to fix bot failure
a CI bot is failing with my manual $(LD) invocations,
I see another test invoking ld like this which also
passes $LDFLAGS, let's see if that does it.
2025-03-06 17:03:16 -08:00
Matt Arsenault
3304a430f2
clang/HIP: Do not call ocml in scalbln implementations (#129639)
I do not understand why this was calling the float version with
an implicit cast from the long. Just clamp to the bounds of int,
and use the generic ldexp (this is also how musl does it, except
scalbnf is the base implementation there).

Somehow INT_MIN was also not defined, so deal with that.
2025-03-07 07:55:26 +07:00
Matt Arsenault
c22db56d77
PeepholeOpt: Remove subreg def check for bitcast (#130086)
Subregister defs are illegal in SSA. Surprisingly this enables folding
into subregister insert patterns in one test.
2025-03-07 07:44:08 +07:00
Matt Arsenault
a6e69db52f
PeepholeOpt: Remove subreg def check for insert_subreg (#130085) 2025-03-07 07:40:51 +07:00
Matt Arsenault
1b284c5081
AMDGPU: Fix gfx950 ashr pk i8/u8 patterns (#130040)
The correct version of the pattern got lost in a merge somewhere
2025-03-07 07:36:33 +07:00
Jason Molenda
397696bb3d
[lldb][Mach-O] Don't read symbol table of specially marked binary (#129967)
We have a binary image on Darwin that has no code, only metadata. It has
a large symbol table with many external symbol names that will not be
needed in the debugger. And it is possible to not have this binary on
the debugger system - so lldb must read all of the symbol names out of
memory, one at a time, which can be quite slow.

We're adding a section __TEXT,__lldb_no_nlist, to this binary to
indicate that lldb should not read the nlist symbols for it when we are
reading out of memory. If lldb is run with an on-disk version of the
binary, we will load the symbol table as we normally would, there's no
benefit to handling this binary differently.

I added a test where I create a dylib with this specially named section,
launch the process. The main binary deletes the dylib from the disk so
lldb is forced to read it out of memory. lldb attaches to the binary,
confirms that the dylib is present in the process and is a memory
Module. If the binary is not present, or lldb found the on-disk copy
because it hasn't been deleted yet, we delete the target, flush the
Debugger's module cache, sleep and retry, up to ten times. I create the
specially named section by compiling an assembly file that puts a byte
in the section which makes for a bit of a messy Makefile (the pre-canned
actions to build a dylib don't quite handle this case) but I don't think
it's much of a problem. This is a purely skipUnlessDarwin test case.

rdar://146167816
2025-03-06 16:34:13 -08:00
Matt Arsenault
f0c2c71d2c
PeepholeOpt: Remove dead checks for subregister def mismatch (#130084) 2025-03-07 07:31:33 +07:00
Ajay Raj
9a65dc9513
Add sysexits.h header with BSD exit codes (total-18) (#126112)
This pull request adds a new header file, SysExits.h, to the LLVM
project. The header includes 18 BSD exit code.
2025-03-06 16:25:14 -08:00
Matt Arsenault
410a5b1518
Local: Handle noalias.addrspace in copyMetadataForLoad (#130123) 2025-03-07 07:17:54 +07:00
Derek Schuff
6916438b65
[WebAssembly] Add Libcall signatures for modf and variants (#130201)
Clang now lowers modf/modff/modfl as builtins using the llvm.modf
intrinsic.
2025-03-06 15:48:39 -08:00
Jeffrey Byrnes
bf12954715
[AMDGPU] Whitelist all intrinsics (#130150)
For code maintainability -- this may result in cases where we are
applying the optimization where it is not profitable, but those are
likely to be rare.
2025-03-06 15:39:11 -08:00
Tom Honermann
813325e5d4
[Clang][NFC] Change uses of getAs() to castAs() where the target type is assured. (#130188)
Static analysis identified two uses of `getAs()` for which the result
pointer was unconditionally dereferenced. Source code inspection
confirmed that the target type is assured by prior checks. This change
replaces these uses of `getAs()` with `castAs()`.

The first case, in `clang/lib/CodeGen/Targets/AArch64.cpp`, performs a
cast to `BuiltinType` following a check for `isBuiltinType()`.

The second case, in `clang/lib/Sema/SemaTemplateVariadic.cpp`, performs
a cast to `PackExpansionType` on the result of a call to `getAsType()`
on an object of type `TemplateArgument` following confirmation that
`isPackExpansion()` returned true and that `getKind()` returned
`TemplateArgument::Type`. Inspection of `isPackExpansion()` revealed
that it only returns true when the template argument kind is
`TemplateArgument::Type` if `isa<PackExpansionType>(getAsType())` is
true.
2025-03-06 18:12:20 -05:00
Oleksandr T.
93f0f3d33b
[Clang] add -Wshift-bool warning to handle shifting of bool (#127336)
Fixes #28334

--- 

This PR introduces the `-Wshift-bool` warning to detect and warn against
shifting `bool` values using the `>>` operator. Shifting a `bool`
implicitly converts it to an `int`, which can lead to unintended
behavior.
2025-03-07 01:05:56 +02:00
aankit-ca
29d3fc3f11
[HEXAGON] Fix hvx-isel for extract_subvector op (#129672)
Fixes a crash with extract_subvectors in Hexagon backend seen when the
source vector is a vector-pair and result vector is not hvx vector size.

LLVM Issue: https://github.com/llvm/llvm-project/issues/128775
Fixes #128775
---------

Co-authored-by: aankit-quic <aankit@quicinc.com>
2025-03-06 17:02:10 -06:00
Jerry-Ge
472c2e3578
[mlir][tosa] Update value to values for ConstOp and ConstShapeOp (#129943)
Updated the dialect to match TOSA v1.0 specification for ConstOp and
ConstShapeOp (https://www.mlplatform.org/tosa/tosa_spec.html#_const).

Also updated lit tests

---------

Signed-off-by: Jerry Ge <jerry.ge@arm.com>
2025-03-06 14:55:50 -08:00
John Harrison
e415721858
[lldb-dap] Correct the variable name from a half finished merge. (#130186) 2025-03-06 14:15:30 -08:00
Aiden Grossman
eac734aab6
[libc][docs] Fix libc docs build post #129138 (#130184)
The docs build action was failing with libc due to checks.rst not
existing in the expected path. This patch adjusts the path to the actual
path which seems to make everything happy. It seems like this did not
show up before as stdfix.rst was not included in a place that actually
caused it to get picked up by sphinx.
2025-03-06 14:07:44 -08:00
John Harrison
27c788de75
[lldb-dap] Restore the override FD used by the output redirect on stop. (#129964)
While running lldb-dap over stdin/stdout the `stdout` and `stderr` FD's
are replaced with a pipe that is reading the output to forward to the
dap client. During shutdown we were not properly restoring those FDs,
which means if any component attempted to write to stderr it would
trigger a SIGPIPE due to the pipe being closed during the shutdown
process. This can happen if we have an error reported from the
`DAP::Loop` call that would then log to stderr, such as an error parsing
a malformed DAP message or if lldb-dap crashed and it was trying to
write the stack trace to stderr.

There is one place we were not handling an `llvm::Error` if there was no
logging setup that could trigger this condition.

To address this, I updated the OutputRedirector to restore the FD to the
prior state when `Stop` is called.

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-03-06 13:57:06 -08:00
DianQK
462eb7e28e
[ValueTracking] Skip incoming values that are the same as the phi in isGuaranteedNotToBeUndefOrPoison (#130111)
Fixes (keep it open) #130110.

If the incoming value is PHI itself, we can skip this. If we can
guarantee that the other incoming values are neither undef nor poison,
then we can also guarantee that the value isn't either. If we cannot
guarantee that, it makes no sense in calculating it.
2025-03-07 05:46:32 +08:00
Sam Elliott
3492245ac0
[RISCV] QCI Interrupt Support (#129957)
This change adds support for `qci-nest` and `qci-nonest` interrupt
attribute values. Both of these are machine-mode interrupts, which use
instructions in Xqciint to push and pop A- and T-registers (and a few
others) from the stack.

In particular:
- `qci-nonest` uses `qc.c.mienter` to save registers at the start of the
function, and uses `qc.c.mileaveret` to restore those registers and
return from the interrupt.
- `qci-nest` uses `qc.c.mienter.nest` to save registers at the start of
the function, and uses `qc.c.mileaveret` to restore those registers and
return from the interrupt.
- `qc.c.mienter` and `qc.c.mienter.nest` both push registers ra, s0
(fp), t0-t6, and a0-a10 onto the stack (as well as some CSRs for the
interrupt context). The difference between these is that
`qc.c.mienter.nest` re-enables M-mode interrupts.
- `qc.c.mileaveret` will restore the registers that were saved by
`qc.c.mienter(.nest)`, and return from the interrupt.

These work for both standard M-mode interrupts and the non-maskable
interrupt CSRs added by Xqciint.

The `qc.c.mienter`, `qc.c.mienter.nest` and `qc.c.mileaveret`
instructions are compatible with push and pop instructions, in as much
as they (mostly) only spill the A- and T-registers, so we can use the
`Zcmp` or `Xqccmp` instructions to spill the S-registers. This
combination (`qci-(no)nest` and `Xqccmp`/`Zcmp`) is not implemented in
this change.

The `qc.c.mienter(.nest)` instructions have a specific register storage
order so they preserve the frame pointer convention linked list past the
current interrupt handler and into the interrupted code and frames if
frame pointers are enabled.

Co-authored-by: Pankaj Gode <quic_pgode@quicinc.com>
2025-03-06 13:31:08 -08:00
Aaron Ballman
f3effc2400 [C2y] Claim conformance to N3347
This paper made it a constraint violation to have a tentative
definition with internal linkage which is not completed by the end of
the translation unit.

This has been diagnosed as an error since at least Clang 3.0, so no
changes are needed.
2025-03-06 16:21:40 -05:00
Justin Bogner
5f6b058c6a
[DirectX] Match DXC when storing RWBuffer<float> (#129911)
Update the lowering of `llvm.dx.resource.store.typedbuffer` to match DXC
and repeat the first element in cases where we are storing fewer than 4
elements.

Fixes #128110
2025-03-06 13:18:06 -08:00
erichkeane
1493f42060 [OpenACC] Add test changes missed in 7d8da04
Looks like I did a bad job with git and ended up having some failed
tests!  This should fix those.
2025-03-06 13:16:57 -08:00
Kelvin Li
a7a65a824e
[flang] explicitly cast the pointer to void* in std::memcpy calls (NFC) (#129946)
This patch is to add the explicit cast to the first argument of std::memcpy.
2025-03-06 16:09:16 -05:00
Michael Buch
542d52b1e8
[lldb][Expression] Allow specifying a preferred ModuleList for lookup during expression evaluation (#129733)
The `TestMemoryHistory.py`/`TestReportData.py` are currently failing on
the x86 macOS CI (started after we upgraded the Xcode SDK on that
machien). The LLDB ASAN utility expression is failing to run with
following error:
```
(lldb) image lookup -n __asan_get_alloc_stack
1 match found in /usr/lib/system/libsystem_sanitizers.dylib:
        Address: libsystem_sanitizers.dylib[0x00007ffd11e673f7] (libsystem_sanitizers.dylib.__TEXT.__text + 11287)
        Summary: libsystem_sanitizers.dylib`__asan_get_alloc_stack
1 match found in /Users/michaelbuch/Git/lldb-build-main-no-modules/lib/clang/21/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:
        Address: libclang_rt.asan_osx_dynamic.dylib[0x0000000000009ec0] (libclang_rt.asan_osx_dynamic.dylib.__TEXT.__text + 34352)
        Summary: libclang_rt.asan_osx_dynamic.dylib`::__asan_get_alloc_stack(__sanitizer::uptr, __sanitizer::uptr *, __sanitizer::uptr, __sanitizer::u32 *) at asan_debugging.cpp:132
(lldb) memory history 'pointer'
Assertion failed: ((uintptr_t)addr == report.access.address), function __asan_get_alloc_stack, file debugger_abi.cpp, line 62.
warning: cannot evaluate AddressSanitizer expression:
error: Expression execution was interrupted: signal SIGABRT.
The process has been returned to the state before expression evaluation.
```

The reason for this is that the system sanitizer dylib and the locally
built libclang_rt contain the same symbol `__asan_get_alloc_stack`, and
depending on the order in which they're loaded, we may pick the one from
the wrong dylib (this probably changed during the buildbot upgrade and
is why it only now started failing). Based on discussion with @wrotki we
always want to pick the one that's in the libclang_rt dylib if it was
loaded, and libsystem_sanitizers otherwise.

This patch addresses this by adding a "preferred lookup context list" to
the expression evaluator. Currently this is only exposed in the
`EvaluateExpressionOptions`. We make it a `SymbolContextList` in case we
want the lookup contexts to be contexts other than modules (e.g., source
files, etc.). In `IRExecutionUnit` we make it a `ModuleList` because it
makes the symbol lookup implementation simpler and we only do module
lookups here anyway. If we ever need it to be a `SymbolContext`, that
transformation shouldn't be too difficult.
2025-03-06 21:07:22 +00:00
Aaron Ballman
9a0e652ec7 [www] Update the C++ status pages for Clang 20 2025-03-06 16:06:51 -05:00
Aaron Ballman
22eab44aae [www] Update for Clang 20 release 2025-03-06 16:04:02 -05:00
Aaron Ballman
73b2ad51f4 [www] Add papers from Graz
These are the papers accepted at the recent WG14 meeting in Graz which
impact the compiler.
2025-03-06 16:03:11 -05:00
erichkeane
7d8da04c26 [OpenACC] Implement 'nohost' construct AST/Sema
'nohost' is only valid on routine, and states that the compiler
shouldn't compile this routine for the host. It has no arguments, so no
checking is required besides putting it in the AST.
2025-03-06 12:50:49 -08:00
Kelvin Li
996092d5a5
[flang] probably convert Fortran logical to i1 in expanding hlfir.maxloc/hlfir.minloc opcodes (#129791)
If mask is a scalar, it always converts to !fir.box<!fir.array<1xi1>>.
The wrong value may be picked up when passing to the function
on the big endian platform. This patch is to do the conversion 
based on the original type of the mask and convert the value to 
i1 after the load.
2025-03-06 15:47:44 -05:00
Evgenii Kudriashov
5b9e1a5758
[X86][AsmParser] Improve rel8 validation (#126073)
* Check the size of immediate operand of rel8
* Rename AbsMem16 related names to AbsMemMode16 to disambiguate mem size
and mode checks.
2025-03-06 21:45:16 +01:00
Marcus Boay
50219c8af2
[PowerPC] [NFC] Refine PowerPC GISel files according to clang-tidy checks (#129780)
Code cleanup for PowerPC GISel files such as renaming header guards and
removing unused includes.
2025-03-06 15:38:12 -05:00
Paige Lewis
1073a23ca0
Updating variable names (#130136)
Updating variable names within the SystemZAsmParser to comply with
naming conventions.

Co-authored-by: Paige Lewis <paige.lewis@ibm.com>
2025-03-06 15:31:32 -05:00
Florian Hahn
72376e19df
[VPlan] Remove unused VPWidenIntrinsicRecipe constructor (NFC) 2025-03-06 20:24:30 +00:00
erichkeane
1b75b9e665 [OpenACC] Handle sema for gang, worker, vector, seq clauses on routine
These 4 clauses are mutually exclusive, AND require at least one of
them. Additionally, gang has some additional restrictions in that only
the 'dim' specifier is permitted. This patch implements all of this, and
ends up refactoring the handling of each of these clauses for
readabililty.
2025-03-06 11:53:46 -08:00
Ramkumar Ramachandra
c9e250af8e
[LoopUtils] Rename a var in addDiffRuntimeChecks (NFC) (#130128) 2025-03-06 19:31:18 +00:00
Ramkumar Ramachandra
ddffb74afd
[LV] Strip unreachable SCEV-check blocks (#130079)
emitSCEVChecks checks if SCEVCheckCond matches zero, and returns
nullptr. However, it sets SCEVCheckCond as used before it does this,
which prevents it from being removed during cleanup, resulting in
unreachable blocks being emitted. Fix this.
2025-03-06 19:30:25 +00:00
Ramkumar Ramachandra
00f3089c2e
[LV] Use PatternMatch in emitTransformedIndex (NFC) (#130081) 2025-03-06 19:23:31 +00:00
Peter Collingbourne
d58c793673
Pass: Do not use llvm::array_pod_sort to sort OpPassManagers.
OpPassManager contains a field of type std::unique_ptr which
is not guaranteed to be trivially relocatable so we cannot use
llvm::array_pod_sort.

Reviewers: River707, joker-eph

Reviewed By: joker-eph

Pull Request: https://github.com/llvm/llvm-project/pull/129968
2025-03-06 11:20:23 -08:00
Mircea Trofin
5f70ed5bda
[nfc] Small fixups (coding style) post- PR #129626 (#129935) 2025-03-06 10:58:14 -08:00
Michael Jones
1df59b3817
[libc][bazel] Add targets for float16 math (#129965)
Add targets for some float16 math functions that were missing them, but
mostly add targets for the smoke tests.
2025-03-06 10:46:20 -08:00
Dmitry Sidorov
7a44ff13d9
[SPIR-V] Add SPV_INTEL_memory_access_aliasing extension (#129800)
Spec can be found here https://github.com/intel/llvm/pull/15225
 TODO for future patches:
- During spec review need to decide whether only FunctionCall or Atomic
instructions can be decorated and if not - move the code around adding
handling for other instructions;
- Handle optional string metadata;
- Handle LLVM atomic instructions;
- Handle SPIR-V friendly atomic calls returning via sret argument.

Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
2025-03-06 19:44:21 +01:00
Aiden Grossman
0ce4b685d2
[Github] Prefer ubuntu-24.04 over ubuntu-latest (#129936)
This patch replaces all instances of ubuntu-latest with ubuntu-24.04
(outside of the entries in libc++) based on the guidelines in the LLVM
CI best practices doc (https://llvm.org/docs/CIBestPractices.html).
2025-03-06 10:32:02 -08:00
Aiden Grossman
a17a155081
[Github][libc++] Prefer ubuntu-24.04 over ubuntu-latest (#129949)
This patch replaces all instances of ubuntu-latest with ubuntu-24.04
based on the guidelines in the LLVM CI best practices doc
(https://llvm.org/docs/CIBestPractices.html).
2025-03-06 10:31:43 -08:00
PiJoules
1a09adae9f
[libc] Add link to stdfix.h on headers page (#129138)
Co-authored-by: Petr Hosek <phosek@google.com>
2025-03-06 10:31:26 -08:00
Kunwar Grover
d10dca6ba7
[mlir][Vector] Move vector.insert canonicalizers for DenseElementsAttr to folders (#128040)
This PR moves vector.insert canonicalizers for DenseElementsAttr (splat
and non splat case) to folders. Folders are local, and it's always
better to implement a folder than a canonicalizer.

This PR is mostly NFC-ish, because the functionality mostly remains
same, but is now run as part of a folder, which is why some tests are
changed, because GreedyPatternRewriter tries to fold by default.
2025-03-06 18:24:38 +00:00
Andrzej Warzyński
6701669835
[mlir][vector][nfc] Replace failure() with notifyMatchFailure() (#129278)
Updates some instances of plain `return failure();` in VectorToSCF.cpp
with `return notifyMatchFailure();` and a description (usually copied
from the nearby comment).

There's many more "plain" `return failure();` left, but ATM I only
have the cycles for the ones updated here.
2025-03-06 18:22:46 +00:00