Set IsLittleEndian in arm64e-input-abi.s
#238122 makes IsLittleEndian required in Mach-O YAML. Set it here so this test works whichever of the two lands first.
Assisted-by: Claude Code
[BPF] Promote i32 stack arguments to i64 with ALU32 (#238315)
Without ALU32, `CC_BPF64` promotes i32 arguments to i64, so the caller
sign- or zero-extends `signext`/`zeroext` arguments to the full 64-bit
stack slot and the callee relies on that.
With ALU32, `CC_BPF32` assigns i32 stack arguments as is, with
`CCValAssign::Full`. The caller any-extends them to the 64-bit slot, but
the callee reads the slot as i64 and the generic argument lowering still
asserts it is sign/zero-extended, so it is used without extending (`llc
-mcpu=v3`):
```
declare i64 @ext(i64, i64, i64, i64, i64, i32 zeroext, i32 signext)
... call i64 @ext(..., i32 zeroext %t, i32 signext %t)
caller: *(u64 *)(r11 - 8) = r1 ; %t not extended
*(u64 *)(r11 - 16) = r1
callee: r1 = *(u64 *)(r11 + 8) ; assumed extended
r0 = *(u64 *)(r11 + 16)
[25 lines not shown]
[ProfCheck] Wire up enable-profcheck-in-pipeline to CodeGen
This patch wires up the enable-profcheck-in-pipeline flag to the CodeGen
pipeline (NewPM only because it's complete enough for testing and should
become the default soonish). This enables catching issues in the IR
section of the CodeGen pipeline.
From attempting a bootstrap of LLVM, it seems like there are many such
issues to dig through.
Reviewers: mtrofin, aeubanks
Pull Request: https://github.com/llvm/llvm-project/pull/238608
[sanitizer_common] Fix strlcpy shadow handling (#238598)
The `strlcpy` interceptor passes `internal_strlen(dst) + 1` to
`COMMON_INTERCEPTOR_COPY_STRING`, which already unpoisons the next byte.
Use the copied length instead of `internal_strlen(dst) + 1 `, and skip
the update when `size` is zero.
Follow-up to #236414.
Check arm64e ABI markers in static links too
Static links skipped the check, but ld64 takes only unversioned and
kernel objects there besides version 0, and ignores the other markers.
Assisted-by: Claude Code
[lld-macho] Reject incompatible arm64e object ABI markers
The CPU subtype of an arm64e object carries a pointer authentication ABI
marker. In a dynamic link, ld64 accepts only objects marked userland ABI
version 0, even on macOS and Mac Catalyst, whose executables are marked
version 1. It names any other marker as another architecture
(arm64e.old, arm64e.v1, arm64e.kernel, arm64e.kernel.v1 or unknown) and,
as with an arm64 object, ignores the file with a warning, or reports an
error with -arch_errors_fatal. This applies to archive members too.
lld linked these objects. Check the marker in the same way. ld64 accepts
unversioned and kernel-ABI objects in static links, so those links are
not checked.
Assisted-by: Claude Code
[lld-macho] Sign the arm64e TLV bootstrap pointer as ld64 does
The first word of a thread-local variable descriptor is bound to
__tlv_bootstrap, which dyld replaces with a pointer to tlv_get_addr that
TLV accesses call with blraaz. On arm64e, ld64 writes that bind as an
authenticated bind with the IA key and no diversity, although the object
asks for a plain pointer. Do the same.
Assisted-by: Claude Code
[lld-macho] List arm64e __auth_got entries in the map file
The map file printed the entries of __got but not those of arm64e's
__auth_got, which held the targets of the stubs and the personalities.
Print them in the same way.
Assisted-by: Claude Code
[lld-macho] Call through authenticated stubs on arm64e (#234003)
Call dylib functions from arm64e code through `__auth_stubs` rather than
`__stubs`, as ld64 does. Each stub is four instructions instead of
three:
```
adrp x17, slot at page
add x17, x17, slot at pageoff
ldr x16, [x17]
braa x16, x17
```
where the slot is in `__auth_got` and holds a pointer that dyld signs
with the IA key, blended with the slot's address. The raw target is only
ever held in x16 and x17, so a stub never branches through an
unauthenticated pointer loaded from writable memory. On arm64e, name the
stubs section `__auth_stubs`, make stubs 16 bytes, and put stub targets
in `__auth_got`. Fast ObjC stubs load `_objc_msgSend` from `__auth_got`
[10 lines not shown]
[X86][APX] Save R16-R31 in interrupt and no_caller_saved_registers functions (#237109)
x86_intrcc, "no_caller_saved_registers" and anyregcc functions must
preserve every register they modify. With EGPR their save lists
(CSR_64_AllRegs*) did not include R16-R31, so a handler that uses, or
calls something that clobbers, an extended GPR silently corrupts the
interrupted context. For example, a handler reading its interrupt frame
loads it into r16/r17 and returns with iretq without restoring them.
Add CSR_64_APX_AllRegs{,_NoSSE,_AVX,_AVX512}, the AllRegs lists plus
R16-R31, and use them as the save lists when the subtarget has EGPR. The
call-preserved masks are unchanged, so callers keep treating R16-R31 as
clobbered. This stays correct for callees built without EGPR or by other
or older compilers.
Assisted-by: Claude Opus 5.5 <noreply at anthropic.com>
[CodeGen] Make ExecutionDomainFix Generic
Rather than having targets create their own subclass just to override
the register class, push the register class into TRI and have the pass
query that, similar to what we did for BreakFalseDeps.
This makes it easier to port to the NewPM.
Reviewers: arsenm, davemgreen, RKSimon
Pull Request: https://github.com/llvm/llvm-project/pull/238536
[X86][SEH] Emit epilog SEH_Push2Regs in PUSH2 order for unwind v3 (#237829)
For Win64 unwind v3, the .seh_push2regs emitted before an epilog POP2
named the registers in POP2 order. Epilog ops are interpreted like the
prolog PUSH2 they undo, so unwinding from inside the epilog restored the
pair swapped. Emit them in PUSH2 order, matching the prolog (and the
assembler's .pop2reg handling); the epilog can now share the prolog
WODs.
Fixes #231762.
Assisted-by: Claude Opus 5.5
[X86] Port X86IndirectThunks to NewPM
Standard NewPM pass porting. Although we hold the inserters inside the
class given they have state we need to manage appropriately. Inside
unique_ptr given the class definition is local to the implementation.
Reviewers: aeubanks, RKSimon, arsenm
Pull Request: https://github.com/llvm/llvm-project/pull/238487
[NVPTX] Merge declarations of dynamic shared memory (#236582)
If a kernel defines multiple unsized extern shared arrays they always
alias each other. This means they name the start of the same dynamic
shared memory allocation.
LLVM however currently treats these variables as distinct global
variables. This causes alias analysis to incorrectly treat them as
disjoint objects, impacting other compilation passes.
This PR adds a pass that redirects the uses of all such declarations to
one of them, which takes the strongest alignment and the debug info of
each source variable and stays constant only if each merged declaration
is. A declaration listed in llvm.used or llvm.compiler.used keeps its
symbol.
The new pass runs:
1) at the start of the optimization pipeline
[4 lines not shown]
[lldb][Fortran] Addressed feedback about code styling and changed one of the tests to contain different types in arguments and return type, not just integers
[lldb][Fortran] Added llvm RTTI support to FortranFunction, renamed variable names in functions, GetFunctionType static function to get function type pointer and addressed feedback about code style
[HLSL] Migrate pre-commit HLSL CI to Windows (and off Beanz's closet Mac) (#230639)
Pre-commit validation of HLSL and DirectX changes includes a run of
[offload test suite](https://github.com/llvm/offload-test-suite), which
currently executes on a Mac laptop in Beanz' closet. This change updates
the pipeline to run on a self-hosted Windows runner, with software GPU
offload coverage through D3D12 WARP.
The original pipeline was running `check-llvm` and `check-clang` test
groups. Since DirectX has become an official LLVM target this is no
longer necessary. The HLSL & DirectX tests that are included in the
`check-llvm`/`check-clang` groups are already being run by existing
pre-commit CIs.
The pipeline now executes only offload tests suite runtime tests on WARP
and plus the LLVM `dxil-dis` tool tests, which only depend on `llc`,
`llvm-objcopy` and the 'filecheck` tools from the LLVM build.
Fixes llvm/wg-hlsl#477
[lld-macho] Require a 64-bit host for arm64e-auth-pointer.s (#238623)
The test's far.o case needs a 4 GiB zerofill section, but lld keeps
section sizes in size_t, so on 32-bit hosts the section is empty, _far
isn't far, and the expected error never comes. This broke
clang-armv8-lld-2stage. Like dead-strip.s, require llvm-64-bits.
Fixes https://lab.llvm.org/buildbot/#/builders/122/builds/329
Assisted-by: Claude