533094 Commits

Author SHA1 Message Date
Slava Zakharin
7001993880
[flang] Temporary include variant.h in enum-class.h. (#134460)
I am having problems building Fortran runtime for CUDA
after #134164. I need more time to investigate it,
but in the meantime including variant.h (or any header
that eventually includes a libcudacxx header) resolves
the issue.
2025-04-04 16:39:49 -07:00
alx32
74a7802893
[lld-macho] Fix code section ordering in output binary (#134010)
In `OutputSegment.cpp`, we need to ensure a specific order for certain
sections. The current sorting logic incorrectly prioritizes code
sections over explicitly defined section orders. This is problematic
because the `__objc_stubs` section is both a code section *and* has a
specific ordering requirement. The current logic would incorrectly
prioritize its code section status, causing it to be sorted *before* the
`__stubs` section. This incorrect ordering breaks the branch extension
algorithm, ultimately leading to linker failures due to relocation
errors.

We also modify the `lld/test/MachO/arm64-objc-stubs.s` test to ensure
correct section ordering.
2025-04-04 16:37:35 -07:00
Jonas Devlieghere
5271dead61
[lldb] Add a {ObjectFile,SymbolFile}::GetObjectName method (#133370)
Add ObjectFile::GetObjectName and SymbolFile::GetObjectName to retrieve
the name of the object file, including the `.a` for static libraries.

We currently do something similar in CommandObjectTarget, but the code
for dumping this is a lot more involved than what's being offered by the
new method. We have options to print he full path, the base name, and
the directoy of the path and trim it to a specific width. 

This is motivated by #133211, where Greg pointed out that the old code
would print the static archive (the .a file) rather than the actual
object file inside of it.
2025-04-04 16:33:40 -07:00
Un1q32
6f34d03b31
Remove iOS 5 check for tailcalls on ARM (#133354)
Fixes #102053

The check was added in 8decdc472f308b13d7fb7fd50c3919db086c0417, and at
the time iOS 5 was the latest iOS version, before that commit tail calls
were disabled for all ARMv7 targets. Testing a build of wasm3 with the
patch on a device running iOS 3.0 shows a noticeable performance
improvement and no issues.
2025-04-04 16:02:39 -07:00
Andy Kaylor
b0d0636026
[CIR] Upstream support for break and continue statements (#134181)
This adds ClangIR support for break and continue statements in loops.

Because only loops are currently implemented upstream in CIR, only
breaks in loops are supported here, but this same code will work (with
minor changes to the verification and cfg flattening) when switch
statements are upstreamed.
2025-04-04 15:53:11 -07:00
Austin Schuh
bdff739c7e
cuda clang: Clean up test dependency for CUDA surfaces (#134459)
https://github.com/llvm/llvm-project/pull/132883 added support for cuda
surfaces but reached into clang/test/Headers/ from clang/test/CodeGen/
to grab the minimal cuda.h. Duplicate that file instead based on
comments in the review, to fix remote test runs.

Signed-off-by: Austin Schuh <austin.linux@gmail.com>
2025-04-04 15:52:44 -07:00
Ashley Coleman
e3369a8dc9
[NFC][HLSL] Rename ResourceBinding Types (#134165)
Non-functional change as first step in
https://github.com/llvm/wg-hlsl/pull/207

Removes `Binding` from "Resource Instance" types
2025-04-04 16:51:35 -06:00
Jerry-Ge
64b060f129
[mlir][tosa] Update URLs to TOSA specification (#134449)
- The existing URLs are no longer valid, updated to the current one

Signed-off-by: Jerry Ge <jerry.ge@arm.com>
2025-04-04 15:41:05 -07:00
Alex MacLean
ad39049ec4
[DAGCombiner] Attempt to fold 'add' nodes to funnel-shift or rotate (#125612)
Almost all of the rotate idioms that are valid for an 'or' are also
valid when the halves are combined with an 'add'. Further, many of these
cases are not handled by common bits tracking meaning that the 'add' is
not converted to a 'disjoint or'.
2025-04-04 15:39:24 -07:00
Jorge Gorbe Moya
412f7fa316 [clang] Bump DIAG_SIZE_PARSE as we're hitting the limit downstream as of 6263de90df7f58c8b98475024d5eef102e10a372. 2025-04-04 14:39:57 -07:00
Valentin Clement (バレンタイン クレメン)
18ff8df958
[flang][cuda] Register managed variables with double descriptor (#134444)
Allocatable or pointer module variables with the CUDA managed attribute
are defined with a double descriptor. One on the host and one on the
device. Only the data pointed to by the descriptor will be allocated in
managed memory.
Allow the registration of any allocatable or pointer module variables
like device or constant.
2025-04-04 14:38:01 -07:00
Craig Topper
19e0233eb8 [RISCV] Make decodeXqccmpRlistS0 defer to decodeZcmpRlist after checking for S0 being included. NFC
This reduces code duplication.
2025-04-04 13:59:49 -07:00
Valentin Clement (バレンタイン クレメン)
24dfcc0c02
[flang][cuda] Use the nvvm.vote.sync op for all and any (#134433)
NVVM operations are now available for all and any as well. Use the op
and clean up the generation function to handle all the 3 vote sync
kinds.
2025-04-04 13:45:03 -07:00
Finn Plummer
428fc2c887
[NFC][HLSL][RootSignature] Make the Lexer adhere to naming conventions (#134136)
- when developing the RootSignatureLexer library, we are creating new
files so we should set the standard to adhere to the coding conventions
for function naming
- this was missed in the initial review but caught in the review of the
parser pr
[here](https://github.com/llvm/llvm-project/pull/133302#discussion_r2017632092)

Co-authored-by: Finn Plummer <finnplummer@microsoft.com>
2025-04-04 13:43:45 -07:00
Craig Topper
bbaf0877fa [RISCV] Assert on all invalid inputs to getStackAdjBase and printRegList. NFC 2025-04-04 13:41:05 -07:00
Jonas Devlieghere
12cf6d3b9e
[lldb] Fix missing semicolon in lldbassert macro 2025-04-04 13:37:12 -07:00
Craig Topper
d341b632a1 [RISCV] Remove unused function declaration. NFC 2025-04-04 13:27:38 -07:00
Eugene Epshteyn
61af05fe82
[flang] Add runtime and lowering implementation for extended intrinsic PUTENV (#134412)
Implement extended intrinsic PUTENV, both function and subroutine forms.
Add PUTENV documentation to flang/docs/Intrinsics.md. Add functional and
semantic unit tests.
2025-04-04 16:26:08 -04:00
Florian Hahn
3a859b11e3
[VPlan] Set and use debug location for VPScalarIVStepsRecipe.
This adds missing debug location for VPscalarIVStepsRecipe. The location
of the corresponding phi is used.
2025-04-04 21:14:36 +01:00
Lei Huang
b518242156
[PowerPC] Fix instruction name for dmr insert (#134301) 2025-04-04 15:56:30 -04:00
Michael Jones
4c182df633
[libc] Fix suseconds_t definition and utimes_test (#134326)
The main issue was that the kernel expected `suseconds_t` to be 64 bits
but ours was 32. This caused inconsistent failures since all valid
`suseconds_t` values are less than 1000000 (1 million), and some
configurations caused `struct timeval` to be padded to 128 bits.

Also: forgot to use TEST_FILE instead of FILE_PATH in some places.
2025-04-04 12:53:46 -07:00
Jonas Devlieghere
03604a7840
[lldb] Make lldbassert fire only once per instance (#134343)
The `lldbassert` macro in LLDB behaves like a regular `assert` when
assertions are enabled, and otherwise prints a pretty backtrace and
prompts the user to file a bug. By default, this is emitted as a
diagnostic event, but vendors can provide their own behavior, for
example pre-populating a bug report.

Recently, we ran into an issue where an `lldbassert` (in the Swift
language plugin) would fire excessively, to the point that it was
interfering with the usability of the debugger.

Once an `lldbasser` has fired, there's no point in bothering the user
over and over again for the same problem. This PR solves the problem by
introducing a static `std::once_flag` in the macro. This way, every
`lldbasser` will fire at most once per lldb instance.

rdar://148520448
2025-04-04 12:53:10 -07:00
Craig Topper
9069ba183d [RISCV] Rename Spimm to StackAdj in most places. NFC
Spimm in the spec refers to the 2-bit encoded value. All of the code
uses the 0, 16, 32, or 48 adjustment value.

Also remove the decodeZcmpSpimm as its identical to the default
behavior for no custom DecoderMethod.
2025-04-04 12:49:09 -07:00
erichkeane
6263de90df [OpenACC] Implement 'modifier-list' sema/AST
OpenACC 3.3-NEXT has changed the way tags for copy, copyin, copyout, and
create clauses are specified, and end up adding a few extras, and
permits them as a list.  This patch encodes these as bitmask enum so
they can be stored succinctly, but still diagnose reasonably.
2025-04-04 12:32:33 -07:00
Zahira Ammarguellat
ebb0e6cb25
[NFC] Remove dead code detected by code sanitizer. (#134385)
The code sanitizer is failing with this error: `Execution cannot reach
this statement.`
The execution code path would early exit at line 928 if `(Lil && Ril) =
true`.
2025-04-04 15:21:47 -04:00
Lei Huang
c22586a9d1
[PowerPC] Update altivec.h to use __inline__ for c89 compatibility (#134430) 2025-04-04 15:19:36 -04:00
Ryosuke Niwa
d8fd665960
[alpha.webkit.ForwardDeclChecker] Ignore forward declared struct. (#133804)
There are some system libraries such as sqlite3 which forward declare a
struct then use a pointer to that forward declared type in various APIs.
Ignore these types ForwardDeclChecker like other pointer types.
2025-04-04 12:04:20 -07:00
Aaron Ballman
a2d983cffb
Improve diagnostic wording for invalid callback attribute uses (#134423)
We were previously telling the user how many arguments were passed to
the attribute rather than saying how many arguments were expected to be
passed to the callback function. This rewords the diagnostic to
hopefully be a bit more clear.

Fixes #47451
2025-04-04 15:01:36 -04:00
Louis Dionne
a97f73405f
[libc++] Fix deployment targets that were incorrectly bumped (#134278)
When I introduced the various `_LIBCPP_INTRODUCED_IN_LLVM_XY_ATTRIBUTE`
macros in 182f5e9b2f03, I tried to correlate them to the right OS
versions, but it seems that I made a few mistakes. This wasn't caught in
the CI because we don't test back-deployment that far.

rdar://148405946
2025-04-04 14:56:26 -04:00
Sirraide
50f0b30cff
[Clang] [Sema] Allow static assertions in the first part of a for loop in C (#134415)
No release note for this one because the one added by #129737 already
mentions ‘non-variable declarations’.

Fixes #56471.
2025-04-04 20:54:13 +02:00
Maksim Panchenko
e4cbb7780b
[BOLT][AArch64] Fix symbolization of unoptimized TLS access (#134332)
TLS relocations may not have a valid BOLT symbol associated with them.
While symbolizing the operand, we were checking for the symbol value,
and since there was no symbol the check resulted in a crash.

Handle TLS case while performing operand symbolization on AArch64.
2025-04-04 11:42:21 -07:00
LLVM GN Syncbot
e2092a430a [gn build] Port da69eb75cbc6 2025-04-04 18:29:23 +00:00
LLVM GN Syncbot
22921540cd [gn build] Port 7d3dfc862d28 2025-04-04 18:29:22 +00:00
LLVM GN Syncbot
1d88cfcbb8 [gn build] Port 46e2c07fa28b 2025-04-04 18:29:21 +00:00
Ryosuke Niwa
bf1d27889b
[WebKit checkers] Treat Objective-C message send return value as safe (#133605)
Objective-C selectors are supposed to return autoreleased object. Treat
these return values as safe.
2025-04-04 11:25:24 -07:00
Alexey Bataev
19aec00735 [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-04 11:14:49 -07:00
Valentin Clement (バレンタイン クレメン)
cd2f85a24b
[mlir][NVVM] Add ops for vote all and any sync (#134309)
Add operations for `nvvm.vote.all.sync` and `nvvm.vote.any.sync`
intrinsics similar to `nvvm.vote.ballot.sync`.
2025-04-04 11:06:10 -07:00
Luke Lau
d62d15e298
[RISCV] Undo unprofitable zext of icmp combine (#134306)
InstCombine will combine this zext of an icmp where the source has a
single bit set to a lshr plus trunc
(`InstCombinerImpl::transformZExtICmp`):

```llvm
define <vscale x 1 x i8> @f(<vscale x 1 x i64> %x) {
  %1 = and <vscale x 1 x i64> %x, splat (i64 8)
  %2 = icmp ne <vscale x 1 x i64> %1, splat (i64 0)
  %3 = zext <vscale x 1 x i1> %2 to <vscale x 1 x i8>
  ret <vscale x 1 x i8> %3
}
```

```llvm
define <vscale x 1 x i8> @reverse_zexticmp_i64(<vscale x 1 x i64> %x) {
  %1 = trunc <vscale x 1 x i64> %x to <vscale x 1 x i8>
  %2 = lshr <vscale x 1 x i8> %1, splat (i8 2)
  %3 = and <vscale x 1 x i8> %2, splat (i8 1)
  ret <vscale x 1 x i8> %3
}
```

In a loop, this ends up being unprofitable for RISC-V because the
codegen now goes from:

```asm
f:                                      # @f
	.cfi_startproc
# %bb.0:
	vsetvli	a0, zero, e64, m1, ta, ma
	vand.vi	v8, v8, 8
	vmsne.vi	v0, v8, 0
	vsetvli	zero, zero, e8, mf8, ta, ma
	vmv.v.i	v8, 0
	vmerge.vim	v8, v8, 1, v0
	ret
```

To a series of narrowing vnsrl.wis:

```asm
f:                                      # @f
	.cfi_startproc
# %bb.0:
	vsetvli	a0, zero, e64, m1, ta, ma
	vand.vi	v8, v8, 8
	vsetvli	zero, zero, e32, mf2, ta, ma
	vnsrl.wi	v8, v8, 3
	vsetvli	zero, zero, e16, mf4, ta, ma
	vnsrl.wi	v8, v8, 0
	vsetvli	zero, zero, e8, mf8, ta, ma
	vnsrl.wi	v8, v8, 0
	ret
```

In the original form, the vmv.v.i is loop invariant and is hoisted out,
and the vmerge.vim usually gets folded away into a masked instruction,
so you usually just end up with a vsetvli + vmsne.vi.

The truncate requires multiple instructions and introduces a vtype
toggle for each one, and is measurably slower on the BPI-F3.

This reverses the transform in RISCVISelLowering for truncations greater
than twice the bitwidth, i.e. it keeps single vnsrl.wis.

Fixes #132245
2025-04-04 19:05:59 +01:00
Florian Mayer
30f2e92c69
[clang] [sanitizer] predict trap checks succeed (#134310)
Trap checks fail at most once (when the program crashes).
2025-04-04 10:58:08 -07:00
Aaron Ballman
b6b0257972
Fix the signature for __builtin___clear_cache (#134376)
The signature was changed from void(char *, char *) to void(void *, void
*) to match GCC's signature for the same builtin.

Fixes #47833
2025-04-04 13:53:45 -04:00
Nico Weber
d9bf390852 [gn] port 4a4d41e723a
...and add missing TargetsToBuild dep.
2025-04-04 13:52:09 -04:00
Nico Weber
8f6551935a [gn] Add a missing dependency
Needed after 6ee5e694bff
2025-04-04 13:32:36 -04:00
Nico Weber
6ee5e694bf [gn] port 10c6ebc4271 (-gen-clang-diags-compat-ids) 2025-04-04 13:25:41 -04:00
Jan Svoboda
cde90e68f8
[clang][deps] Respect Lexer::cutOffLexing() (#134404)
This is crucial when recovering from fatal loader errors. Without it,
the `Lexer` keeps yielding more tokens and the compiler may access
invalid `ASTReader` state.

rdar://133388373
2025-04-04 10:21:33 -07:00
Jan Svoboda
ea0869ccb9 [clang][parse] Fix build of ParseHLSLRootSignatureTest.cpp
Fallout from PR #133467.
2025-04-04 10:20:44 -07:00
Jan Svoboda
1688c3062a
[clang] Do not share ownership of PreprocessorOptions (#133467)
This PR makes it so that `CompilerInvocation` is the sole owner of the
`PreprocessorOptions` instance.
2025-04-04 10:11:14 -07:00
Alexey Bataev
90cf2e31ab Revert "[SLP]Initial support for (masked)loads + compress and (masked)interleaved"
This reverts commit daab7d08078bb7cd37c66b78a56f4773e6b12fba to fix
a crash reported in https://github.com/llvm/llvm-project/issues/134411.
2025-04-04 10:09:39 -07:00
Felipe de Azevedo Piovezan
232525f069
[lldb] Clear thread-creation breakpoints in ProcessGDBRemote::Clear (#134397)
Currently, these breakpoints are being accumulated every time a new
process if created (e.g. through a `run`). Depending on the
circumstances, the old breakpoints are even left enabled, interfering
with subsequent processes. This is addressed by removing the breakpoints
in ProcessGDBRemote::Clear

Note that these breakpoints are more of a PlatformDarwin thing, so in
the future we should look into moving them there.
2025-04-04 10:05:44 -07:00
Peter Klausler
5942f0269e
[flang] Preserve compiler directives in -E output (#133959)
No longer require -fopenmp or -fopenacc with -E, unless specific version
number options are also required for predefined macros. This means that
most source can be preprocessed with -E and then later compiled with
-fopenmp, -fopenacc, or neither.

This means that OpenMP conditional compilation lines (!$) are also
passed through to -E output. The tricky part of this patch was dealing
with the fact that those conditional lines can also contain regular
Fortran line continuation, and that now has to be deferred when !$ lines
are interspersed.
2025-04-04 09:49:57 -07:00
Craig Topper
70a1445e40 [RISCV] Prefer RegList over Rlist in assembler. NFC
This makes it more obvious what the R means. I've kept rlist in
place that refer to the encoding.
2025-04-04 09:37:52 -07:00