533919 Commits

Author SHA1 Message Date
Jonas Devlieghere
70627af91f
[lldb] Synchronize access to m_statusline in the Debugger (#134759)
Eliminate the potential for a race between the main thread, the default
event handler thread and the signal handling thread, when accessing the
m_statusline member.
2025-04-11 08:53:49 -07:00
Farzon Lotfi
438f984b4b
[DirectX] XFAIL test failing because of debuginfo changes (#135279)
For more context see
https://discourse.llvm.org/t/psa-ir-output-changing-from-debug-intrinsics-to-debug-records/79578

This change:
6a45fce909
broke this test:
https://github.com/llvm/llvm-project/blob/main/llvm/test/tools/dxil-dis/debug-info.ll
in our pipeline:
https://github.com/llvm/llvm-project/actions/workflows/hlsl-matrix.yaml

LLVM is transitioning off of the llvm.dbg.value debug intrinsic in favor
of the `#dbg_declare(..) format. see
https://github.com/llvm/llvm-project/pull/133917/files

dxil-dis does not understand the new format and so work needs to be
planned out to support this transition in
https://github.com/microsoft/DirectXShaderCompiler

For now the fix is to XFAIL this test to unblock the pipeline.
2025-04-11 11:42:21 -04:00
Shafik Yaghmour
ffac1404f8
[Clang] [Sema] Document invariant in Sema::AddOverloadCandidate (#135256)
Static analysis flagged 1 - ArgIdx in Sema::AddOverloadCandidate for its
potential to overflow.

Turns out this is intentional since when PO ==
OverloadCandidateParamOrder::Reversed Args.size() is always two, so this
will never overflow.

We document using an assert.

Fixes: https://github.com/llvm/llvm-project/issues/135086
2025-04-11 08:38:37 -07:00
David Green
a4b7688d27 [AArch64] Regenerate fsh.ll test. NFC 2025-04-11 16:37:42 +01:00
amansharma612
976c37ec95
[AMDGPU] Set hasSideEffects=0 for SALU psuedos (#134487)
Fixes #128685

---------

Co-authored-by: Aman Sharma <210100011@iitb.ac.in>
2025-04-11 17:35:01 +02:00
Jan Svoboda
5a41fc28f3
[clang][modules] Name the module map files on PCM file conflict (#134475)
With implicitly-built modules, seeing something like:
```
fatal error: module 'X' is defined in both '<cache>/HASH1/X-HASH2.pcm' and '<cache>/HASH1/X-HASH3.pcm'
```
is super confusing and not actionable, because the module cache tends to
be hidden from the developer.

This PR adds a note to that diagnostic that names the module map files
the PCM files were compiled from, hopefully giving a good enough hint
for further investigation:
```
note: compiled from '<build>/X.framework/Modules/module.modulemap' and '<SDK>/X.framework/Modules/module.modulemap'
```

(I had to replace the mechanism used to convert `DiagnosticError` into
something `DiagnosticsEngine` can understand, because it seemingly did
not support notes.)
2025-04-11 08:20:12 -07:00
Bangtian Liu
76b85d3a27
[MLIR][CAPI] add C API typedef to fix downstream C API usage (#135380)
This PR is after #135253 and #134935 to fix the error reported by
https://github.com/llvm/llvm-project/pull/135253#issuecomment-2796077024.
This PR Adds typedef declarations for `MlirLinalgContractionDimensions`
and `MlirLinalgConvolutionDimensions` in the C API to ensure
compatibility with pure C code.

I confirm that this fix resolves the reported error based on my testing.

Signed-off-by: Bangtian Liu <liubangtian@gmail.com>
2025-04-11 11:16:58 -04:00
Thurston Dang
3ad2cd5e70 [asan] Fix-forward #133175 by restricting newly-added tests to Linux
This was failing on Mac
(https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/4107/ and
https://issues.chromium.org/issues/409995888). Since this is an
experimental feature, rather than play whack-a-mole with selectively
disabling failing platforms (previously done for Android), this patch
restricts it to Linux.
2025-04-11 15:09:41 +00:00
Mark de Wever
88e15b7815
[libc++] A quick-fix for the Apple CI. (#135202)
The Apple runners automatically pick up newer XCode versions breaking
the CI. This disables the test to get the CI green which allows us to
investigate the issue properly later on.
2025-04-11 17:05:30 +02:00
Matt Arsenault
61f95c6429
IR: Simplify BlockAddress replacement (#135360)
Don't repeatedly replaceAllUsesWith in a loop.
2025-04-11 17:02:28 +02:00
Nikita Popov
c3795ba737 [Maintainers] Fix name 2025-04-11 16:54:31 +02:00
Aaron Ballman
d1ea4799d9
[C23] Fix failed assertions with invalid #embed parameters (#135368)
If the invalid parameter was not the last parameter given, we would fail
to skip to the end of the directive and trip a failed assertion.

Fixes #126940
2025-04-11 10:44:37 -04:00
Simon Pilgrim
07b439605a
[X86] combineConcatVectorOps - require free concatenation of at least one operand of UNPCKL\H (#135366)
Stop just replacing 2*UNPCK+INSERT_SUBVECTOR with 2*INSERT_SUBVECTOR+UNPCK

Currently limited to sub-64-bit element cases until we've accounted for the remaining regressions from some build_vector style patterns.
2025-04-11 15:41:09 +01:00
Stephen Tozer
58211f55c5
[llvm-reduce] Fix incorrectly ignored null MD in ReduceDIMetadata (#108541)
Commit c2e62c7 updated the ReduceDIMetadata pass to be able to remove
DIGlobalVariableExpressions from MDNode operands; it also accidentally
prevented null operands from being preserved, which results in an
assertion being triggered:
`Targets == NoChunksCounter.count() && "number of chunks changes when
reducing"'

This patch allows us to correctly preserve null operands once again.
I've not got a test case for this yet - I'm hoping this patch is just
trivially correct as-is, because I've not got the hang of reducing a
test case for llvm-reduce yet, but I can get a test case generated if
needed.
2025-04-11 15:38:58 +01:00
Rahul Joshi
12fe15ff9d
[NFC][LLVM][Hexagon] Cleanup pass initialization for Hexagon (#134431)
- Remove pass initialization calls from pass constructors.
- Move pass initialization and creation function declarations to
Hexagon.h and remove them from individual .cpp files.
- Add calls for pass initialization in Hexagon target initialization.
- https://github.com/llvm/llvm-project/issues/111767
2025-04-11 07:37:51 -07:00
Rahul Joshi
6b78bbc56b
[NFC][LLVM][Mips] Cleanup pass initialization for Mips (#134446)
- Remove calls to pass initialization from pass constructors.
- https://github.com/llvm/llvm-project/issues/111767
2025-04-11 07:37:15 -07:00
Matheus Izvekov
7113aece4e
[clang] ItaniumMangle: fix mangling for unresolved types (#135312) 2025-04-11 11:31:26 -03:00
Juan Manuel Martinez Caamaño
d6c1ef576f
[AMDGPU] vmem-to-lds-load-insts incoherence between TargetParser and AMDGPU.td (#135376)
The vmem-to-lds-loads-insts feature is only available on gfx9/10. While
target-parser was also enabling it for gfx6,7,8.
2025-04-11 16:31:04 +02:00
James Newling
409def2867
[mlir][vector] shape_cast(broadcast) -> broadcast canonicalization (#134939)
Add additional cases of this canonicalization, by checking the 'source
of truth' function `isBroadcastableTo` to check when it is possible to
broadcast directly to the shape resulting from the shape_cast.

---------

Signed-off-by: James Newling <james.newling@gmail.com>
2025-04-11 15:15:03 +01:00
Jacek Caban
f8f01b5eeb
[LLD][COFF] Support marking sections as x86_64 code in ARM64EC object files (#135280)
On ARM64EC, the `IMAGE_SCN_GPREL` flag is repurposed to indicate that
section code is x86_64. This enables embedding x86_64 code within
ARM64EC object files. MSVC uses this for export thunks in .exp files.
2025-04-11 16:13:46 +02:00
James Newling
cd85f5dbdf
[mlir] canonicalizer: shape_cast(poison) -> poison (#133988)
Based on the ShapeCastConstantFolder, this pattern replaces

%0 = ub.poison : vector<2x3xf32>
%1 = vector.shape_cast %0 vector<2x3xf32> to vector<6xf32>

with 

%1 = ub.poison : vector<6xf32>

---------

Signed-off-by: James Newling <james.newling@gmail.com>
2025-04-11 15:13:03 +01:00
David Green
a9225251c4 [AArch64] Remove SLI/SRI debug. NFC
We don't usually have special debug for DAG combines, and this one has been
around long enough to not be required any more.
2025-04-11 14:58:46 +01:00
agozillon
39f119086f
[Flang][OpenMP][ROCM] Enable rocm-device-lib-path for flang (#135307)
Currently rocm-device-lib-path is not enabled for Flang, so when the
compiler warns / requests a user to provide this option in cases where
it can't find rocm a user cannot actually set the device libraries using
rocm-device-lib-path. The alternative rocm_path that's also mentioned
via the warning can be used, but we should enable both mentioned options
to not confuse users (and myself).
2025-04-11 15:57:30 +02:00
Dmitry Vasilyev
cbba9600ae
Revert "[clang] Improved canonicalization for template specialization types" (#135354)
Reverts llvm/llvm-project#135119 because of the assert in ASTContext.cpp, line 5619.
See #135352 for details.
2025-04-11 17:55:11 +04:00
Jacek Caban
1c05c6183d
[LLD][COFF] Swap the meaning of symtab and hybridSymtab in hybrid images (#135093)
Originally, the intent behind symtab was to represent the symbol table
seen in the PE header (without applying ARM64X relocations). However, in
most cases outside of `writeHeader()`, the code references either both
symbol tables or only the EC one, for example, `mainSymtab` in
`linkerMain()` maps to `hybridSymtab` on ARM64X.

MSVC's link.exe allows pure ARM64EC images to include native ARM64
files. This patch prepares LLD to support the same, which will require
`hybridSymtab` to be available even for ARM64EC. At that point,
`writeHeader()` will need to use the EC symbol table, and the original
reasoning for keeping it in `hybridSymtab` no longer applies.

Given this, it seems cleaner to treat the EC symbol table as the “main”
one, assigning it to `symtab`, and use `hybridSymtab` for the native
symbol table instead. Since `writeHeader()` will need to be conditional
anyway, this change simplifies the rest of the code by allowing other
parts to consistently treat `ctx.symtab` as the main symbol table.

As a further simplification, this also allows us to eliminate `symtabEC`
and use `symtab` directly; I’ll submit that as a separate PR.

The map file now uses the EC symbol table for printed entry points and
exports, matching MSVC behavior.
2025-04-11 15:53:25 +02:00
Valery Pykhtin
0f615fbb0a
[AMDGPU] Simplify GCNRewritePartialRegUses pass. (#135199)
Cleanup some leftover hacks that existed before #67245, more details in #69957.
2025-04-11 15:45:24 +02:00
Alexey Bataev
33af951f3f
[SLP]Synchronize cost of gather/buildvector nodes with codegen
If the buildvector node contains constants and non-constants, need to
consider shuffling of the constant vec and insertion of unique elements
into the vector. Also, if there is an input vector, need to consider the
cost of shuffling source vector and constant vector and then insertion
and shuffling of the non-constant elements.

Reviewers: hiraditya, RKSimon

Reviewed By: RKSimon

Pull Request: https://github.com/llvm/llvm-project/pull/135245
2025-04-11 09:42:34 -04:00
Nikolas Klauser
8fc2538f33
Reapply "[libc++] Optimize num_put integral functions" (#131613) (#133572)
This reverts commit d1156fcb56891fb1a426c3e8331a51d47f98a1b8.

This patch fixes the reported incorrect formatting changes and adds
tests for them. The performance should be unaffected, since there are no
significant changes required to fix the bugs.

Specifically, a `>` was changed to a `>=` to also add a `+` in the zero
case, and we're checking for zero now before printing the octal and
hexadecimal prefixes.

Closes #131710
2025-04-11 15:35:58 +02:00
Shilei Tian
9e90e10e76
[AMDGPU][Clang] Add builtins for gfx12 ray tracing intrinsics (#135224) 2025-04-11 09:33:32 -04:00
Sam Tebbs
b658a2e74a
[LV] Reduce register usage for scaled reductions (#133090)
This PR accounts for scaled reductions in `calculateRegisterUsage` to
reflect the fact that the number of lanes in their output is smaller
than the VF.

Depends on https://github.com/llvm/llvm-project/pull/126437
2025-04-11 14:31:08 +01:00
David Spickett
5b384c3015 [lldb][test] Adjust TestTargetReadInstructionsFlavor skipIfs
Original in https://github.com/llvm/llvm-project/pull/134626 was
written as if it was "this or this" but it's "this and this".

So the test ran on AArch64 Linux, because Linux is not Windows.

Split out the Windows check to fix that.
2025-04-11 13:14:16 +00:00
Piotr Fusik
e100d2bf9a
[DAGCombiner] Fold subtraction if above a constant threshold to umin (#135194)
Like #134235, but with a constant.
It's a pattern in Adler-32 checksum calculation in zlib.

Example:

    unsigned adler32_mod(unsigned x) {
      return x >= 65521u ? x - 65521u : x;
    }

Before, on RISC-V:

    lui     a1, 16
    lui     a2, 1048560
    addiw   a1, a1, -16
    sltu    a1, a1, a0
    negw    a1, a1
    addi    a2, a2, 15
    and     a1, a1, a2
    addw    a0, a0, a1

Or, with Zicond:

    lui     a1, 16
    lui     a2, 1048560
    addiw   a1, a1, -16
    sltu    a1, a1, a0
    addi    a2, a2, 15
    czero.eqz  a1, a2, a1
    addw    a0, a0, a1

After, with Zbb:

    lui     a1, 1048560
    addi    a1, a1, 15
    addw    a1, a0, a1
    minu    a0, a1, a0
2025-04-11 15:00:40 +02:00
Maksim Levental
c12cb0ccbb
[mlir][python] fix value-builder generation for snake_case ops (#135302)
Ops that are already snake case (like [`ROCDL_wmma_*`
ops](66b0b0466b/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td (L411)))
produce python "value-builders" that collide with the class names:

```python
class wmma_bf16_16x16x16_bf16(_ods_ir.OpView):
  OPERATION_NAME = "rocdl.wmma.bf16.16x16x16.bf16"
  ...

def wmma_bf16_16x16x16_bf16(res, args, *, loc=None, ip=None) -> _ods_ir.Value:
  return wmma_bf16_16x16x16_bf16(res=res, args=args, loc=loc, ip=ip).result
```

and thus cannot be emitted (because of recursive self-calls).

This PR fixes that by affixing `_` to the value builder names. 

I would've preferred to just rename the ops but that would be a breaking
change 🤷.
2025-04-11 08:55:38 -04:00
Ebuka Ezike
dda53bef35
[lldb] Fix SBTarget::ReadInstruction with flavor (#134626)
When you call the `SBTarget::ReadInstructions` with flavor from lldb
crashes. This is because the wrong order of the `DisassemblyBytes`
constructor this fixes that

---------

Signed-off-by: Ebuka Ezike <yerimyah1@gmail.com>
2025-04-11 13:45:19 +01:00
Aaron Ballman
01658b1666 Fix two MSVC warnings; NFC
One was "unsafe use of bool" and the other was "sign comparision
mismatch", and both were because we're treating a bool object as if it
were an unsigned int. Add a cast to make that more explicit.
2025-04-11 08:44:20 -04:00
Pavel Labath
2fd860c1f5 [lldb] ProcessGdbRemote header gardning
Remove unused headers, add used headers, remove declared-but-not-defined
entities.
2025-04-11 14:36:08 +02:00
Harrison Hao
e36e57b478
[BUILD] Fix unicode build issue. (#135315)
Fix unicode build fail issue:
```
C4819	The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss	...\llvm-project\llvm\include\llvm\Support\Compiler.h
```
2025-04-11 20:35:16 +08:00
Sergey Kachkov
bc2a5b5466
[RISCV] Explicitly set FRM defs as non-dead to prevent their reordering with instructions that may use it (#135176)
Fixes #135172. The proposed solution is to conservatively reset dead
flag from all $frm defs in AdjustInstrPostInstrSelection.
2025-04-11 15:07:51 +03:00
Mészáros Gergely
c58777c2ad
[clang][ReleaseNotes] Fix code block not rendering (#135330)
Bullet lists require a blank line between paragraphs therefore the `..
code-block::` directive only renders correctly if preceded by a blank
line.
2025-04-11 13:53:33 +02:00
Florian Hahn
e27a21f6a7
[VPlan] Add hasScalarTail, use instead of !CM.foldTailByMasking() (NFC). (#134674)
Now that VPlan is able to fold away redundant branches to the scalar
preheader, we can directly check in VPlan if the scalar tail may
execute. hasScalarTail returns true if the tail may execute.

We know that the scalar tail won't execute if the scalar preheader
doesn't have any predecessors, i.e. is not reachable.

This removes some late uses of the legacy cost model.

PR: https://github.com/llvm/llvm-project/pull/134674
2025-04-11 12:50:59 +01:00
Piotr Fusik
b46f16c8d7 [RISCV][test] Add tests for subtraction if above a constant threshold 2025-04-11 13:40:10 +02:00
Ningning Shi(史宁宁)
37a86cb89e
[NFC] Use the hasMinSize() instead of hasFnAttribute(Attribute::MinSize) (#135328)
The other code all use the hasMinSize(), so I change the last two
hasFnAttribute(Attribute::MinSize).
2025-04-11 19:39:25 +08:00
Simon Pilgrim
3e743a568d
[X86] lowerShuffleAsBitMask - generalize FP handling. (#135345)
Don't explicitly handle f32/f64 cases - allow any fp value type and convert to equivalent int type with MVT::changeTypeToInteger
2025-04-11 12:24:24 +01:00
Ana Mihajlovic
52a3247196
[AMDGPU] Select (xor i1 (divergent trunc:i32 x), -1) -> cmp_neq x, 1 (#133698) 2025-04-11 13:03:01 +02:00
Vivek Khandelwal
e377a5d168
[MLIR][Tensor] Remove tensor.dim canonicalization patterns registered on tensor.expand_shape/tensor.collapse_shape (#134219)
These are problematic because the iterative application that locally
resolves the tensor.dim operation introduces
intermediate floor_div, which is losing the information about the exact
division that was carried out in the original
IR, and the iterative algorithm can't converge towards the simplest
form.
Information loss is not acceptable for canonicalization.

Resolving the dimOp can be achieved through
resolve-ranked-shaped-type-result-dims and
resolve-shaped-type-result-dims passes.

---------

Signed-off-by: Vivek Khandelwal <vivekkhandelwal1424@gmail.com>
2025-04-11 06:57:34 -04:00
Viktoriia Bakalova
9eeafc63d2
Implement -dump-minimization-hints flag. (#133910)
This PR implements a CC1 flag `-dump-minimization-hints`.
The flag allows to specify a file path to dump ranges of deserialized
declarations in `ASTReader`. Example usage:

```
clang -Xclang=-dump-minimization-hints=/tmp/decls -c file.cc -o file.o
```

Example output:
```
// /tmp/decls
{
  "required_ranges": [
    {
      "file": "foo.h",
      "range": [
        {
          "from": {
            "line": 26,
            "column": 1
          },
          "to": {
            "line": 27,
            "column": 77
          }
        }
      ]
    },
    {
      "file": "bar.h",
      "range": [
        {
          "from": {
            "line": 30,
            "column": 1
          },
          "to": {
            "line": 35,
            "column": 1
          }
        },
        {
          "from": {
            "line": 92,
            "column": 1
          },
          "to": {
            "line": 95,
            "column": 1
          }
        }
      ]
    }
  ]
}

```
Specifying the flag creates an instance of
`DeserializedDeclsSourceRangePrinter`, which dumps ranges of deserialized
declarations to aid debugging and bug minimization (we use is as input to [C-Vise](https://github.com/emaxx-google/cvise/tree/multifile-hints).

Required ranges are computed from source ranges of Decls.
`TranslationUnitDecl`, `LinkageSpecDecl` and `NamespaceDecl` are ignored
for the sake of this PR.

Technical details:
* `DeserializedDeclsSourceRangePrinter` implements `ASTConsumer` and
`ASTDeserializationListener`, so that an object of
`DeserializedDeclsSourceRangePrinter` registers as its own listener.
* `ASTDeserializationListener` interface provides the `DeclRead`
callback that we use to collect the deserialized Decls.
Printing or otherwise processing them as this point is dangerous, since
that could trigger additional deserialization and crash compilation.
* The collected Decls are processed in `HandleTranslationUnit` method of
`ASTConsumer`. This is a safe point, since we know that by this point
all the Decls needed by the compiler frontend have been deserialized.
* In case our processing causes further deserialization, `DeclRead` from
the listener might be called again. However, at that point we don't
accept any more Decls for processing.
2025-04-11 12:48:18 +02:00
Nikolas Klauser
4cde945673
[libc++][NFC] Remove public from the type traits (#135088)
The type traits are always `struct`s, so the `public` isn't necessary.
We're currently using `public` in some places, while we omit it in
others. This makes us consistent across the type traits.
2025-04-11 12:08:57 +02:00
Nikolas Klauser
cb43fe33b5
[libc++][NFC] Inline _LIBCPP_FALLTHROUGH() (#135001)
We have `[[fallthrough]]` available in all standards modes, so we can
just inline it like other stanard attributes we use.
2025-04-11 12:07:04 +02:00
Michael Buch
b656915d5a
[lldb][Format][NFCI] Refactor CPlusPlusLanguage::GetFunctionDisplayName into helpers and use LLVM style (#135331)
Same cleanup as in https://github.com/llvm/llvm-project/pull/135031. It
pretty much is the same code that we had to duplicate in the language
plugin. Maybe eventually we'll find a way of getting rid of the
duplication.
2025-04-11 11:01:27 +01:00
Han-Kuan Chen
b99a2b6221 [SLP][REVEC] Update test.
The test is affected by commit aaaa2a325bd1abb8c87e0171384fd2c42da5e38a.
2025-04-11 03:01:09 -07:00