529975 Commits

Author SHA1 Message Date
Andrei Safronov
69527b0013
[Xtensa] Implement Xtensa MAC16 Option. (#130004) 2025-03-10 03:26:33 +03:00
Oleksandr T.
bfdeb58730
[Clang] use constant evaluation context for constexpr if conditions (#123667)
Fixes #123524

---

This PR addresses the issue of immediate function expressions not
properly evaluated in `constexpr` if conditions. Adding the
`ConstantEvaluated` context for expressions in `constexpr` if statements
ensures that these expressions are treated as manifestly
constant-evaluated and parsed correctly.
2025-03-10 01:53:20 +02:00
Ryosuke Niwa
5c3b05996f
[alpha.webkit.UnretainedLambdaCapturesChecker] Add a WebKit checker for lambda capturing NS or CF types. (#128651)
Add a new WebKit checker for checking that lambda captures of CF types
use RetainPtr either when ARC is disabled or enabled, and those of NS
types use RetainPtr when ARC is disabled.
2025-03-09 14:59:46 -07:00
LLVM GN Syncbot
2e7a509237 [gn build] Port e85e29c2992b 2025-03-09 21:10:04 +00:00
Jakub Kuderski
9764659fb4
[ADT] Use adl_being/end in hasSingleElement (#130506)
This is to make sure that ADT helpers consistently use argument
dependent lookup when dealing with input ranges.

This was a part of #87936 but reverted due to buildbot failures. Now
that I have a threadripper system, I'm landing this piece-by-piece.
2025-03-09 17:08:08 -04:00
Chris B
e85e29c299
[HLSL] select scalar overloads for vector conditions (#129396)
This PR adds scalar/vector overloads for vector conditions to the
`select` builtin, and updates the sema checking and codegen to allow
scalars to extend to vectors.

Fixes #126570
2025-03-09 16:01:12 -05:00
Craig Topper
74ca5799ca [X86] Use Register in FastISel. NFC
Replace 'Reg == 0' with '!Reg'
2025-03-09 12:06:47 -07:00
Adrian Prantl
2317a72489 [lldb] Add missing converstion to optional 2025-03-09 12:04:22 -07:00
Craig Topper
bd64f313a5 Recommit "[ARM] Change FastISel Address from a struct to a class. NFC"
With clang-format this time.

Original message:
This allows us to use Register in the interface, but store an
unsigned internally in a union.
2025-03-09 11:38:56 -07:00
Craig Topper
bc02802675 Revert "[ARM] Change FastISel Address from a struct to a class. NFC"
This reverts commit d47bc6fd93f9f439a54fd7cf55cdcb2e2ca0cfcb.

I forgot to commit clang-format cleanup before I pushed this.
2025-03-09 11:37:47 -07:00
Artem Pianykh
29129be632
[NFC][Cloning] Add a helper to collect debug info from instructions (#129145)
Summary:
Just moving around. This helper will be used for further refactoring.

Test Plan:
ninja check-llvm-unit check-llvm
2025-03-09 18:35:42 +00:00
Florian Hahn
437d587e48
[LV] Add outer loop test with different successor orders in inner latch. 2025-03-09 18:13:06 +00:00
David Green
e44e24dfe6
[AArch64] Improve vector funnel shift by constant costs. (#130044)
We now have better codegen, and can have better costs to match. The
generated code should now produce a shl+usra and can be seen in
testcases such as:
7e5821bae8/llvm/test/CodeGen/AArch64/fsh.ll (L3941).
2025-03-09 18:01:45 +00:00
Mariusz Borsa
62a6d63d63
[Sanitizers][Darwin] Correct iterating of MachO load commands (#130161)
The condition to stop iterating so far was to look for load command cmd
field == 0. The iteration would continue past the commands area, and
would finally find lc->cmd ==0, if lucky. Or crash with bus error, if
out of luck.

Correcting this by limiting the number of iterations to the count
specified in mach_header(_64) ncmds field.

rdar://143903403

---------

Co-authored-by: Mariusz Borsa <m_borsa@apple.com>
2025-03-09 10:58:46 -07:00
Artem Pianykh
df570dadcb
[NFC][Cloning] Simplify the flow in FindDebugInfoToIdentityMap (#129144)
Summary:
The new flow should make it more clear what is happening in cases of
Different of Cloned modules.

Test Plan:
ninja check-llvm-unit check-llvm
2025-03-09 17:49:24 +00:00
Chris B
a7d5b3f711
[HLSL] Disallow virtual inheritance and functions (#127346)
This PR disallows virtual inheritance and virtual functions in HLSL.
2025-03-09 12:18:44 -05:00
Mark de Wever
b6bb9dc5ab
[libc++][CI] Update action runner base image. (#130433)
Updates to the latest release. The side effect of this change is
updating all compilers to the latest upstream version.
2025-03-09 17:36:10 +01:00
Mark de Wever
fd973d2512
[libc++] Protect more code against -Wdeprecated. (#130419)
This seems needed when updating the CI Docker image.
2025-03-09 17:33:59 +01:00
Artem Pianykh
7c4ef498e1
[NFC][Cloning] Make ClonedModule case more obvious in CollectDebugInfoForCloning (#129143)
Summary:
The code's behavior is unchanged, but it's more obvious right now.

Test Plan:
ninja check-llvm-unit check-llvm
2025-03-09 15:49:04 +00:00
LLVM GN Syncbot
3a727549ef [gn build] Port fd267082ee6d 2025-03-09 15:06:16 +00:00
Florian Hahn
fd267082ee
[VPlan] Refactor VPlan creation, add transform introducing region (NFC). (#128419)
Create an empty VPlan first, then let the HCFG builder create a plain
CFG for the top-level loop (w/o a top-level region). The top-level
region is introduced by a separate VPlan-transform. This is instead of
creating the vector loop region before building the VPlan CFG for the
input loop.

This simplifies the HCFG builder (which should probably be renamed) and
moves along the roadmap ('buildLoop') outlined in [1].

As follow-up, I plan to also preserve the exit branches in the initial
VPlan out of the CFG builder, including connections to the exit blocks.

The conversion from plain CFG with potentially multiple exits to a
single entry/exit region will be done as VPlan transform in a follow-up.

This is needed to enable VPlan-based predication. Currently early exit
support relies on building the block-in masks on the original CFG,
because exiting branches and conditions aren't preserved in the VPlan.
So in order to switch to VPlan-based predication, we will have to
preserve them in the initial plain CFG, so the exit conditions are
available explicitly when we convert to single entry/exit regions.

Another follow-up is updating the outer loop handling to also introduce
VPRegionBlocks for nested loops as transform. Currently the existing
logic in the builder will take care of creating VPRegionBlocks for
nested loops, but not the top-level loop.

[1]
https://llvm.org/devmtg/2023-10/slides/techtalks/Hahn-VPlan-StatusUpdateAndRoadmap.pdf

PR: https://github.com/llvm/llvm-project/pull/128419
2025-03-09 15:05:35 +00:00
Nico Weber
f3dd9c99d1 Revert "[lld][LoongArch] Relax call36/tail36: R_LARCH_CALL36 (#123576)"
This reverts commit 6fbe491e1776f6598790a844bf4e743de956b42d.
Broke check-lld, see the many bot comments on
https://github.com/llvm/llvm-project/pull/123576
2025-03-09 10:19:16 -04:00
Yingwei Zheng
029e10289a
[ValueTracking] Bail out on x86_fp80 when computing fpclass with knownbits (#130477)
In https://github.com/llvm/llvm-project/pull/97762, we assume the
minimum possible value of X is NaN implies X is NaN. But it doesn't hold
for x86_fp80 format. If the knownbits of X are
`?'011111111111110'????????????????????????????????????????????????????????????????`,
the minimum possible value of X is NaN/unnormal. However, it can be a
normal value.

Closes https://github.com/llvm/llvm-project/issues/130408.
2025-03-09 21:10:35 +08:00
Phoebe Wang
107aa6a3d3
[X86] Combine bitcast(v1Ty insert_vector_elt(X, Y, 0)) to Y (#130475)
Though it only happens in v1i1 when we generate llvm.masked.load/store
intrinsics for APX cload/cstore.

https://godbolt.org/z/vjsrofsqx
2025-03-09 20:10:08 +08:00
Andrewyuan34
2a3e782f40
[clang-tidy] Fix invalid fixit from modernize-use-ranges for nullptr used with std::unique_ptr (#127162)
This PR fixes issue #124815 by correcting the handling of `nullptr` with
`std::unique_ptr` in the `modernize-use-ranges` check.

Updated the logic to suppress warnings for `nullptr` in `std::find`.
2025-03-09 20:09:59 +08:00
Simon Pilgrim
22a45c43db [X86] combineConcatVectorOps - use all_of to check for matching PSHUFD/PSHUFLW/PSHUFHW shuffle mask.
Prep work before adding 512-bit support.
2025-03-09 12:04:39 +00:00
Timm Baeder
0f732481ac
[clang][bytecode] Fix getting pointer element type in __builtin_memcmp (#130485)
When such a pointer is heap allocated, the type we get is a pointer
type. Take the pointee type in that case.
2025-03-09 12:57:42 +01:00
Simon Pilgrim
d84dc8ff93
[InstCombine] Add handling for (or (zext x), (shl (zext (ashr x, bw/2-1))), bw/2) -> (sext x) fold (#130316)
Minor tweak to #129363 which handled all the cases where there was a sext for the original source value, but not for cases where the source is already half the size of the destination type

Another regression noticed in #76524
2025-03-09 10:34:30 +00:00
Zhaoxin Yang
6fbe491e17
[lld][LoongArch] Relax call36/tail36: R_LARCH_CALL36 (#123576)
Instructions with relocation `R_LARCH_CALL36` may be relax as follows:
```
From:
   pcaddu18i $dest, %call36(foo)
     R_LARCH_CALL36, R_LARCH_RELAX
   jirl $r, $dest, 0
To:
   b/bl foo  # bl if r=$ra, b if r=$zero
     R_LARCH_B26
```
2025-03-09 17:21:27 +08:00
Kazu Hirata
99d2b3b0aa
[llvm-profgen] Avoid repeated hash lookups (NFC) (#130466) 2025-03-09 00:49:37 -08:00
Kazu Hirata
573df34ea0
[llvm-jitlink] Avoid repeated hash lookups (NFC) (#130465) 2025-03-09 00:49:13 -08:00
Kazu Hirata
cf3aa06c16
[Utils] Avoid repeated hash lookups (NFC) (#130464) 2025-03-09 00:48:37 -08:00
Kazu Hirata
7c7cebf49d
[Scalar] Avoid repeated hash lookups (NFC) (#130463) 2025-03-09 00:48:17 -08:00
Kazu Hirata
7cd3047252
[IPO] Avoid repeated hash lookups (NFC) (#130462) 2025-03-09 00:47:57 -08:00
Kazu Hirata
2d1634fab7
[ExecutionEngine] Avoid repeated map lookups (NFC) (#130461) 2025-03-09 00:47:42 -08:00
Ben Shi
2172a5edcf
[clang][analyzer][NFC] Fix typos in comments (#130456) 2025-03-09 08:23:51 +01:00
Craig Topper
d47bc6fd93 [ARM] Change FastISel Address from a struct to a class. NFC
This allows us to use Register in the interface, but store an
unsigned internally in a union.
2025-03-08 22:53:07 -08:00
Craig Topper
0f646fc848 [AArch64] Remove unused DenseMap variable. NFC 2025-03-08 22:10:07 -08:00
Craig Topper
ae1479c79e [ARM] Remove unused argument. NFC 2025-03-08 22:08:54 -08:00
Craig Topper
275d7175ac [ARM] Use Register in FastISel. NFC 2025-03-08 21:58:35 -08:00
Timm Baeder
227f9544a4
[clang][bytecode][NFC] Bail out on non constant evaluated builtins (#130431)
If the ASTContext says so, don't bother trying to constant evaluate the
given builtin.
2025-03-09 06:35:19 +01:00
Ishaan Verma
735afc8ceb
[libc] Added type-generic macros for fixed-point functions (#129371)
Adds macros `absfx`, `countlsfx` and `roundfx` .
ref:  #129111
2025-03-09 00:11:34 -05:00
Thurston Dang
667bbd2ecc
[msan] Apply handleVectorReduceIntrinsic to max/min vector instructions (#129819)
Changes the handling of:
- llvm.aarch64.neon.smaxv
- llvm.aarch64.neon.sminv
- llvm.aarch64.neon.umaxv
- llvm.aarch64.neon.uminv
- llvm.vector.reduce.smax
- llvm.vector.reduce.smin
- llvm.vector.reduce.umax
- llvm.vector.reduce.umin
- llvm.vector.reduce.fmax
- llvm.vector.reduce.fmin
from the default strict handling (visitInstruction) to
handleVectorReduceIntrinsic.

Also adds a parameter to handleVectorReduceIntrinsic to specify whether
the return type must match the elements of the vector.

Updates the tests from https://github.com/llvm/llvm-project/pull/129741,
https://github.com/llvm/llvm-project/pull/129810,
https://github.com/llvm/llvm-project/pull/129768
2025-03-08 19:31:48 -08:00
A. Jiang
9e87caff98
[libc++][NFC] Comment cleanup for <type_traits> (#130422)
- Aligns all version comments to line 65.
- Consistently uses `// since C++` instead of `// C++`, in lowercase as
used in most version comments.
- Consistently uses `class` to introduce type template parameters.
- Consistently uses `inline constexpr` for variable templates.
- Corrects the comment for `bool_constant` to `// since C++17` as it's a
C++17 feature.
- Changes the class-key of `result_of` to `struct`, which follows N4659
[depr.meta.types] and the actual usage in libc++.
- Adds missed `// since C++17` for `is_(nothrow_)invocable(_r)`.
- Moves the comments for `is_nothrow_convertible_v` to the part for
variable templates.
- Removes duplicated comments for `true_type` and `false_type`.
2025-03-09 11:17:24 +08:00
Vitaly Buka
58ace30ebc
[NFC][YAML] Replace iterators with simple getter (#130449)
To simplify #130382.
2025-03-08 19:16:23 -08:00
Thurston Dang
3a0c33afd1
[msan] Handle Arm NEON pairwise min/max instructions (#129824)
Change the handling of:
- llvm.aarch64.neon.fmaxp
- llvm.aarch64.neon.fminp
- llvm.aarch64.neon.fmaxnmp
- llvm.aarch64.neon.fminnmp
- llvm.aarch64.neon.smaxp
- llvm.aarch64.neon.sminp
- llvm.aarch64.neon.umaxp
- llvm.aarch64.neon.uminp
from the incorrect heuristic handler (maybeHandleSimpleNomemIntrinsic)
to handlePairwiseShadowOrIntrinsic.

Updates the tests from https://github.com/llvm/llvm-project/pull/129760

Adds a note that maybeHandleSimpleNomemIntrinsic may incorrectly match
horizontal/pairwise intrinsics.
2025-03-08 19:08:08 -08:00
Vitaly Buka
0715c6cc6d
[NFC][IR] De-duplicate CFI related code (#130450) 2025-03-08 18:02:30 -08:00
Craig Topper
1649ca5af0 [AArch64] Use Register in AArch64FastISel.cpp. NFC 2025-03-08 17:24:51 -08:00
Khalil Estell
85d60a441a
[clangd] Add BuiltinHeaders config option (#129459)
This option, under `CompileFlags`, governs whether clangd uses its own
built-in headers (`Clangd` option value) or the built-in headers of the driver
in the file's compile command (`QueryDriver` option value, applicable to
cases where `--query-driver` is used to instruct clangd to ask the driver
for its system include paths).

The default value is `Clangd`, preserving clangd's current defaut behaviour.

Fixes clangd/clangd#2074
2025-03-08 19:16:37 -05:00
LLVM GN Syncbot
a892a5dc5e [gn build] Port 1d763f383380 2025-03-09 00:08:36 +00:00