533308 Commits

Author SHA1 Message Date
Aiden Grossman
fb96d5171e Reapply "[CI] Fix Monolithic Linux Build in Ubuntu 24.04 (#133628)"
This reverts commit d72be157823d41e7eaf457cc37ea99c07431a25c.

Now that the container version got bumped, we need to reland this.
2025-04-05 07:24:36 +00:00
Aiden Grossman
44923d8631 [Github] Bump Github Runner Version in Agent Containers
The Github runner version got bumped recently and it would be good to keep
this up to date. Also debugging an issue where Github ARC is failing to
create new pods and trying to see if it might be related to outdated
versions.
2025-04-05 06:46:16 +00:00
Fangrui Song
f3e6473df4 MCValue: reduce getSymB uses
The MCValue::SymB MCSymbolRefExpr member might be replaced with a
MCSymbol in the future. Reduce direct access.
2025-04-04 22:17:22 -07:00
Reid Kleckner
a1935fd380 [clang] Remove unused SourceManager.cpp includes, NFC (trying out clangd) 2025-04-04 22:10:19 -07:00
Changpeng Fang
f47034cbe5
AMDGPU: Add round-to-odd rounding during f64 to bf16 conversion (#133995)
f64 -> bf16 conversion can be lowered to f64 -> f32 followed by f32 ->
bf16:
   v_cvt_f32_f64_e32 v0, v[0:1]
   v_cvt_pk_bf16_f32 v0, v0, s0
Both conversion instructions will do round-to-even rounding, and thus we
will have double rounding issue which may generate incorrect result in
some data range. We need to add round-to-odd rounding during f64 -> f32
to avoid double rounding,.

NOTE: we are having the same issue with f64 -> f16 conversion. Will add
round-to-odd rounding for it in a separate patch, which fixes
SWDEV-523856

---------

Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
2025-04-04 21:19:43 -07:00
Fangrui Song
a07b37475c [LoongArch] Simplify evaluateAsRelocatableImpl
Similar to RISCV
2025-04-04 21:15:42 -07:00
Fangrui Song
b6a9618301 [MCParser] Rename confusing variable names
https://reviews.llvm.org/D24047 added `IsAtStartOfStatement` to
MCAsmLexer, while its subclass AsmLexer had a variable of the same name.
The assignment in `UnLex` is unnecessary, which is now removed.

60b403e75cd25a0c76aaaf4e6b176923acf49443 (2019) named the result
`parseStatement` `Parsed`. `HasError` is a clearer name.
2025-04-04 21:04:06 -07:00
jobhdez
1d7bd3bc5c
[libc] Remove extra parenthesis in sin.cpp comments (#134477) 2025-04-04 23:51:56 -04:00
Fangrui Song
71884b63a4
[AArch64] Transition from MCSymbolRefExpr::VariantKind constants
Shift ELF `@plt` and `@gotpcrel` references in data directives, as well as
Mach-O `@specifier` notations, to use `AArch64MCExpr::Specifier` constants.
This is a follow-up to #132595. COFF-specific specifiers are not moved
yet.

In addition, partition @-specifiers into COFF, ELF, and Mach-O, so that
mix-and-match is rejected at parse time.

ELF and Mach-O specifiers are distinct, with `None` being the only
shared value. For Mach-O-specific specifiers, we adopt the `M_xxx` naming
convention.

Pull Request: https://github.com/llvm/llvm-project/pull/133214
2025-04-04 19:57:24 -07:00
Sudharsan Veeravalli
d59594d697
[RISCV] Relax out of range Xqcibi conditional branches (#134336)
If .L1 is not within +-4KiB range,

convert

qc.(e.)bge a0, 10, .L1

to

qc.(e.)blt a0, 10, 8(10)
j   .L1

This is similar to what is done for the RISCV conditional branches.
2025-04-05 08:23:54 +05:30
weiwei chen
1f72fa29ec
[X86Backend][M68KBackend] Make Ctx in X86MCInstLower (M68KInstLower) the same as AsmPrinter.OutContext (#133352)
In `X86MCInstLower::LowerMachineOperand`, a new `MCSymbol` can be
created in `GetSymbolFromOperand(MO)` where `MO.getType()` is
`MachineOperand::MO_ExternalSymbol`
```
  case MachineOperand::MO_ExternalSymbol:
    return LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
```
at
725a7b664b/llvm/lib/Target/X86/X86MCInstLower.cpp (L196)

However, this newly created symbol will not be marked properly with its
`IsExternal` field since `Ctx.getOrCreateSymbol(Name)` doesn't know if
the newly created `MCSymbol` is for `MachineOperand::MO_ExternalSymbol`.



Looking at other backends, for example `Arch64MCInstLower` is doing for
handling `MC_ExternalSymbol`


14c36db16f/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp (L366-L367)


14c36db16f/llvm/lib/Target/AArch64/AArch64MCInstLower.cpp (L145-L148)

It creates/gets the MCSymbol from `AsmPrinter.OutContext` instead of
from `Ctx`. Moreover, `Ctx` for `AArch64MCLower` is the same as
`AsmPrinter.OutContext`.
8e7d6baf0e/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp (L100).
This applies to almost all the other backends except X86 and M68k.

```
$git grep "MCInstLowering("
lib/Target/AArch64/AArch64AsmPrinter.cpp💯      : AsmPrinter(TM, std::move(Streamer)), MCInstLowering(OutContext, *this),
lib/Target/AMDGPU/AMDGPUMCInstLower.cpp:223:  AMDGPUMCInstLower MCInstLowering(OutContext, STI, *this);
lib/Target/AMDGPU/AMDGPUMCInstLower.cpp:257:  AMDGPUMCInstLower MCInstLowering(OutContext, STI, *this);
lib/Target/AMDGPU/R600MCInstLower.cpp:52:  R600MCInstLower MCInstLowering(OutContext, STI, *this);
lib/Target/ARC/ARCAsmPrinter.cpp:41:        MCInstLowering(&OutContext, *this) {}
lib/Target/AVR/AVRAsmPrinter.cpp:196:  AVRMCInstLower MCInstLowering(OutContext, *this);
lib/Target/BPF/BPFAsmPrinter.cpp:144:    BPFMCInstLower MCInstLowering(OutContext, *this);
lib/Target/CSKY/CSKYAsmPrinter.cpp:41:    : AsmPrinter(TM, std::move(Streamer)), MCInstLowering(OutContext, *this) {}
lib/Target/Lanai/LanaiAsmPrinter.cpp:147:  LanaiMCInstLower MCInstLowering(OutContext, *this);
lib/Target/Lanai/LanaiAsmPrinter.cpp:184:  LanaiMCInstLower MCInstLowering(OutContext, *this);
lib/Target/MSP430/MSP430AsmPrinter.cpp:149:  MSP430MCInstLower MCInstLowering(OutContext, *this);
lib/Target/Mips/MipsAsmPrinter.h:126:      : AsmPrinter(TM, std::move(Streamer)), MCInstLowering(*this) {}
lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp:695:    WebAssemblyMCInstLower MCInstLowering(OutContext, *this);
lib/Target/X86/X86MCInstLower.cpp:2200:  X86MCInstLower MCInstLowering(*MF, *this);
```

This patch makes `X86MCInstLower` and `M68KInstLower` to have their
`Ctx` from `AsmPrinter.OutContext` instead of getting it from
`MF.getContext()` to be consistent with all the other backends.

I think since normal use case (probably anything other than our
un-conventional case) only handles one llvm module all the way through
in the codegen pipeline till the end of code emission (AsmPrint),
`AsmPrinter.OutContext` is the same as MachineFunction's MCContext, so
this change is an NFC.

----

This fixes an error while running the generated code in ORC JIT for our
use case with
[MCLinker](https://youtu.be/yuSBEXkjfEA?si=HjgjkxJ9hLfnSvBj&t=813) (see
more details below):
https://github.com/llvm/llvm-project/pull/133291#issuecomment-2759200983

We (Mojo) are trying to do a MC level linking so that we break llvm
module into multiple submodules to compile and codegen in parallel
(technically into *.o files with symbol linkage type change), but
instead of archive all of them into one `.a` file, we want to fix the
symbol linkage type and still produce one *.o file. The parallel codegen
pipeline generates the codegen data structures in their own `MCContext`
(which is `Ctx` here). So if function `f` and `g` got split into
different submodules, they will have different `Ctx`. And when we try to
create an external symbol with the same name for each of them with
`Ctx.getOrCreate(SymName)`, we will get two different `MCSymbol*`
because `f` and `g`'s `MCContext` are different and they can't see each
other. This is unfortunately not what we want for external symbols.
Using `AsmPrinter.OutContext` helps, since it is shared, if we try to
get or create the `MCSymbol` there, we'll be able to deduplicate.
2025-04-04 22:44:07 -04:00
Felipe de Azevedo Piovezan
6272e1f37e
[lldb] Make RegisterContextThreadMemory thread safe (#134469)
The UpdateRegisterContext method can be called from multiple threads.
2025-04-04 18:43:31 -07:00
Andy Kaylor
78905ce6cb
[CIR] Upstream support for logical not operations (#133966)
When unary operation support was initially upstreamed, the cir.cast
operation hadn't been upstreamed yet, so logical not wasn't included.
Since casts have now been added, this change adds support for logical
not.
2025-04-04 17:36:14 -07:00
Michael Jones
e8b52acca2
[libc][NFC] replace NULL with nullptr (#134464)
Simple cleanup
2025-04-04 16:55:43 -07:00
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