527906 Commits

Author SHA1 Message Date
YongKang Zhu
19bad2ac4a
[BOLT][NFC] Fix an incorrect address used in a BOLT-INFO message (#127902) 2025-02-19 16:57:18 -08:00
Christopher Di Bella
131a3cfab4
[CIR] updates test for 75ea7aed (#127917) 2025-02-19 16:47:22 -08:00
Roland McGrath
86f0e6dc11
[libc] Add --json mode for hdrgen (#127847)
This adds a feature to hdrgen to emit JSON summaries of header
files for build system integration.  For now the summaries have
only the basic information about each header that is relevant for
build and testing purposes: the standards and includes lists.
2025-02-19 16:07:45 -08:00
Peng Liu
9107ad41bb
Apply clang-format to bitset_test_cases.h to make PR#120807 cleaner
Applying this formatting per reviewer comment on PR #120807: https://github.com/llvm/llvm-project/pull/120807/files#r1961834956
2025-02-19 18:45:52 -05:00
Jonas Devlieghere
f62f13d5db
[lldb] Store the return SBValueList in the CommandReturnObject (#127566)
There are a lot of lldb commands whose result is really one or more
ValueObjects that we then print with the ValueObjectPrinter. Now that we
have the ability to access the SBCommandReturnObject through a callback
(#125006), we can store the resultant ValueObjects in the return object,
allowing an IDE to access the SBValues and do its own rich formatting.

rdar://143965453
2025-02-19 15:17:35 -08:00
Craig Topper
b0e24d17f2
[RISCV] Use opaque pointers in some tests. NFC (#127906) 2025-02-19 15:16:09 -08:00
youngd007
5622f2232b
Add back deleted test for llvm-dwarfdump JSON output (#127685)
Looks like https://github.com/llvm/llvm-project/pull/124936 was reverted
(for modifying JSON output), but the test for JSON output with errors
was deleted in https://github.com/llvm/llvm-project/pull/126587 (to
attempt to fix failing build)
This will add back a test and a new one for llvm-dwarfdump to validate
the JSON for errors. One case where the sub-categories will eventually
appear and another where not.

test plan:
ninja check-llvm-tools-llvm-dwarfdump
2025-02-19 14:47:19 -08:00
Joseph Huber
6cc7ca084a
[Clang] Fix cross-lane scan when given divergent lanes (#127703)
Summary:
The scan operation implemented here only works if there are contiguous
ones in the executation mask that can be used to propagate the result.
There are two solutions to this, one is to enter 'whole-wave-mode' and
forcibly turn them back on, or to do this serially. This implementation
does the latter because it's more portable, but checks to see if the
parallel fast-path is applicable.

Needs to be backported for correct behavior and because it fixes a
failing libc test.
2025-02-19 16:46:59 -06:00
Sebastian Jodłowski
0127f169dc
[CUDA] Add support for sm101 and sm120 target architectures (#127187)
Add support for sm101 and sm120 target architectures. It requires CUDA
12.8.

---------

Co-authored-by: Sebastian Jodlowski <sjodlowski@nuro.ai>
2025-02-19 14:41:07 -08:00
Kazu Hirata
6342095bce [memprof] Fix a warning
This patch fixes:

  llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:3409:8:
  error: unused variable 'I' [-Werror,-Wunused-variable]
2025-02-19 14:28:13 -08:00
Zaky Hermawan
ef49760fa9
[libc][POSIX][unistd] implement getsid (#127341)
Fixes https://github.com/llvm/llvm-project/issues/126603

---------

Signed-off-by: ZakyHermawan <zaky.hermawan9615@gmail.com>
2025-02-19 14:26:18 -08:00
David Tellenbach
0fe0968c93
[AArch64][FEAT_CMPBR] Codegen for Armv9.6-a compare-and-branch (#116465)
This patch adds codegen for all Arm9.6-a compare-and-branch
instructions, that operate on full w or x registers. The instruction
variants operating on half-words (cbh) and bytes (cbb) are added in a
subsequent patch.

Since CB doesn't use standard 4-bit Arm condition codes but a reduced
set of conditions, encoded in 3 bits, some conditions are expressed by
modifying operands, namely incrementing or decrementing immediate
operands and swapping register operands. To invert a CB instruction it's
therefore not enough to just modify the condition code which doesn't
play particularly well with how the backend is currently organized. We
therefore introduce a number of pseudos which operate on the standard
4-bit condition codes and lower them late during codegen.
2025-02-19 13:58:20 -08:00
Baranov Victor
8363b0a6ba
[clang-tidy] add AllowedTypes option to misc-const-correctness (#122951)
Add option `AllowedTypes` which allow users to specify types they want
to exclude from const-correctness check.

Small real-world example:
```cpp
#include <mutex>

int main() {
  std::mutex m;
  std::lock_guard<std::mutex> l(m); // we want to ignore it since std::lock_guard is already immutable.
}
```

Closes issue https://github.com/llvm/llvm-project/issues/122592
2025-02-20 05:47:17 +08:00
Ryosuke Niwa
5f8b256821
Check the type of Objective-C++ instance variables in WebKit member variable checkers. (#127570)
Like a C++ member variable, every Objective-C++ instance variable must
be a RefPtr, Ref CheckedPtr, or CheckedRef to an object, not a raw
pointer or reference.
2025-02-19 13:24:12 -08:00
vporpo
c0c42c8b32
[SandboxIR][NFC] Change order of ifs in Context::getOrCreateValueInternal() (#127891)
Move the most common if statement to the top and the least common ones
to the bottom. This should save CPU cycles during compilation.

This patch also prefixes the llvm variables with the LLVM prefix to make
the naming convention in this function more uniform. For example `C` to
`LLVMC`.
2025-02-19 13:08:43 -08:00
Andreas Jonson
3836559e65 [InstCombine] Test for regession with trunc in foldSelectICmpAnd 2025-02-19 21:45:41 +01:00
Teresa Johnson
92b07520bc
[MemProf] Support cloning through recursive cycles (#127429)
In order to facilitate cloning of recursive cycles, we first identify
backedges using a standard DFS search from the root callers, then
initially defer recursively invoking the cloning function via those
edges. This is because the cloning opportunity along the backedge may
not be exposed until the current node is cloned for other non-backedge
callers that are cold after the earlier recursive cloning, resulting
in a cold predecessor of the backedge. So we recursively invoke the
cloning function for the backedges during the cloning of the current
node for its caller edges (which were sorted to enable handling cold
callers first).

There was no significant time or memory overhead measured for several
large applications.
2025-02-19 12:44:33 -08:00
Kunwar Grover
1a6ed4d06e
[mlir][Vector] Deprecate vector.extractelement/vector.insertelement (#113829)
See
https://discourse.llvm.org/t/rfc-psa-remove-vector-extractelement-and-vector-insertelement-ops-in-favor-of-vector-extract-and-vector-insert-ops/71116/6
for more information.
2025-02-20 02:12:06 +05:30
Craig Topper
1761066fc6
[GlobalOpt] Remove Function* argument from tryWidenGlobalArrayAndDests. NFC (#127848)
This is only used to get the Module and the LLVMContext. We can get both
of those from the GlobalVariable*.
2025-02-19 12:37:54 -08:00
Björn Pettersson
c833746c6c
[DSE] Make iter order deterministic in removePartiallyOverlappedStores. NFC (#127678)
In removePartiallyOverlappedStores we iterate over
InstOverlapIntervalsTy which is a DenseMap. Change that map into using
MapVector to ensure that we apply the transforms in a deterministic
order. I've only seen that the order matters if starting to use names
for the instructions created when doing the transforms. But such things
are a bit annoying when debugging etc.
2025-02-19 21:24:49 +01:00
LLVM GN Syncbot
84eacd302e [gn build] Port 26e375046dbd 2025-02-19 20:12:30 +00:00
Craig Topper
26e375046d Recommit "[RISCV] Add a pass to remove ADDI by reassociating to fold into load/store address. (#127151)"
Tests have been re-generated with recent scheduler changes.

Original message:

SelectionDAG will not reassociate adds to the end of a chain if
there are multiple users of later additions. This prevents isel
from folding the immediate into a load/store address.

One easy way to see this is accessing an array in a struct with
two different indices. An ADDI will be used to get to the start
of the array then 2 different SHXADD instructions will be used to
add the scaled indices. Finally the SHXADD will be used by different
load instructions. We can remove the ADDI by folding the offset into
each load.

This patch adds a new pass that analyzes how an ADDI constant
propagates through address arithmetic. If the arithmetic is only
used by a load/store and the offset is small enough, we can adjust
the load/store offset and remove the ADDI.

This pass is placed before MachineCSE to allow cleanups if some
instructions become common after removing offsets from their inputs.

This pass gives ~3% improvement on dynamic instruction count on
541.leela_r and 544.nab_r from SPEC2017 for the train data set. There's
a ~1% improvement on 557.xz_r.
2025-02-19 12:11:00 -08:00
Kunwar Grover
c9ff839964
[mlir][Linalg] Fix linalg.generic iteration domain collapse for dynamic dims (#118208)
This pr fixes how iteration domain of linalg.generic is collapsed when
fusing with tensor.expand_shape. Previously, the output_shape for
tensor.expand shape was infered, which doesn't always work except some
special cases.

This patch makes the logic explicitly set the bounds of the new
collapsed iteration domain, because we already know them.

---------

Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com>
2025-02-20 01:32:44 +05:30
Craig Topper
37d0f20593 Revert "[RISCV] Add a pass to remove ADDI by reassociating to fold into load/store address. (#127151)"
This reverts commit c3ebbfd7368ec3e4737427eef602296a868a4ecd.

Seeing some test failures on the build bot.
2025-02-19 11:57:53 -08:00
vporpo
1987f93d03
[SandboxIR] OpaqueValue (#127699)
This patch implements a new subclass of the Value class used for Sandbox
IR Values that we don't support, like metadata or inline asm. The goal
is to never have null sandboxir::Value objects, because this is not the
expected behavior.
2025-02-19 11:54:44 -08:00
Benoit Jacob
4a411eb4ee
[MLIR] Fix rewrite of ops with vector operands to LLVM on GPU (#127844)
There was a discrepancy between the type-converter and rewrite-pattern
parts of conversion to LLVM used in various GPU targets, at least ROCDL
and NVVM:
- The TypeConverter part was handling vectors of arbitrary rank,
converting them to nests of `!llvm.array< ... >` with a vector at the
inner-most dimension:
8337d01e30/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp (L629-L655)
- The rewrite pattern part was not handling `llvm.array`:
8337d01e30/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp (L594-L596)

That led to conversion failures when lowering `math` dialect ops on
rank-2 vectors, as in the testcase being added in this PR.

This PR fixes this by reusing a shared utility already used in other
conversions to LLVM:

8337d01e30/mlir/lib/Conversion/LLVMCommon/VectorPattern.cpp (L80-L104)

---------

Signed-off-by: Benoit Jacob <jacob.benoit.1@gmail.com>
2025-02-19 14:52:02 -05:00
Petr Hosek
dca7306365
[clang][perf-training] Support excluding LLVM build from PGO training (#126876)
Using LLVM build itself for PGO training is convenient and a great
starting point but it also has several issues:

* LLVM build implicitly depends on tools other than CMake and C/C++
compiler and if those tools aren't available in PATH, the build will
fail.
* LLVM build also requires standard headers and libraries which may not
always be available in the default location requiring an explicit
sysroot.
* Building a single configuration (-DCMAKE_BUILD_TYPE=Release) only
exercises the -O3 pipeline and can pesimize other configurations.
* Building for the host target doesn't exercise all other targets.
* Since LLVMSupport is a static library, this doesn't exercise the
linker (beyond what the CMake itself does).

Rather than using LLVM build, ideally we would provide a more minimal,
purpose built corpus. While we're working on building such a corpus,
provide a CMake option that lets vendors disable the use LLVM build for
PGO training.
2025-02-19 11:36:09 -08:00
Jonathan Peyton
851177c2e3
[OpenMP][NFC] Remove unused __kmp_dispatch_lock global (#127686) 2025-02-19 13:32:00 -06:00
Jonathan Peyton
b1f882f86a
[OpenMP][NFC] Remove unused clock function types and globals (#127684) 2025-02-19 13:31:40 -06:00
Craig Topper
c3ebbfd736
[RISCV] Add a pass to remove ADDI by reassociating to fold into load/store address. (#127151)
SelectionDAG will not reassociate adds to the end of a chain if
there are multiple users of later additions. This prevents isel
from folding the immediate into a load/store address.
    
One easy way to see this is accessing an array in a struct with
two different indices. An ADDI will be used to get to the start
of the array then 2 different SHXADD instructions will be used to
add the scaled indices. Finally the SHXADD will be used by different
load instructions. We can remove the ADDI by folding the offset into
each load.
    
This patch adds a new pass that analyzes how an ADDI constant
propagates through address arithmetic. If the arithmetic is only
used by a load/store and the offset is small enough, we can adjust
the load/store offset and remove the ADDI.
    
This pass is placed before MachineCSE to allow cleanups if some
instructions become common after removing offsets from their inputs.

This pass gives ~3% improvement on dynamic instruction count on
541.leela_r and 544.nab_r from SPEC2017 for the train data set. There's
a ~1% improvement on 557.xz_r.
2025-02-19 11:30:55 -08:00
Letu Ren
5caefe261f
[MLIR][LLVMIR] Add support for asin acos atan intrinsics op (#127317)
This is similar to https://github.com/llvm/llvm-project/pull/125748
2025-02-19 11:27:28 -08:00
Deric Cheung
1c762c288f
[HLSL] Implement the 'and' HLSL function (#127098)
Addresses #125604 

- Implements `and` as an HLSL builtin function
- The `and` HLSL builtin function gets lowered to the the LLVM `and`
instruction
2025-02-19 11:22:46 -08:00
Qiongsi Wu
85e23fe9c7
[Modules] Add clang/Lex/HLSLRootSignatureTokenKinds.def to clang's modulemap (#127839)
b41b86a907f653f79bab10d4c80b3a41d146c71b added a new textual header
`clang/Lex/HLSLRootSignatureTokenKinds.def` but did not add it to
`clang`'s module map. This causes build failure when building llvm with
`-DLLVM_ENABLE_MODULES=ON`. This PR adds the new textual header to the
module map and fixes the build break.

Fixing rdar://145148093.
2025-02-19 11:21:04 -08:00
Changpeng Fang
36eaf0daf5
AMDGPU: Don't canonicalize fminnum/fmaxnum if targets support IEEE fminimum(maximum)_num (#127711)
For targets that support IEEE fminimum_num/fmaximum_num, the
corresponding *_min_num_fXY/*_max_num_fXY instructions themselves
already did the canonicalization for the inputs. As a result, we do not
need to explicitly canonicalize the inputs for fminnum/fmaxnum.
2025-02-19 11:16:43 -08:00
Mehdi Amini
8337d01e30 [MLIR] Fix doc build (NFC) 2025-02-19 19:28:09 +01:00
David Goldman
1841bcd5d1
[clangd] Update XRefs to support overridden ObjC methods (#127109)
- Support finding implementors of a protocol and discovering subclasses for ObjC interfaces via the implementations call
- Support jumping to the overridden method when you trigger goto definition on an override
- Properly find references to overridden methods
2025-02-19 13:21:41 -05:00
Jerry-Ge
d57479cfbe
[mlir][tosa] Update SelectOp's input names to match TOSA specification (#127833)
Updated:
- pred to input1
- on_true to input2
- on_false to input3

Signed-off-by: Jerry Ge <jerry.ge@arm.com>
2025-02-19 10:19:57 -08:00
Craig Topper
a6f48ed012
[MC] Remove MCRegister::isStackSlot. (#127755)
Stack slots should only be stored in Register. The only caller was
Register::isStackSlot so just inline it there.
2025-02-19 10:19:40 -08:00
Craig Topper
2bf473bd54
[GlobalOpt] Don't query TTI on a llvm.memcpy declaration. (#127760)
Querying TTI creates a Subtarget object, but an llvm.memcpy declaration
doesn't have target-cpu and target-feature attributes like functions
with definitions. This can cause a warning to be printed on RISC-V
because the target-abi in the Module requires floating point, but the
subtarget features don't enable floating point. So far we've only seen
this in LTO when an -mcpu is not supplied for the TargetMachine.

To fix this, get TTI for the calling function instead.

Fixes the issue reported here
https://github.com/llvm/llvm-project/issues/69780#issuecomment-2665273161
2025-02-19 10:17:07 -08:00
foxtran
9ebb618d03
[Clang] [Sema] Combine fallout warnings to just one warning (#127546)
This merges several falloff and noreturn-related warnings and
removes unused diagnostic arguments.

Changes:
- `warn_maybe_falloff_nonvoid_function` and
`warn_falloff_nonvoid_function`, `warn_maybe_falloff_nonvoid_coroutine`
and `warn_falloff_nonvoid_coroutine`,
`warn_maybe_falloff_nonvoid_lambda` and `warn_falloff_nonvoid_lambda`
were combined into `warn_falloff_nonvoid`,

- `err_maybe_falloff_nonvoid_block` and `err_falloff_nonvoid_block` were
combined into `err_falloff_nonvoid`

- `err_noreturn_block_has_return_expr` and
`err_noreturn_lambda_has_return_expr` were merged into
`err_noreturn_has_return_expr` with the same semantics as
`warn_falloff_nonvoid` or `err_falloff_nonvoid`.

- Removed some diagnostic args that weren’t being used by the diagnostics.
2025-02-19 19:05:44 +01:00
Georgios Pinitas
1d829f6a0b
[mlir][tosa] Align check variables naming to use capitals (#127830)
Move in using capital letters for variable capture in LIT

Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
2025-02-19 18:00:44 +00:00
Nathan Ridge
ccd3defd8f
[clangd] Avoid round-trip from SourceLocation to clangd::Range and back in SymbolCollector::handleMacros() (#127757) 2025-02-19 12:57:38 -05:00
Simon Pilgrim
d1889cf935
[X86] combineX86ShuffleChain - provide list of combined shuffle nodes, replace HasVariableMask bool arg. NFC. (#127826)
Minor NFC refactor before making better variable mask combining decisions - isTargetShuffleVariableMask doesn't discriminate between fast (AND, PSHUFB etc.) and slow (VPERMV3 etc.) variable shuffles, so an opaque HasVariableMask is only of limited use.
2025-02-19 17:56:46 +00:00
Florian Hahn
a96444af44 [VPlan] Remove dead exit block handling code in HCFGBuilder.
The mapping of IR ExitBB to a VPBB isn't used. It also sets an incorrect
VPBB for the ExitBB; the regions successor is the middle block, no the
exit block.

It also unnecessarily triggers an assertion after 38376dee922.
2025-02-19 18:51:45 +01:00
Gábor Horváth
5450954a06
Include test folder in the Clang Static Analyzer team mentions (#127810)
See
https://discourse.llvm.org/t/taking-ownership-of-clang-test-analysis/84689
2025-02-19 17:45:05 +00:00
Peng Liu
ad87d5f23d
[libc++][test] Refactor tests for std::{copy, move, fill} algorithms (#120909)
This refactor includes the following changes:
- Refactor similar tests using `types::for_each` to remove redundant code;
- Explicitly include the missing header `type_algorithms.h` in some test files;
- Some tests scattered in different test functions with ad-hoc names
  (e.g., `test5()`, `test6()`) but belong to the same kind are now grouped
  into one function (`test_struct_array()`).
2025-02-19 12:44:44 -05:00
Alexey Bataev
3e8db13ced [SLP][NFC]Replace undefs by zeroinitializer 2025-02-19 09:43:26 -08:00
Fangrui Song
e1d1bb93d2 [ELF,test] Clean up aarch64-relocs.s 2025-02-19 09:38:48 -08:00
Andreas Jonson
aa847ced07
[InstCombine] handle trunc to i1 in foldSelectICmpAndBinOp (#127390)
for `trunc nuw` saves a instruction and otherwise only other
instructions without the select, same behavior as for bit test before.

proof: https://alive2.llvm.org/ce/z/a6QmyV
2025-02-19 18:29:47 +01:00
Akash Banerjee
8ecd788324 Remove header file spuriously added by 9905728e2fb4ebe9b7518dfd73a0574eea0a2083. 2025-02-19 17:27:48 +00:00