Commit Graph

537828 Commits

Author SHA1 Message Date
LauraElanorJones
9178a17206 Update python.rst (#140333)
Fix code block formatting in section "The Decision Point Breakpoint
Commands"
2025-05-16 19:17:03 -07:00
Malavika Samak
39315663a4 [-Wunsafe-buffer-usage] Fix false warnings when const sized array is safely accessed (array [idx %const]) (#140113)
The -Wunsafe-buffer-usage analysis currently warns when a const sized
array is safely accessed, with an index that is bound by the remainder
operator. The false alarm is now suppressed.

Example:

int circular_buffer(int array[10], uint idx) {
   return array[idx %10]; // Safe operation
}

rdar://148443453

---------

Co-authored-by: MalavikaSamak <malavika2@apple.com>
2025-05-16 18:33:51 -07:00
Andy Kaylor
f7ef8dcbad [CIR] Fix problem with phantom function arguments (#140322)
There was a problem introduced today where sometimes the CIR for
functions with no arguments would be generated with phantom arguments.
This was causing intermittent test failures.

The problem appears to have been that we were using two different
Profile implementations to generate the FoldingSetNodeID for
CIRGenFunctionInfo so occaissionally when we tried to look for a
pre-existing entry for a function with no arguments it would incorrectly
match a CIRGenFunctionInfo entry that had arguments.

To prevent this from happening again, I rewrote one of the two Profile
functions to call the other.
2025-05-16 18:01:12 -07:00
Jorge Gorbe Moya
5c154277ef [bazel] Add missing dep after 6a0e626af5 2025-05-16 17:56:32 -07:00
Paul Kirth
6a0e626af5 [clang-doc] Add HTMLMustacheGenerator methods (#138061)
Split from #133161. This patch fills in the implementation for a number
of the MustacheHTMLGenerator methods. Many of these APIs are just
stubbed out, and will have their implementation filled in by later
patches.

Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-05-16 17:30:45 -07:00
Chinmay Deshpande
437195efbf [NFC][AMDGPU] Update tests to use autogened CHECKs (#140311) 2025-05-16 17:22:19 -07:00
Leonard Chan
286ab11dc6 Reapply "[llvm][CFI] Do not canonicalize COFF functions in a comdat (#139962)"
This reapplies 33684ac9be with appropriate
requires on tests.

COFF requires that a function exists with the same name as a comdat. Not
having this key function results in `LLVM ERROR: Associative COMDAT
symbol '...' does not exist.` CFI by default will attempt to
canonicalize a function by appending `.cfi` to its name which allows
external references to refer to the new canonical alias, but it does not
change the comdat name. We can change the comdat name since symbol and
comdat resolution occurs before LTO, so we already know which symbols
are prevailing.
2025-05-16 15:38:22 -07:00
Leonard Chan
1fa8394e78 Revert "[llvm][CFI] Do not canonicalize COFF functions in a comdat (#139962)"
This reverts commit 33684ac9be.

Reverting since this is breaking a bunch of builders. See the llvm-ci
messages on https://github.com/llvm/llvm-project/pull/139962.
2025-05-16 15:17:51 -07:00
Kazu Hirata
dd4b69f9a8 [Basic] Use llvm::erase_if (NFC) (#140309) 2025-05-16 15:07:54 -07:00
Aaron St George
da944e0099 [mlir][tensor] Add shape inference support for tensor.concat op. (#140168)
## description
`tensor.concat` requires operands and the result to match on all
dimensions except the concatenation dimension. If one operand is already
static in those dimensions, the other operands and result type may
safely be refined to that same static shape. This PR adds
canonicalization patterns to refine `tensor.concat` types and propagate
static shapes to other canonicalization patterns through casts.

## example
```mlir
%2 = tensor.concat dim(0) %0, %1: (tensor<?x12xi32>, tensor<?x?xi32>) ->tensor<?x12xi32>
```
becomes:
 ```mlir
%cast = tensor.cast %1 : tensor<?x?xi32> to tensor<?x12xi32>
%2 = tensor.concat dim(0) %0, %cast : (tensor<?x12xi32>,
tensor<?x12xi32>) -> tensor<?x12xi32>
 ```

---------

Co-authored-by: Ian Wood <ianwood2024@u.northwestern.edu>
2025-05-16 15:06:42 -07:00
Mikhail R. Gadelha
ba38e56c98 [libc] Enable setitimer and getitimer functions on riscv (#139182)
These functions don't have a _time64 variant, so we can't use time_t
directly (since our time_t is a uint64_t). The workaround is to use
longs when doing the syscall and write back when necessary.
2025-05-16 18:55:32 -03:00
PiJoules
33684ac9be [llvm][CFI] Do not canonicalize COFF functions in a comdat (#139962)
COFF requires that a function exists with the same name as a comdat. Not
having this key function results in `LLVM ERROR: Associative COMDAT
symbol '...' does not exist.` CFI by default will attempt to
canonicalize a function by appending `.cfi` to its name which allows
external references to refer to the new canonical alias, but it does not
change the comdat name. We can change the comdat name since symbol and
comdat resolution occurs before LTO, so we already know which symbols
are prevailing.
2025-05-16 14:54:18 -07:00
Craig Topper
555d68f3db [RISCV] Use implicit def/use of SP for PROBED_STACKALLOC*. (#139153) 2025-05-16 14:43:22 -07:00
Amy Huang
7175970fc5 Add debug location to strlen in LoopIdiomRecognize pass (#140164)
Pass down the debug location to the generated strlen call
because LLVM maintains that calls to inlinable functions must have debug info.
2025-05-16 14:42:20 -07:00
Jorge Gorbe Moya
fec9be9f73 [bazel][mlir] Add missing dep and include after 9b63bdd154
This fixes issues when compiling SliceMatchers.h separately. In
particular, the missing include triggered a "member access into
incomplete type" error:

```
third_party/llvm/llvm-project/mlir/include/mlir/Query/Matcher/SliceMatchers.h:91:30: error: member access into incomplete type 'Operation'
   91 |     for (auto operand : subOp->getOperands()) {
      |                              ^
third_party/llvm/llvm-project/mlir/include/mlir/Analysis/SliceAnalysis.h:20:7: note: forward declaration of 'mlir::Operation'
   20 | class Operation;
      |       ^
```
2025-05-16 14:14:01 -07:00
David Green
ff78d233c0 [AArch64] Ensure Source1 and Source2 are initialized.
Try to appease the sanatizers builders by making sure the Source1 and Source2
and initialized when passed to the tuple.

See #139331.
2025-05-16 22:03:25 +01:00
Florian Hahn
b3e7e4bb25 [VPlan] Also specialize getNumIncoming for VPWidenPointerInd (NFC).
Similar to VPWidenIntOrFpInductionRecipe, VPWidenPointerInductionRecipe
only has a single incoming value and no backedge value.

Currently NFC as there are no problematic uses at the moment.
2025-05-16 22:00:31 +01:00
Dmitry Vasilyev
4a4f0ffb5b Fixed cmake config in case of LLVM_ENABLE_RPMALLOC=ON and non MSVC compiler (#139770)
This patch fixes the following error in case of LLVM_ENABLE_RPMALLOC=ON
and clang or other non MSVC compiler:
```
CMake Error at cmake/modules/AddLLVM.cmake:644 (add_library):
  Target "LLVMSupport" links to item " -INCLUDE:malloc" which has leading or
  trailing whitespace.  This is now an error according to policy CMP0004.
Call Stack (most recent call first):
  cmake/modules/AddLLVM.cmake:944 (llvm_add_library)
  cmake/modules/AddLLVM.cmake:917 (add_llvm_library)
  lib/Support/CMakeLists.txt:139 (add_llvm_component_library)
```
Note `delayload_flags` is empty before this line is case of non MSVC
compiler.
The behavior is the same with CMake 3.25.3 and 4.0.2.
2025-05-17 00:41:25 +04:00
Philip Reames
3def9976eb Use early return/continue in TailDuplicator::duplicateInstruction [nfc] 2025-05-16 13:33:11 -07:00
Florian Hahn
ba93685ea2 [VPlan] Also use original parent loop for exit VPBBs.
When vectorizing loops with early exits that is nested within another
one, one of the loop exits may be outside both loops, so setting adding
it to the parent loop is incorrect. Also use the original parent loop
for exit blocks.
2025-05-16 21:12:39 +01:00
Kazu Hirata
ad6bb70773 [llvm] Fix typos in documentation (#140275)
Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
2025-05-16 12:37:43 -07:00
Qinkun Bao
dd4a73069c [NFCI][Sanitizer] Convert SpecialCaseList::Sections from StringMap to vector.
As discussed in https://github.com/llvm/llvm-project/pull/139772, SpecialCaseList::Sections can keep the order of Sections when parsing the case list.

Reviewers: thurstond, vitalybuka

Reviewed By: vitalybuka

Pull Request: https://github.com/llvm/llvm-project/pull/140127
2025-05-16 15:32:54 -04:00
cor3ntin
efa28338d8 [Clang] Fix a regression introduced by #140073 (#140288)
Pointer to data member don't decay, assuming they do caused an assertion
failure.
2025-05-16 21:04:08 +02:00
Bill Wendling
00c5cd8a7a [libc] Fix typo: Configue -> Configure (#140166) 2025-05-16 11:48:36 -07:00
Grigory Pastukhov
48587f30d6 [clang] Add new warning: not eliding copy on return (missed NRVO) (#139973) 2025-05-16 15:47:53 -03:00
Eli Friedman
4e01a07cff [AArch64] Fixes for Windows varargs handling. (#139972)
Omit spills when va_start is not present, like we do on other targets.
In most situations this is just an optimization, but for thunks in
arm64ec, we need this because it's illegal to reference varargs in a
thunk.

Fix the bug that prevented omitting vararg spills from working properly:
we need to avoid interfering with musttail handling. (This is not a
Windows-only issue, but it mostly affects Windows because musttail
thunks are mostly used for the Microsoft C++ ABI.)

On arm64ec, don't set x4 and x5 for musttail thunks; forward them from
the caller.

Fixes #139856 .
2025-05-16 11:30:51 -07:00
Craig Topper
976b00654a [RISCV] Disable combineToVCPOP for illegal scalable vector types. (#140195)
This transform creates target specific instructions which must have
legal types. We were checking this for fixed vectors, but not scalable
vectors. This caused a crash with <vscale x 1 x i1> which isn't legal
for Zve32x.
2025-05-16 11:24:26 -07:00
David Green
0de8ff6d9c [AArch64] Reduce the cost of repeated sub-shuffle (#139331)
Given a larger-than-legal shuffle we will split into multiple sub-parts.
This adds a check to the computed costs of sub-shuffles so that repeated
sequences are not accounted for multiple times. This especially reduces
the cost of broadcasts/splats.
2025-05-16 18:50:05 +01:00
Mariusz Kwiczala
85fe4ab8a3 Rename GsymDIContext to GsymContext (#140227)
Renaming based on suggestion here: 
https://github.com/llvm/llvm-project/pull/139686#discussion_r2089538528
2025-05-16 10:18:21 -07:00
Hui
4b104c6853 [libc++] Fix flat_{multi}set insert_range (#137462)
Fixes #136656
2025-05-16 13:17:21 -04:00
Alexander Richardson
aec685ea77 [DataLayout] Introduce DataLayout::getAddressSize(AS)
This function can be used to retrieve the number of bits that can be used
for arithmetic in a given address space (i.e. the range of the address
space). For most in-tree targets this should not make any difference
but differentiating between the size of a pointer in bits and the address
range is extremely important e.g. for CHERI-enabled targets, where pointers
carry additional metadata such as bounds and permissions and only a subset
of the pointer bits is used as the address.

The address size is defined to be the same as the index size.

We considered adding a separate property since targets exist where indexing
and address range actually use different sizes (AMDGPU fat pointers with
160 representation, 48 bit address and 32 bit index), but for the purposes
of LLVM semantics, differentiating them does not add much value and it
introduces a lot of complexity in ensure the correct bits are used. See
the reasoning by @nikic on https://discourse.llvm.org/t/clarifiying-the-semantics-of-ptrtoint/83987/38https://discourse.llvm.org/t/clarifiying-the-semantics-of-ptrtoint/83987/49

Originally uploaded as https://reviews.llvm.org/D135158

Reviewed By: davidchisnall, krzysz00

Pull Request: https://github.com/llvm/llvm-project/pull/139347
2025-05-16 10:04:00 -07:00
Dan Blackwell
e620f10f57 [compiler-rt][sanitizer_common] Alter sanitizer_set_report_path_test to not assume a fixed file path (#139282)
Currently, `Posix/sanitizer_set_report_path_test.cpp` contains the
following check: `// CHECK: ERROR: Can't create directory:
{{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp`. This makes
an assumption that the test file resides in `Posix/Output`, however when
testing on a remote device, an alternative temporary directory path is
used. This patch instead checks that the path in the error message
matches the requested path dynamically.
2025-05-16 10:02:54 -07:00
Craig Topper
8188931778 [RISCV] Rename getOriginalAlign->getBaseAlign after #139930 2025-05-16 09:57:24 -07:00
Alexey Bataev
d79d9b8fbf [SLP]Change the insertion point for outside-block-used nodes and prevec phi operand gathers
Need to set the insertion point for (non-schedulable) vector node after
the last instruction in the node to avoid def-use breakage. But it also
causes miscompilation with gather/buildvector operands of the phi nodes,
used in the same phi only in the block.
These nodes supposed to be inserted at the end of the block and after
changing the insertion point for the non-schedulable vec block, it also
may break def-use dependencies. Need to prevector such nodes, to emit
them as early as possible, so the vectorized nodes are inserted before
these nodes.

Fixes #139728

Reviewers: hiraditya, HanKuanChen, RKSimon

Reviewed By: RKSimon

Pull Request: https://github.com/llvm/llvm-project/pull/139917
2025-05-16 12:52:27 -04:00
Rahul Joshi
7674d6fa9e [LLVM][TableGen] Simplify DagInit::get (#140056)
- Add `DagInit::get` overloads that do not need ValName to be specified.
- Fix some calls to either not create temporary arrays for DAG args or
use the std::pair<> overload.
2025-05-16 09:45:58 -07:00
peremyach
ebb15353d2 Reduce llvm-gsymutil memory usage (#139907)
For large binaries gsymutil ends up using too much memory. This diff
adds DIE tree cleanup per compile unit to reduce memory usage.

P. S. Not sure about formatting. Maybe it hasn't been run in a while, or
I have misconfigured something.

`$ git clang-format HEAD~1
clang-format did not modify any files
$ clang-format --version
clang-format version 21.0.0git
(git@github.com:peremyach/llvm-project.git
8d945c8357e1bd9872a34f92620d4916bfd27482)
`

Co-authored-by: Arslan Khabutdinov <akhabutdinov@fb.com>
2025-05-16 09:44:17 -07:00
Raphael Moreira Zinsly
52af23f950 [RISCV] Add stack probing in eliminateCallFramePseudoInstr (#139731)
Stack clash protection code was missing from
RISCVFrameLowering::eliminateCallFramePseudoInstr, calling allocateStack
fixes it.
This patch also fixes the tests in stack-probing-dynamic.ll that should
be testing the stack allocation before a function call.
2025-05-16 09:41:34 -07:00
Andres-Salamanca
ec44c74fe7 [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (#139154)
This PR adds support for the `FlattenCFG` transformation on `switch`
statements. It also introduces the `SwitchFlatOp`, which is necessary
for subsequent lowering to LLVM.
2025-05-16 09:38:56 -07:00
Craig Topper
ea4bf3456f [RISCV] Add Zilsd to RISCVMergeBaseOffset. (#140157)
I only tested a simple case for folding the addi from medany codemodel.
I assume everything else should just work.
2025-05-16 09:37:34 -07:00
Craig Topper
dcd62f3674 [SelectionDAG] Rename MemSDNode::getOriginalAlign to getBaseAlign. NFC (#139930)
This matches the underlying function in MachineMemOperand and how it is
printed when BaseAlign differs from Align.
2025-05-16 09:37:02 -07:00
Craig Topper
7f4a9105df [RISCV] Add Zilsd/Zclsd support to RISCVMakeCompressible. (#140136) 2025-05-16 09:36:39 -07:00
Aiden Grossman
23a674d2ec [libcxxabi] Update ItaniumDemangle.h from LLVM (#140273)
76ba29bfd8 landed changes in
ItaniumDemangle.h on the LLVM side that were not propagated over to the
libcxxabi side. This patch fixes that.
2025-05-16 09:26:09 -07:00
Momchil Velikov
e9c9c33fa4 [MLIR][ArmSVE] Add an ArmSVE dialect operation which maps to svusmmla (#135634) 2025-05-16 17:12:35 +01:00
James Y Knight
7fe1b43122 NFC: reformat bazel files with buildifier. 2025-05-16 12:12:03 -04:00
nd
c72c0b298c Fix race condition during iteration through modules (#139283) (#139862)
Use the locking iterator to ensure module don't change during iteration.
2025-05-16 09:09:50 -07:00
Andy Kaylor
2f5a24d0c5 [CIR][NFC] Fix warning about unhandled Decl (#140159)
This fixes a warning about an unhandled Decl that was recently
introduced. While adding the new decl, I noticed that one of the others
that was in the "NYI" group belonged in the "unreachable" group, so I
moved it also.
2025-05-16 09:08:32 -07:00
Andy Kaylor
fa2263b309 [CIR][NFC] Use arrangeFunctionDeclaration to build function types (#139787)
This change replaces the simplified call that we were previously using
to convert the function type provided by a global declaration to the CIR
function type. We now go through 'arrangeGlobalDeclaration' which builds
the function type in a more complicated manner. This change has no
observable differences for the currently upstreamed CIR support, but it
is necessary to prepare for C++ member function calls, which require the
extra handling.
2025-05-16 09:08:16 -07:00
Kazu Hirata
9adcb4fe12 [clang] Use llvm::replace (NFC) (#140264) 2025-05-16 09:06:31 -07:00
Kazu Hirata
589e7abea5 [clang-tidy] Use std::binary_search (NFC) (#140263) 2025-05-16 09:06:17 -07:00
Benjamin Kramer
82bad53bda [StaticDataLayout][PGO] Remove inclusion of private gmock header
This one is supposed to be included via gmock.h
2025-05-16 17:56:56 +02:00