540077 Commits

Author SHA1 Message Date
Christian Ulmann
052d5889f8
[Support] Properly zero initialize CPU set when querying affinity (#142924)
This commit resolves a potential issue of working with uninitialized
memory when querying the CPU's affinity. The man page of
`sched_getaffinity` does not guarantee that the memory will be fully
overwritten, so this change should ensure that issues are avoided.
2025-06-06 11:24:46 +02:00
Nikita Popov
7d4464599f [GVN] Add test with different captures attributes (NFC) 2025-06-06 11:24:24 +02:00
Simon Pilgrim
f59742c1ea
[X86] getIntImmCostInst - recognise i64 ICMP EQ/NE special cases (#142812)
If the lower 32-bits of a i64 value are known to be zero, then icmp
lowering will shift+truncate down to a i32 allowing the immediate to be
embedded.

There's a lot more that could be done here to match icmp lowering, but
this PR just focuses on known regressions.

Fixes #142513
Fixes #62145
2025-06-06 10:21:40 +01:00
Zokre Zyl
e7cd6b48c0
[libclang/python] Add TypeKind.FLOAT16 (#142634)
Adds FLOAT16 enum for value 32

Fixes #142633
2025-06-06 11:14:57 +02:00
Nikita Popov
e66c205bda [AA] Add additional tests for mixed of different captures (NFC) 2025-06-06 11:04:09 +02:00
Jay Foad
5f33b9d286
[MIRParser] Report register class errors in a deterministic order (#142928) 2025-06-06 10:03:34 +01:00
Momchil Velikov
44a047c929
[MLIR][ArmSVE] Add initial lowering of vector.contract to SVE *MMLA instructions (#135636) 2025-06-06 09:54:23 +01:00
Michele Scuttari
f849866fc5
[MLIR] Reduce complexity of searching circular function calls in bufferization (#142099)
The current algorithm searching for circular function calls scales quadratically due to the linear scan of the functions vector that is performed for each element of the vector itself. The PR replaces such algorithm with an O(V + E) version based on the Khan's algorithm for topological sorting, where V is the number of functions and E is the number of function calls.
2025-06-06 10:35:58 +02:00
Guy David
4d4b7cc69e
[AArch64] Skip storing of stack arguments when lowering tail calls (#126735)
This issue starts in the selection DAG and causes the backend to emit
the following for a trivial tail call:
```
ldr w8, [sp]
str w8, [sp]
b func
```

I'm not too sure that checking for immutability of a specific stack
object is a good enough of a gurantee, because as soon a tail-call is
done lowering,`setHasTailCall()` is called and in that case perhaps a
pass is allowed to change the value of the object in-memory?

This can be extended to the ARM backend as well.
Removed the `tailcall` keyword from a few other test assets, I'm
assuming their original intent was left intact.
2025-06-06 11:26:24 +03:00
hev
182c1c268f
[LoongArch][NFC] Pre-commit for converting vector mask to vXi1 using [X]VMSKLTZ (#142977) 2025-06-06 16:26:17 +08:00
Konrad Kleine
6918314918
[lit] show retry attempts (#142413)
If a test took more than one attempt to complete, show the number of attempts and the maximum allowed attempts as `2 of 4 attempts` inside the `<progress info>` (see [TEST RUN OUTPUT FORMAT](https://llvm.org/docs/CommandGuide/lit.html#test-run-output-format)).

NOTE: Additionally this is a fixup for #141851 where the tests were not quite right. `max-retries-per-test/allow-retries-test_retry_attempts/test.py` was added but never used there. Now we're calling it. To correlate better between the test output and the test script I've used higher numbers of max allowed retries.
2025-06-06 10:24:26 +02:00
hev
470f456567
[LoongArch] Add codegen support for atomic-ops on LA32 (#141557)
This patch adds codegen support for atomic operations `cmpxchg`, `max`,
`min`, `umax` and `umin` on the LA32 target.
2025-06-06 16:00:59 +08:00
Henrich Lauko
f10c7d9f5a
[CIR][NFC] Use getType() instead of more verbose getResult().getType() (#143024)
This mirrors incubator changes from https://github.com/llvm/clangir/pull/1662
2025-06-06 09:58:13 +02:00
jeanPerier
6a41f53c39
[flang][hlfir] do not propagate polymorphic temporary as allocatables (#142609)
Polymorphic temporary are currently propagated as
fir.ref<fir.class<fir.heap<>>> because their allocation may be delayed
to the hlfir.assign copy (using realloc).

This patch moves away from this and directly allocate the temp and
propagate it as a fir.class.

The polymorphic temporaries creating is also simplified by avoiding the
need to call the runtime to setup the descriptor altogether (the runtime
is still call for the allocation currently because alloca/allocmem do
not support polymorphism).
2025-06-06 09:53:41 +02:00
Ramkumar Ramachandra
3f7b8852cd
[IVDesc] Drop unused arg in isConditionalRdxPattern (NFC) (#142942) 2025-06-06 08:48:23 +01:00
Naveen Seth Hanig
f482b9677e
[C2y] Handle FP-suffixes on prefixed octals (#141230) (#141695)
Fixes https://github.com/llvm/llvm-project/issues/141230.

Currently, prefixed octal literals used with floating-point suffixes are
not
rejected, causing Clang to crash.
This adds proper handling to reject invalid literals such as `0o0.1` or
`0.0e1`.

No release note because this is fixing an issue with a new change.
2025-06-06 09:47:34 +02:00
Baranov Victor
0f03f8ab2e
[clang-tidy] Add support for lambda-expression in use-trailing-return-type check (#135383)
Add support for lambda-expression in `use-trailing-return-type` check.

Added two new options:
1. `TransformFunctions` will trigger function declarations to use
trailing return type.
2. `TransformLambdas` will trigger lambda expression to use trailing
return type if it was not stated explicitly.

Fixed false positives when lambda was matched as a function in C++11
mode.

Closes https://github.com/llvm/llvm-project/issues/95711
2025-06-06 10:46:41 +03:00
yingopq
bbe5ceb22f
[Mips] When emit instruction, ignore JUMP_TABLE_DEBUG_INFO (#139830)
When -triple is windows, SelectionDAGLegalize process Legalizing br_jt,
would generate ISD::JUMP_TABLE_DEBUG_INFO.
Then Mips process emitInstruction, would think JUMP_TABLE_DEBUG_INFO is
a pseudo instruction and generate an error `Pseudo opcode found in
emitInstruction()`.
This instruction `TargetOpcode::JUMP_TABLE_DEBUG_INFO` is only used to
note jump table debug info, so we can ignore it when Mips emit
instruction.

Fix #134916.
2025-06-06 15:44:21 +08:00
Nikita Popov
10dd83d274
[AA] Merge isNonEscapingLocalObject() into SimpleCaptureAnalysis (NFC) (#142971)
isNonEscapingLocalObject() is only used by SimpleCaptureAnalysis and
tightly integrated with its implementation (in particular its cache), so
inline and simplify the implementation.
2025-06-06 09:40:57 +02:00
Matt Arsenault
b2266d6d79
RuntimeLibcalls: Rename fminimum_num/fmaximum_num enums (#143078)
Add the underscore to match the libm spelling
2025-06-06 16:23:26 +09:00
Owen Pan
eb71fdde57
[clang-format] More consumeToken() cleanup (#143063)
Similar to #142104
2025-06-05 23:36:43 -07:00
Nikolas Klauser
1d68abccb5
[libc++] Move _ITER_TRAITS and _ITER_CONCEPT into <__iterator/concepts.h> (#140528)
`_ITER_TRAITS` and `_ITER_CONCEPT` are really implenentation details of
`<__iterator/concetps.h>`, so it makes more sense to put them there than
into `<__iterator/iterator_traits.h>`.
2025-06-06 08:33:15 +02:00
Kazu Hirata
678cdd67b9
[X86] Directly call isShuffleFoldableLoad (NFC) (#143060)
We don't need a lambda here.
2025-06-05 22:58:55 -07:00
Kazu Hirata
445974547d
[llvm] Ensure newline at the end of files (NFC) (#143061)
Without newlines at the end, git diff would display:

  No newline at end of file
2025-06-05 22:58:15 -07:00
Kazu Hirata
ad6631fb0d
[SCCP] Directly call SCCPSolver::isOverdefined (NFC) (#143059)
We don't need a lambda here.
2025-06-05 22:58:10 -07:00
Ivan Kosarev
bcf8ded849
[MC] Remove dead code. (#114798) 2025-06-05 22:47:36 -07:00
Michele Scuttari
aaec9e5f5b
[MLIR] Keep cached symbol tables across buffer deallocation insertions (#141956)
The `DeallocationState` class has been modified to keep a reference to an externally owned `SymbolTableCollection` class, to preserve the cached symbol tables across multiple insertions of deallocation instructions.
2025-06-06 07:22:35 +02:00
Craig Topper
b8a4a3b99c
[ValueTracking] Support scalable vector splats of ConstantInt/ConstantFP in isGuaranteedNotToBeUndefOrPoison. (#142894)
Scalable vectors use insertelt+shufflevector ConstantExpr to
represent a splat.
2025-06-05 22:08:03 -07:00
Rahul Joshi
7005a76638
[NFC][TableGen] Print DecodeIdx for DecodeOps in DecoderEmitter (#142963)
Print DecodeIdx associated with Decode MCD ops in the generated decoder
tables. This can help in debugging decode failures by first mapping the
Op -> DecodeIdx and then inspecting the code in `decodeToMCInst`
associated with that DecodeIdx.
2025-06-05 21:57:26 -07:00
Yingwei Zheng
4eac8daa38
[LoopPeel] Handle non-local instructions/arguments when updating exiting values (#142993)
Similar to
7e14161f49,
the exiting value may be a non-local instruction or an argument.

Closes https://github.com/llvm/llvm-project/issues/142895.
2025-06-06 12:56:28 +08:00
Craig Topper
d5d6f60632
[ValueTracking] Support scalable vectors for ExtractElement in computeKnownFPClass. (#143051)
We can support scalable vectors by setting the demanded mask to APInt(1,
1) to demand the whole vector.
2025-06-05 20:48:07 -07:00
Lang Hames
ea709c7dcd [ORC] Fix examples after cd585864c0b.
cd585864c0b added a MemoryBuffer argument to the memory manager factory. This
patch updates the examples to reflect that change.
2025-06-06 13:36:32 +10:00
Jim Lin
2a8c7d3c69
[RISCV] Add support for -mtune=andes-45-series (#142900)
Enables the use of `-mtune=andes-45-series` to generate code optimized
with the Andes 45 series scheduling model and tuning features.
2025-06-06 11:34:19 +08:00
Jim Lin
f8df24015a
[RISCV] Don't commute with shift if XAndesPerf is enabled (#142920)
More nds.lea.{h,w,d} are generated, similar to sh{1,2,3}add
2025-06-06 11:08:23 +08:00
Owen Pan
05c12b2284
[clang-format] Handle requires clause following a pointer type (#142893)
Fix #142818
2025-06-05 19:55:37 -07:00
Ming-Yi Lai
1728405b13
[LLD][ELF][RISCV][Zicfilp] Handle .note.gnu.property sections for Zicfilp/Zicfiss features (#127193)
+ When all relocatable files contain a `.note.gnu.property` section
(with `NT_GNU_PROPERTY_TYPE_0` notes) which contains a
`GNU_PROPERTY_RISCV_FEATURE_1_AND` property in which the
`GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED`/`GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG`/`GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_SS`
bit is set:
  + The output file will contain a `.note.gnu.property` section with the
bit set
  + A `PT_GNU_PROPERTY` program header is created to encompass the
`.note.gnu.property` section
+ If `-z zicfilp-unlabeled-report=[warning|error]`/`-z
zicfilp-func-sig-report=[warning|error]`/`-z
zicfiss-report=[warning|error]` is specified, the linker will report a
warning or error for any relocatable file lacking the feature bit

RISC-V Zicfilp/Zicfiss features indicate their adoptions as bits in the
`.note.gnu.property` section of ELF files. This patch enables LLD to
process the information correctly by parsing, checking and merging the
bits from all input ELF files and writing the merged result to the
output ELF file.

These feature bits are encoded as a mask in each input ELF files and
intended to be "and"-ed together to check that all input files support a
particular feature.

For RISC-V Zicfilp features, there are 2 conflicting bits allocated:
`GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED` and
`GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG`. They represent the
adoption of the forward edge protection of control-flow integrity with
the "unlabeled" or "func-sig" policy. Since these 2 policies conflicts
with each other, these 2 bits also conflict with each other. This patch
adds the `-z zicfilp-unlabeled-report=[none|warning|error]` and `-z
zicfilp-func-sig-report=[none|warning|error]` commandline options to
make LLD report files that do not have the expected bits toggled on.

For RISC-V Zicfiss feature, there's only one bit allocated:
`GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS`. This bit indicates that the ELF
file supports Zicfiss-based shadow stack. This patch adds the `-z
zicfiss-report=[none|warning|error]` commandline option to make LLD
report files that do not have the expected bit toggled on.

The adoption of the `.note.gnu.property` section for RISC-V targets can
be found in the psABI PR
<https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/417>
(`CFI_LP_UNLABELED` and `CFI_SS`) and PR
<https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/434>
(`CFI_LP_FUNC_SIG`).
2025-06-06 10:32:17 +08:00
Prabhu Rajasekaran
0a1fdbe4df
[lldb] Fix linux x64 test (#143048)
`TestStopHookScripted.py` Was failing for cases where -I 0 was not
passed to stop-hook add calls.
2025-06-05 19:26:17 -07:00
fleeting-xx
93b0bf635a
[clangd] [Modules] Fix to correctly handle module dependencies (#142828)
This is a re-application of llvm/llvm-project#142090 without the unit
test changes. A subsequent PR will follow that adds a unit test for
module dependencies.

### Changes
- Fix dangling string references in the return value of
getAllRequiredModules()
- Change a couple of calls in getOrBuildModuleFile() to use the loop
variable instead of the ModuleName parameter.

@ChuanqiXu9 for review
2025-06-06 09:33:11 +08:00
Jim Lin
deaf2537c2
[RISCV] Add missing immediate operand type for verifyInstruction. NFC. (#143056)
Those immediate operand type are used by Insn{16,32,48,64}.
2025-06-06 09:23:06 +08:00
Jim Lin
d395043300
[RISCV] Select unsigned bitfield insert for XAndesPerf (#142737)
The XAndesPerf extension includes unsigned bitfield extraction
instruction `NDS.BFOZ`, which can extract the bits from 0 to Len -1,
place them starting at bit Msb, and zero-fills the remaining bits.

This patch handles the cases where Msb < Lsb for `NDS.BFOZ`.

Instruction Sytax:

    nds.bfoz Rd, Rs1, Msb, Lsb

The operation is:

    if Msb < Lsb:
        Lenm1 = Lsb - Msb;
        Rd[Lsb:Msb] = Rs1[Lenm1:0];
        if (Lsb < (XLen -1)) Rd[XLen-1:Lsb+1]=0;
        Rd[Msb-1:0]=0;

When Len == 1, it is a special case where the Msb is set to 0 instead of
being equal to the Lsb.
2025-06-06 09:02:18 +08:00
Craig Topper
a23bd179cc
[RISCV] Remove artificial restriction on ShAmt from (shl (and X, C2), C) -> (srli (slli X, C4), C4-C) isel. (#143010)
This code unnecessarily inherited a `ShAmt <= 32` check from an earlier
pattern.
2025-06-05 17:48:35 -07:00
Jason Molenda
7730093596 Revert "[lldb] Don't create instance of SymbolFileDWARFDebugMap for non-Mach-O files (#139170)"
This reverts commit 3096f8768676bd64123270cc59b7cc904a72d875.

Reverting this commit because it depends on another PR
that was reverted, https://github.com/llvm/llvm-project/pull/142704

Both can be reapplied once we find a correct fix for that.
2025-06-05 17:47:04 -07:00
Farzon Lotfi
76c4ba6a1d
Revert "[DirectX] Array GEPs need two indices (#142853)" and "Adjust bit cast instruction filter for DXIL Prepare pass (#142678)" (#143043)
- This reverts commit 9ab4c16042a38d5b80084afff52699e246ca9ea8.
- This reverts commit 1d6e8ec17d547a5f8a0db700dc107a2cd7a321e1.

Noticed a really weird behavior where release and debug builds have
different codegen for loads with geps after this PR. This is going to
take a minute to debug and figure out why so revert seems to make the
most sense.

```diff
diff --git a/llvm/test/CodeGen/DirectX/flatten-array.ll b/llvm/test/CodeGen/DirectX/flatten-array.ll
index 47d7b50cf018..efa9efeff13a 100644
--- a/llvm/test/CodeGen/DirectX/flatten-array.ll
+++ b/llvm/test/CodeGen/DirectX/flatten-array.ll
@@ -123,7 +123,8 @@ define void @gep_4d_test ()  {
@b = internal global [2 x [3 x [4 x i32]]] zeroinitializer, align 16
define void @global_gep_load() {
-  ; CHECK: load i32, ptr getelementptr inbounds ([24 x i32], ptr @a.1dim, i32 0, i32 6), align 4
+  ; CHECK: %1 = getelementptr inbounds [24 x i32], ptr @a.1dim, i32 0, i32 6
+  ; CHECK-NEXT: %2 = load i32, ptr %1, align 4
   ; CHECK-NEXT:    ret void
   %1 = getelementptr inbounds [2 x [3 x [4 x i32]]], [2 x [3 x [4 x i32]]]* @a, i32 0, i32 0
   %2 = getelementptr inbounds [3 x [4 x i32]], [3 x [4 x i32]]* %1, i32 0, i32 1
@@ -176,7 +177,8 @@ define void @global_incomplete_gep_chain(i32 %row, i32 %col) {
}
define void @global_gep_store() {
-  ; CHECK: store i32 1, ptr getelementptr inbounds ([24 x i32], ptr @b.1dim, i32 0, i32 13), align 4
+  ; CHECK: %1 = getelementptr inbounds [24 x i32], ptr @b.1dim, i32 0, i32 13
+  ; CHECK-NEXT: store i32 1, ptr %1, align 4
   ; CHECK-NEXT:    ret void
```
2025-06-05 20:41:37 -04:00
Farzon Lotfi
c21218312e
[DirectX] add maybe_unused to IsVolatile in legalizeMemCpy. (#143040)
fixes a warning when building release.
2025-06-05 20:41:03 -04:00
Wenju He
de3a9ea510
[NFC][libclc] Simplify clc_dot and dot implementation (#142922)
llvm-diff shows no change to amdgcn--amdhsa.bc
2025-06-06 08:09:53 +08:00
Florian Mayer
16b0d2f910
[NFC] mark DebugCounter::Chunk method as const (#143039) 2025-06-05 16:54:34 -07:00
Andy Kaylor
6c1ca07586
[CIR] Add decl case for template specialization (#143029)
This change adds the switch case to allow template specialization to
pass through emitTopLevelDecl without issuing an error.
2025-06-05 16:50:36 -07:00
Karlo Basioli
cd585864c0
Pass memory buffer to RuntimeDyld::MemoryManager factory (#142930)
`RTDyldObjectLinkingLayer` is currently creating a memory manager
without any parameters.

In this PR I am passing the MemoryBuffer that will be emitted to the
MemoryManager so that the user can use it to configure the behaviour of
the MemoryManager.
2025-06-06 00:44:39 +01:00
Jason Molenda
f961d6a89a Revert "[lldb] Set default object format to MachO in ObjectFileMachO (#142704)"
This reverts commit d4d2f069dec4fb8b13447f52752d4ecd08d976d6.

Temporarily reverting until we can find a way to get the correct
ObjectFile set in Module's Triples without adding "-macho" to the
triple string for each Module.  This is breaking TestUniversal.py
on the x86_64 macOS CI bots.
2025-06-05 16:24:31 -07:00
Kazu Hirata
34c011d544
[llvm] Use *Map::try_emplace (NFC) (#143002)
- try_emplace(Key) is shorter than insert(std::make_pair(Key, 0)).
- try_emplace performs value initialization without value parameters.
- We overwrite values on successful insertion anyway.
2025-06-05 16:14:31 -07:00