[KnownFPClass] Combine fpext and fptrunc into a shared routine (#225188)
Implements https://github.com/llvm/llvm-project/issues/219847
Partially addresses https://github.com/llvm/llvm-project/issues/219300
Fixes:
- `DenormalMode` handling by `fptrunc`/`fpext`
- `fpext` no longer rules out `qNaN` if the input could be `sNaN`.
Changes:
- `fptrunc` now takes the input/output types.
- `fpext`/`fptrunc` take the `DenormalMode` of the source/destination
types.
I completely rewrote `fpext` and `fptrunc` to use a shared `fpconvert`
routine. Using an approach of starting from `fcAllFlags` and removing
classes instead of starting from `KnownSrc` and adding classes. This
rewrite also improves some deductions for `fptrunc`.
The internal `fpconvert` routine I added should also be able to handle
[13 lines not shown]
X86: Fix inconsistent dead flags when expanding MOV32ri64
The expansion added a live implicit-def of the 64-bit register and
kept the original dead flag on the 32-bit def. The implicit-def is
unnecessary since the 32-bit def covers the same register units.
Drop it, and only mark the 32-bit def dead if the instruction has no
other live def of it, matching what LiveVariables would produce.
Fixes #234931
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[X86][APX] Fix commuting SHLD/SHRD NF, NF_ND and EVEX variants (#233873)
All SHLD/SHRD rri8 variants are marked commutable, but
commuteInstructionImpl only rewrote the legacy and _ND opcodes as SHLD
B, C, I <-> SHRD C, B, (BitWidth - I). The _NF, _NF_ND and _EVEX
variants fell through to the generic commute, which only swaps the
sources and changes the result.
This is reachable when optimizeCompareInstr converts an EFLAGS clobber
to its NF form (e.g. SHLD16rri8_ND -> SHLD16rri8_NF_ND) and RA assigns
the destination to the second source: X86CompressEVEX commutes it to
drop the redundant NDD destination and emits the wrong shift. The
TwoAddressInstruction pass can hit the same bug when commuting the
non-NDD _NF and _EVEX forms.
Assisted-By: Claude Opus 5.5 <noreply at anthropic.com>
[ELF] Parallelize .eh_frame writing. NFC (#235391)
EhFrameSection::writeTo copies CIE/FDE and applies relocations on one
thread, leaving a long single-threaded tail in "Write sections".
Parallelize them, saving ~24ms when linking chromium x86-64.
[ELF] Scan .eh_frame relocations first. NFC (#235389)
.eh_frame is usually the largest item, so one thread scans it while the
others are idle. Hand it out first.
[LLDB] Skip Undef Symbol when resolving ReExportedSymbol
An undef symbol cannot be resolved. Skip it so that a symbol needs no
Resolve can pass. Without this, a symbol that needs no ReExport resolver
can choose the undef symbol incorrectly.
Assisted-by: Claude # Test
[Allocator] Cap MinAlign at alignof(max_align_t) (#235373)
alignof(std::max_align_t) is 4 on NetBSD/i386, whose <stddef.h> defines
max_align_t as a union of void *, long double, and long long.
Fix #230782
[BPF] Disambiguate CO-RE relocation globals (#234252)
The BPF backend encodes the relocation kind, local value and access path
in a global name. Type names such as `S<ns::Arg$>` can contain both
delimiters. Decode the fixed suffix from the right in instruction
folding and BTF emission. This fixes the compiler crash reported in
#233947.
Within a module, different debug types can produce the same name. A
pointer access and a 32-bit field-offset query can also have the same
name with different load types. Reuse an external relocation global only
when its debug root and load type match. Put any discriminator before
the suffix so both consumers read the original relocation.
Assisted-by: OpenAI Codex
[libunwind] Support extended amd64 segment registers (#229176)
Raise the amd64 DWARF register limit to 59 and add RFLAGS, all six
segment selectors, FS.base, and GS.base to the register model. Capture
the extended state and restore it when resuming, using sigreturn() on
FreeBSD to restore selectors and bases together. Pack the state into the
existing context buffers without changing their public sizes or the
Windows XMM offsets.
Add tests for register access, signal-frame CFI recovery, register
bounds, and resume behavior.
Assisted-by: GPT
[lldb][bazel] Add targets for the remaining unconditional plugins (#235325)
CMake builds these plugins on every host, but the Bazel overlay had no
targets for them:
- PluginABILoongArch
- PluginDynamicLoaderFreeBSDKernel
- PluginPlatformAIX
- PluginPlatformFreeBSD
- PluginPlatformNetBSD
- PluginPlatformOpenBSD
- PluginTypeSystemClike
I also added these to the DEFAULT_PLUGINS list.
For now, I'm still leaving out plugins that CMake only builds with an
optional dependency or on a specific host:
- ProcessFreeBSDKernelCore (FreeBSD hosts, libkvm)
[8 lines not shown]
[MemorySSA] Remove unused functions (NFC) (#235374)
Remove MemoryPhi::unorderedDeleteIncomingValue, upward_defs and
ClobberWalker::const_def_path, which have no callers, together with the
const_def_path_iterator alias only used by const_def_path.
[LAA] Avoid division by zero for zero-sized access types. (#235372)
Zero-sized access types lead to divide-by-zero in getStrideFromAddRec.
Bail out if that would be the case.
[libunwind] Unwind through AArch64 FreeBSD signal trampolines (#235065)
Retried from https://reviews.llvm.org/D155066.
Recognize signal trampolines using KERN_PROC_SIGTRAMP when unwind
metadata is unavailable. Restore the interrupted PC, LR, SP, general
registers, and valid floating-point registers.
Add coverage for unwinding out of an interrupted leaf function on both
regular and alternate signal stacks.
Assisted-by: GPT
[RISCV][TTI] Multiplication is high-cost without M extension (#235363)
This fixes a regression exposed in a future patch that came up when
working on LSR where suddenly we were emitting a multiplication libcall
in a test that didn't specify having the M extension because LSR thought
it was cheap.
I don't think lacking an M extension is common, but this is a pretty
small change and probably helps people compiling code to RISCV on really
small/cheap cores.
Assisted-by: LLM
[LLDB] Exclude exposed exe symbols from tests (#228645)
Same as what we have for normal lldb installation. A executable may
creates a copy of a symbol if it links to the archive. Exclude archive
symbols out from the exe itself.
[LLDB][FreeBSD] Fix file not exists detection (#235358)
A process can outlive the exact running binary inside. As a result, a
file fails to query should set unknow by default.
[AVR] Fix byte spills and stack args on AVRTiny
AVRTiny cores have no load/store with displacement, yet 8-bit spills,
reloads and stack arguments in functions without a reserved call frame
were still emitted as STDPtrQRr/LDDRdPtrQ. llc then aborted in the
AsmPrinter, so any function that spilled a byte failed to compile, also
with the default register allocator and at -O0, and builds without
assertions silently emitted std/ldd instead.
Expand both instructions on AVRTiny the same way as their 16-bit
counterparts: a plain st/ld when the displacement is zero, as it always
is for spill slots, and pointer adjustments around it otherwise.