532994 Commits

Author SHA1 Message Date
Mats Jun Larsen
d579622b1e
[clang][CGObjC] Prefer PointerType::get with LLVMContext over Type (NFC) (#133871)
Part of #123569
2025-04-04 07:18:01 +00:00
Iris
92923e517c
[mlir][llvm] Add LLVM_DependentLibrariesAttr (#133385)
https://llvm.org/docs/LangRef.html#dependent-libs-named-metadata

---------

Co-authored-by: Tobias Gysi <tobias.gysi@nextsilicon.com>
2025-04-04 08:00:04 +02:00
Fangrui Song
92c93f5286 [MC] Merge MCAsmLexer and AsmLexer
Follow-up to #134207

Both classes define `IsAtStartOfStatement` but the semantics are
confusingly different. Rename the base class one.
2025-04-03 22:11:49 -07:00
cmtice
46e2c07fa2
[LLDB] Add DIL code for handling plain variable names. (#120971)
Add the Data Inspection Language (DIL) implementation pieces for
handling plain local and global variable names.

See https://discourse.llvm.org/t/rfc-data-inspection-language/69893 for
information about DIL.

This change includes the basic AST, Lexer, Parser and Evaluator pieces,
as well as some tests.
2025-04-03 21:39:30 -07:00
Kareem Ergawy
6333f8457c
[flang][OpenMP] Move reductions from loop to teams when loop is mapped to distribute (#132920)
Follow-up to #132003, in particular, see
https://github.com/llvm/llvm-project/pull/132003#issuecomment-2739701936.

This PR extends reduction support for `loop` directives. Consider the
following scenario:
```fortran
subroutine bar
  implicit none
  integer :: x, i

  !$omp teams loop reduction(+: x)
  DO i = 1, 5
    call foo()
  END DO
end subroutine
```
Note the following:
* According to the spec, the `reduction` clause will be attached to
`loop` during earlier stages in the compiler.
* Additionally, `loop` cannot be mapped to `distribute parallel for` due
to the call to a foreign function inside the loop's body.
* Therefore, `loop` must be mapped to `distribute`.
* However, `distribute` does not have `reduction` clauses.
* As a result, we have to move the `reduction`s from the `loop` to its
parent `teams` directive, which is what is done by this PR.
2025-04-04 06:20:51 +02:00
Jacob Lalonde
8e7d6baf0e
Revert "[LLDB] Expose checking if the symbol file exists/is loaded via SBModule" (#134341)
Reverts llvm/llvm-project#134163

Reverting while @clayborg and I come up with a better API
2025-04-03 20:45:55 -07:00
Phoebe Wang
897f9a51b9
[X86][AVX10.2] Replace nepbh with bf16 to match with others, NFCI (#134240) 2025-04-04 11:27:39 +08:00
Fangrui Song
c9f6d26e04
[MC] Merge MCAsmLexer.{h,cpp} into AsmLexer.{h,cpp} (#134207)
2b11c7de4ae182496438e166cb6758d41b6e1740 introduced
`llvm/include/llvm/MC/MCAsmLexer.h` and made `AsmLexer` inherit from
`MCAsmLexer`, likely to allow target-specific parsers to depend solely
on `MCAsmLexer`. However, this separation now seems unnecessary and
confusing.

`MCAsmLexer` defines virtual functions with `AsmLexer` as its only
implementation, and `AsmLexer` itself has few extra public methods.

To simplify the codebase, this change merges MCAsmLexer.{h,cpp} into
AsmLexer.{h,cpp}. MCAsmLexer.h is temporarily kept as a forwarder.

Note: I doubt that a downstream lexer handling an assembly syntax
significantly different from the standard GNU Assembler syntax would
want to inherit from `MCAsmLexer`. Instead, it's more likely they'd
extend `AsmLexer` by adding new states and modifying its internal logic,
as seen with variables for MASM, M68k, and HLASM.
2025-04-03 19:22:45 -07:00
NAKAMURA Takumi
4088c70f4e CGHLSLBuiltins.cpp: Suppress a warning in #131237 [-Wunused-variable] 2025-04-04 11:05:46 +09:00
Mircea Trofin
4532512f6c
[ctxprof] Move MoveSymbolGUID to address dependency issues (#134334)
See PR #134192
2025-04-03 19:02:46 -07:00
Mircea Trofin
2146826169
[ctxprof] Support for "move" semantics for the contextual root (#134192)
This PR finishes what PR #133992 started.
2025-04-03 18:36:45 -07:00
Rodrigo Rocha
b9891715af
[BOLT] Handle generation of compare and jump sequences (#131949)
This patch fixes the following two issues with the createCmpJE for
AArch64:
1. Avoids overwriting the value of the input register RegNo by use XZR
as the destination register.
   subs xzr, RegNo, #Imm
   which is equivalent to a simple
   cmp RegNo, #Imm
2. The immediate operand to the Bcc instruction must be EQ instead of
#Imm.

This patch also adds a new function for createCmpJNE and unit tests for
the both createCmpJE and createCmpJNE for X86 and AArch64.
2025-04-03 18:34:24 -07:00
Sudharsan Veeravalli
ae5306f30e
[RISCV] Add symbol parsing support for the Xqcibi branch immediate instructions (#134233)
This patch adds support for parsing symbols in the Xqcibi branch
immediate instructions. While the 32 bit branch instructions use the
same instruction format and relocation as the existing branch
instructions in RISCV, the 48 bit ones use the `InstFormatQC_EB`
instruction format and the `R_RISCV_QC_E_BRANCH` relocation that is
defined in `BinaryFormat/ELFRelocs/RISCV_nonstandard.def.`

Vendor relocation support will be added in a later patch.
2025-04-04 06:57:21 +05:30
Jerry-Ge
7d05c2326c
[mlir][tosa] Remove extra trailing whitespace (#134290)
Trivial change.

Signed-off-by: Jerry Ge <jerry.ge@arm.com>
2025-04-03 18:15:39 -07:00
Jerry-Ge
fcfbef5582
[mlir][tosa] Remove extra declarations of MulOperandsAndResultElementType in TosaOps.td (#134300)
Minor code cleanup

Signed-off-by: Jerry Ge <jerry.ge@arm.com>
2025-04-03 18:15:30 -07:00
Slava Zakharin
65b85bf8bc
[flang] Fixed driver link LIT test for PPC targets. (#134320)
After #131041, the F128 libraries are not linked for PPC targets even
when the driver is built with FLANG_RUNTIME_F128_MATH_LIB.
2025-04-03 16:58:11 -07:00
Michael Jones
c0079ba3dd
[libc] Make utimes_test more stable (#134321)
The test for utimes added in #134167 might fail if the file for one test
hasn't been cleaned up by the OS before the second test starts. This
patch makes the tests use different files.
2025-04-03 16:53:55 -07:00
Jorge Gorbe Moya
ee1ee1144a Fix unused variable warning in non-debug build after 7d3dfc862d283319d01997c0672c50b4a082aa4e (NFC) 2025-04-03 16:50:19 -07:00
Alex MacLean
ba0a52a04b
[InferAS] Support getAssumedAddrSpace for Arguments for NVPTX (#133991) 2025-04-03 16:47:36 -07:00
Aditya Tejpaul
d33ae41c62
[libc] Implemented utimes (Issue #133953) (#134167)
This pull request implements the `utimes` command in libc ([Issue
#133953](https://github.com/llvm/llvm-project/issues/133953)).

- [x] Add the implementation of `utimes` in `/src/sys/time`.
- [x] Add tests for `utimes` in `/test/src/sys/time`. 
- [x] Add `utimes` to
[entrypoints.txt](https://github.com/llvm/llvm-project/blob/main/libc/config/linux/x86_64/entrypoints.txt)
for at least x86_64 and whatever you're building on
- [x] Add `utimes` to
[include/sys/time.yaml](https://github.com/llvm/llvm-project/blob/main/libc/include/sys/time.yaml)
2025-04-03 16:19:12 -07:00
Ian Anderson
bd197ca003
[clang][modules] Determine if the SDK supports builtin modules independent of the target (#134005)
Whether the SDK supports builtin modules is a property of the SDK
itself, and really has nothing to do with the target. This was already
worked around for Mac Catalyst, but there are some other more esoteric
non-obvious target-to-sdk mappings that aren't handled. Have the SDK
parse its OS out of CanonicalName and use that instead of the target to
determine if builtin modules are supported.
2025-04-03 16:09:57 -07:00
modiking
9f2feeb189
[mlir][gpu][nvptx] Remove null terminator when outputting PTX (#133019)
PTX source files are expected to only contain ASCII text
(https://docs.nvidia.com/cuda/parallel-thread-execution/#source-format) and no null terminators.

`ptxas` has so far not enforced this but is moving towards doing so.
This revealed a problem where the null terminator is getting printed out
in the output file in MLIR path when outputting ptx directly. Only add the null on the assembly output path for JIT instead of in output of `moduleToObject `.
2025-04-03 15:50:54 -07:00
Jason Molenda
f1c6612202 [lldb][debugserver] Save and restore the SVE/SME register state (#134184)
debugserver isn't saving and restoring the SVE/SME register state around
inferior function calls.

Making arbitrary function calls while in Streaming SVE mode is generally
a poor idea because a NEON instruction can be hit and crash the
expression execution, which is how I missed this, but they should be
handled correctly if the user knows it is safe to do.

Re-landing this change after fixing an incorrect behavior on systems
without SME support.

rdar://146886210
2025-04-03 15:48:54 -07:00
Louis Dionne
2cd8edd1ff
[libc++] Add missing release note for LLVM 20 about zip_view (#134144)
We should have had a release note in LLVM 20 about implementing P2165R4
since that is technically an ABI and API break for zip_view. We don't
expect anyone to actually hit the ABI issue, but we've come across some
(fairly small) breakage due to the API change, so this should at least
be mentioned in the release notes.
2025-04-03 18:34:49 -04:00
Andre Kuhlenschmidt
b11eece1bb
[flang][intrinsics] Implement the time intrinsic (#133823)
This PR implements the nonstandard intrinsic time.

In addition to running the unit tests, I also double checked that the
example code works by manually compiling and running it.
2025-04-03 15:33:40 -07:00
Sumit Agarwal
996cf5dc67
[HLSL] Implement dot2add intrinsic (#131237)
Resolves #99221 
Key points: For SPIRV backend, it decompose into a `dot` followed a
`add`.

- [x] Implement dot2add clang builtin,
- [x] Link dot2add clang builtin with hlsl_intrinsics.h
- [x] Add sema checks for dot2add to CheckHLSLBuiltinFunctionCall in
SemaHLSL.cpp
- [x] Add codegen for dot2add to EmitHLSLBuiltinExpr in CGBuiltin.cpp
- [x] Add codegen tests to clang/test/CodeGenHLSL/builtins/dot2add.hlsl
- [x] Add sema tests to clang/test/SemaHLSL/BuiltIns/dot2add-errors.hlsl
- [x] Create the int_dx_dot2add intrinsic in IntrinsicsDirectX.td
- [x] Create the DXILOpMapping of int_dx_dot2add to 162 in DXIL.td
- [x] Create the dot2add.ll and dot2add_errors.ll tests in
llvm/test/CodeGen/DirectX/
2025-04-03 16:23:09 -06:00
Jorge Gorbe Moya
109566a3d0
[bazel] Fold "${Target}Analysis" targets into their respective CodeGen targets. (#134312)
After 3801bf6164f570a145e3ebd20cf9114782ae0329, SPIRVAnalysis needs to
include SPIRV.h provided by SPIRVCodegen, but the CodeGen target already
depends on Analysis, so that would cause a circular dependency.

Analysis is a subdirectory of CodeGen so it makes sense as a part of the
main CodeGen target too.
2025-04-03 15:21:26 -07:00
Jan Svoboda
506630d6db
[clang][deps] Avoid unchecked error assertion (#134284) 2025-04-03 14:57:06 -07:00
Andre Kuhlenschmidt
85fdab33b0
[flang][intrinsic] add nonstandard intrinsic unlink (#134162)
This PR adds the intrinsic `unlink` to flang. 

## Test plan
- Added two codegen unit tests and ensured flang-check continues to
pass.
- Manually compiled and ran the example from the documentation.
2025-04-03 14:33:53 -07:00
Valentin Clement (バレンタイン クレメン)
fb6f60ddc5
[flang][cuda][NFC] Use NVVM VoteBallotOp (#134307)
`llvm.nvvm.vote.ballot.sync` has its own operation so use it in
lowering.
2025-04-03 14:19:31 -07:00
Valentin Clement (バレンタイン クレメン)
de40f6101d
[flang][cuda][NFC] Use NVVM op for match all (#134303) 2025-04-03 14:19:21 -07:00
Florian Hahn
0f696c2e86
[LV] Add test where epilogue is vectorized and backedge removed.
Adds extra test coverage for
https://github.com/llvm/llvm-project/pull/106748.
2025-04-03 22:14:15 +01:00
Andy Kaylor
a06ae976dc
[CIR] Upstream support for promoted types with unary plus/minus (#133829)
The initial upstreaming of unary operations left promoted types
unhandled for the unary plus and minus operators. This change implements
support for promoted types and performs a bit of related code cleanup.
2025-04-03 14:04:32 -07:00
Andy Kaylor
13aac46332
[clang][NFC] Refactor CodeGen's hasBooleanRepresentation (#134159)
The ClangIR upstreaming project needs the same logic for
hasBooleanRepresentation() that is currently implemented in the standard
clang codegen. In order to share this code, this change moves the
implementation of this function into the AST Type class.

No functional change is intended by this change. The ClangIR use of this
function will be added separately in a later change.
2025-04-03 14:03:25 -07:00
Alexander Yermolovich
4f902d2425
[llvm-dwarfdump] Make --verify for .debug_names multithreaded. (#127281)
This PR makes verification of .debug_names acceleration table
multithreaded. In local testing it improves verification of clang
.debug_names from four minutes to under a minute.
This PR relies on a current mechanism of extracting DIEs into a vector. 
Future improvements can include creating API to extract one DIE at a
time, or grouping Entires into buckets by CUs and extracting before
parallel step.

Single Thread
4:12.37 real,   246.88 user,    3.54 sys,       0 amem,10232004 mmem
Multi Thread
0:49.40 real,   612.84 user,    515.73 sys,     0 amem, 11226292 mmem
2025-04-03 14:02:27 -07:00
Henry Jiang
7d3dfc862d
[JITLink][XCOFF] Setup initial build support for XCOFF (#127266)
This patch starts the initial implementation of JITLink for XCOFF (Object format for AIX).
2025-04-03 17:01:18 -04:00
Jonas Devlieghere
5f99e0d4b9
[lldb] Use the "reverse video" effect when colors are disabled. (#134203)
When you run lldb without colors (`-X`), the status line looks weird
because it doesn't have a background. You end up with what appears to be
floating text at the bottom of your terminal.

This patch changes the statusline to use the reverse video effect, even
when colors are off. The effect doesn't introduce any new colors and
just inverts the foreground and background color.

I considered an alternative approach which changes the behavior of the
`-X` option, so that turning off colors doesn't prevent emitting
non-color related control characters such as bold, underline, and
reverse video. I decided to go with this more targeted fix as (1) nobody
is asking for this more general change and (2) it introduces significant
complexity to plumb this through using a setting and driver flag so that
it can be disabled when running the tests.

Fixes #134112.
2025-04-03 13:51:17 -07:00
Florian Hahn
cdff7f0b6e
[LV] Retrieve middle VPBB via scalar ph to fix epilogue resumephis (NFC)
If ScalarPH has predecessors, we may need to update its reduction resume
values. If there is a middle block, it must be the first predecessor.
Note that the first predecessor may not be the middle block, if the
middle block doesn't branch to the scalar preheader. In that case,
fixReductionScalarResumeWhenVectorizingEpilog will be a no-op.

In preparation for https://github.com/llvm/llvm-project/pull/106748.
2025-04-03 21:46:48 +01:00
Mircea Trofin
61768b3528
[ctxprof] Don't import roots elsewhere (#134012)
Block a context root from being imported by its callers. 

Suppose that happened. Its caller - usually a message pump - inlines its copy of the root. Then it (the root) and whatever it calls will be the non-contextually optimized callee versions.
2025-04-03 13:21:39 -07:00
Hristo Hristov
b93376f899
[libc++][type_traits] reference_{constructs|converts}_from_temporary with -Winvalid-specialization tests (#133946)
Addresses comment:
https://github.com/llvm/llvm-project/pull/128649/files#r2022341035

---------

Co-authored-by: Hristo Hristov <zingam@outlook.com>
2025-04-03 23:18:04 +03:00
Alexey Bataev
daab7d0807 [SLP]Initial support for (masked)loads + compress and (masked)interleaved
Added initial support for (masked)loads + compress and
(masked)interleaved loads.

Reviewers: RKSimon, hiraditya

Reviewed By: RKSimon

Pull Request: https://github.com/llvm/llvm-project/pull/132099
2025-04-03 13:17:40 -07:00
Florian Hahn
012e574d4d
[LV] Add FindLastIV test with truncated IV and epilogue vectorization.
This adds missing test coverage for
https://github.com/llvm/llvm-project/pull/132691.
2025-04-03 21:01:58 +01:00
Alexey Bataev
7c4013d591 Revert "[SLP]Initial support for (masked)loads + compress and (masked)interleaved"
This reverts commit 0bec0f5c059af5f920fe22ecda469b666b5971b0 to fix
a crash reported in https://lab.llvm.org/buildbot/#/builders/143/builds/6668.
2025-04-03 12:58:49 -07:00
zcfh
229ca7dbcb
[memprof] Report an error when buildid and profile do not match (#132504)
## Problem
When the build ids of the profile and binary do not match, the error
reported by llvm-profdata is `no entries in callstack map after
symbolization`, but the root cause of this problem is the **build id
mismatch**.
## Trigger scenario
For example, when performing `memprof` optimization on `clang`,
`rawprofile` is collected through `ninja clang`. In addition to running
clang, some other programs will also be executed, and these programs
will also generate rawprofile. When `no entries in callstack map after
symbolization` appears during `llvm-profdata merge`, users may
mistakenly think that the **instrumentation failed or other reasons**,
and will **not directly realize that the binary and profile do not
match**.

## Changed
Currently, when the build id does not match, an assert error is
triggered only in debug mode. Change it to directly return an error when
the build id does not match.
2025-04-03 12:48:27 -07:00
Valentin Clement (バレンタイン クレメン)
7288f1bc32
[flang][cuda] Use nvvm operation for match any (#134283)
The string used for intrinsic was not the correct one
"llvm.nvvm.match.any.sync.i32p". There was an extra `p` at the end.

Use the NVVM operation instead so we don't duplicate it.
2025-04-03 12:08:30 -07:00
Rahul Joshi
b393ca6026
[NFC][LLVM][RISCV] Cleanup pass initialization for RISCV (#134279)
- Move calls to pass initialization functions to RISCV target
initialization and remove them from pass constructors.
2025-04-03 11:28:45 -07:00
Jorge Gorbe Moya
158684a80f [bazel] Add missing dep after 586c5e3083428e7473e880dafd5939e8707bc1c9 2025-04-03 11:25:44 -07:00
Slava Zakharin
b8b752db2b
[flang][NFC] Create required Source dir for flang-doc. (#134000) 2025-04-03 10:43:49 -07:00
Slava Zakharin
3f6ae3f0a8
[flang] Added driver options for arrays repacking. (#134002)
Added options:
  * -f[no-]repack-arrays
  * -f[no-]stack-repack-arrays
  * -frepack-arrays-contiguity=whole/innermost
2025-04-03 10:43:28 -07:00
Valentin Clement (バレンタイン クレメン)
3e59ff27e5
[flang][cuda] Fix pred type for vote functions (#134166) 2025-04-03 10:33:09 -07:00