[SelectionDAG] Salvage debuginfo when combining load and z|s ext instrs. (#188544)
Reland 2b958b9ee24b8ea36dcc777b2d1bcfb66c4972b6
Salvage debuginfo when combining load and z|s ext instrs.
SelectionDAG uses the DAGCombiner to fold a load followed by a sext to a
load and sext instruction. For example, in x86 we will see that
```
%1 = load i32, ptr @GlobArr
#dbg_value(i32 %1, !43, !DIExpression(), !52)
%2 = sext i32 %1 to i64, !dbg !53
```
is converted to:
```
%0:gr64_nosp = MOVSX64rm32 $rip, 1, $noreg, @GlobArr, $noreg, debug-instr-number 1, debug-location !51
[14 lines not shown]
[CIR][Lowering] Handle address space cast in GlobalViewAttr lowering (#190197)
Upstreaming clangIR PR: https://github.com/llvm/clangir/pull/2099
This PR fixes the GlobalViewAttr LLVM lowering to use AddrSpaceCastOp
when the source and destination address spaces differ.
This fixes crashes when lowering globals referenced across address
spaces, such as AMDGPU globals in addrspace(1) referenced from
llvm.compiler.used arrays.
[DWARFYAML] Begin DWARFv5 debug_line support (#191167)
This patch adds enough support to generate a correct basic v5 header
(llvm-dwarfdump complains it can't find DW_LNCT_path, but I wouldn't say
it's strictly required). Directory and file name counts use relatively
complex encodings, so I'm leaving those for separate patch(es). For now,
I'm hardcoding the relevant fields to zero.
[libc] Implement accept(2) on linux (#191203)
The implementation follows the same patterns as the other socket
functions (this was mostly done using AI).
I've extended the connect test to test accepting connections as well
(and renamed it accordingly).
[DA] Fix overflow of findBoundsALL in BanerjeeTest
Fix signed overflow handling in `findBounds*` for the Banerjee test.
The previous implementation computed bounds using `getMinusSCEV` and
`getMulExpr` without checking for signed overflow, which could produce
incorrect bounds when coefficients have extreme values.
- Add `mulSCEVNoSignedOverflow` helper function that checks for
multiplication overflow before computing the result
- Use `minusSCEVNoSignedOverflow` and `mulSCEVNoSignedOverflow` in
`findBounds*` to safely compute bounds, returning `nullptr`
when overflow would occur
[clang][Serialization] Serialize DiagStateOnPushStack to fix pragma d… (#190420)
**Serialize DiagStateOnPushStack to fix pragma diagnostic push/pop
across PCH boundary**
`DiagStateOnPushStack` was not serialized in PCH files, causing `#pragma
clang diagnostic pop` to emit a spurious "no matching push" warning when
the corresponding push was in the preamble. This is because clangd
splits files into a preamble (compiled to PCH) and the main file body,
and the push/pop stack was lost during the PCH round-trip.
Serialize and deserialize DiagStateOnPushStack in
`WritePragmaDiagnosticMappings`/`ReadPragmaDiagnosticMappings` so that
unmatched pushes from a preamble are correctly restored.
Fixes https://github.com/clangd/clangd/issues/1167
[SSAF][UnsafeBufferUsage] Add APIs to the EntityPointerLevel module for UnsafeBufferUsage
- UnsafeBufferUsage serialization uses EntityPointerLevel's API to
serialize EntityPointerLevels.
- Add APIs to EntityPointerLevel for creating EPLs from Decls and
incrementing EPL's pointer level.
- Improve UnsafeBufferUsage serialization error messages with a test.
[NFC][SSAF] Move EntityPointerLevel to a separate folder
EntityPointerLevel will later be shared with other summaries besides
UnsafeBufferUsage. This commit moves it to a separate file.
[Object] Extract format-agnostic BBAddrMap decoder (#188435)
[Object] Extract format-agnostic BBAddrMap decoder
This is part of patches to port BBAddrMap to COFF.
Move format-agnostic BBAddrMap decode logic out of ELF.cpp into
BBAddrMap.cpp, and expose a shared decodeBBAddrMapPayload helper in
BBAddrMap.h.
Keep ELF-specific steps (section decompression and relocation
translation) in ELF.cpp, and delegate payload decoding to the
shared helper.
Error messages in the decoder are updated to use the generic
"BB address map" instead of the ELF-specific "SHT_LLVM_BB_ADDR_MAP"
since the decoder is now shared across object formats.
This refactor prepares follow-up work to let COFF and ELF share
the same BBAddrMap decoding logic.
[lldb] Fix ScriptedFrame thread member init assignment (#191297)
This patch fixes a typo in the `ScriptedFrame` base class initializer
where we used a thread id with `GetThreadByIndexID` instead of the
thread index.
This could lead to issues where derived classes wouldn't be initialized
properly, which could cause crashes down the line.
The patch addresses the issue by calling `GetThreadByID` with the thread
id.
rdar://174432881
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[MLIR][XeGPU] Add uArch defintion for CRI - Crescent Island (#191024)
XeGPU lowering relies on uArch definition and lowering fails if a chip
does not have uArch definition entry.
Add preliminary uArch definition for CRI.
This is a place holder for now and current defintion is identical to
BMG.
[WebAssembly][GlobalISel] Add legalization & selection of most integer ops (#190234)
Allows many ops/instructions working solely on integers to be fully
selected (legalize, regbankselect, isel).
Split from #157161
Revert "[X86][APX] Add copy instruction to LiveInterval of SrcReg (#191102) (#191330)
This reverts commit 16f02c0940d6ee783c38ca27b44fc158d77e7567.
This caused a bot failure when building with expensive checks.
https://ci.swift.org/job/llvm.org/job/clang-stage1-RA-expensive/job/main/409/testReport/junit/Clang/CodeGen_X86/pr190962_ll/
The test case included in the original commit fails with:
```
| *** Bad machine code: Two-address instruction operands must be identical ***
| - function: foo
| - basic block: %bb.0 (0x7fc688853c40) [0B;192B)
| - instruction: 128B %10:gr64 = IMUL64rm %33:gr64(tied-def 0), %fixed-stack.1, 1, $noreg, 0, $noreg, implicit-def dead $eflags :: (load (s64) from %fixed-stack.1, align 16)
| - operand 1: %33:gr64(tied-def 0)
| fatal error: error in backend: Found 1 machine code errors.
```
[2 lines not shown]
[RISCV][P-ext] Add mul*.h00 and mul*.w00 patterns. (#191313)
The instructions take the low halfword/word from each input, extends
them and multiplies to produce a word/dword result.
We can use these instead of plain MUL if it would allow us to avoid
a sext/zext for at least one of the operands.
Tests were written by Claude Sonnet 4.5.
[llvm-profgen] Read build ID from binary for perfscript address filtering (#190862)
For shared libraries (.so), read the binary's build ID during load()
using object::getBuildID() and store it as FilterBuildID. Main
executables keep FilterBuildID empty, matching the convention that
their perfscript addresses have no buildid prefix.
This enables automatic build ID-based filtering of perfscript
addresses in [buildid:]0xaddr format without requiring a CLI option.
[BOLT] Use identify_magic for shared library detection (#190902)
Replace the fragile filename-based check (ends_with(".so")) with
identify_magic()/file_magic::elf_shared_object to reliably detect
shared libraries when filtering pre-aggregated profile data by
build ID.
Test Plan: pre-aggregated-perf-shlib.test
[orc-rt] Add Session::attach convenience overload. (#191199)
This overload enables one-line attach in the common case where the
ControllerAccess implementation does not require any configuration after
construction.