[orc-rt] Add IntervalMap::overlaps. (#248794)
IntervalMap::overlaps(KS, KE) returns true if [KS, KE) overlaps any
range in the map. An empty query range [P, P) overlaps only ranges that
strictly contain P, matching ExecutorAddrRange::overlaps.
IntervalMap will be used in upcoming patches that register memory
ranges, and the overlaps operation will allow us to verify that new
registrations don't overlap old ones.
[clang][Sema] Handle length modifiers with OpenBSD kernel printf %b (#120689)
The OpenBSD kernel printf %b takes a length modifier, like %x, and
reads the value with the type it gives. sparc64 has various %llb
formats. Check the length modifier and the value type for %b when
targeting OpenBSD. FreeBSD %b only takes an int, so it stays as is.
Assisted-by: Claude Opus 5.5
[Mips] Preserve filled delay slots in inline asm division macros (#233235)
In reorder mode, wrap branches whose delay slots an expansion fills
itself in .set push/noreorder/pop, so the textual output (e.g. inline
asm) doesn't get a second delay slot when assembled again. Also fill the
mulo/mulou overflow check delay slot in noreorder mode, like div already
does.
As @brad0 remind, for abs on main branch current we will also get the
wrong code: bgez gets an extra nop, and the hardcoded offset lands on
neg. After this pr, it will also be fixed.
Fixes #174909
LoongArch: Use LastSubtargetCache in getSubtargetImpl
Migrate to use the new common infrastructure and pattern which caches
based on the last used subtarget.
Assisted-by: Claude
clang: Decide always-inline definitions from the GlobalDecl
SetLLVMFunctionAttributesForDefinition decided whether to add optnone and
noinline partly by reading back alwaysinline attributes that were added
earlier, by the destructor body for -fapple-kext and for OpenCL kernel
stubs just before the call. Pass the GlobalDecl instead of the Decl, and
decide both from the declaration and the destructor or kernel reference
kind.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[ORC] Add empty DarwinPlatform, enable it in llvm-jitlink. (#248735)
DarwinPlatform is intended to be an eventual replacement for
MachOPlatform, and the first in a series that will see ELFNixPlatform
and COFFPlatform similarly replaced. The older versions will be left
in-place for the time being, until the old ORC runtime can be deprecated
and removed.
AMDGPU: Make the anti-hints rule table constexpr
The rule table was a function-local static SmallVector, built on first
use and destroyed at exit. This caused corruption with multithreaded
compiles. Build a constexpr table instead.
Assisted-by: Claude
[lld][ELF][SPARC] Support R_SPARC_TLS_DTPOFF32/64 in non-alloc sections (#248653)
GCC, and now clang, use %r_tls_dtpoff32/%r_tls_dtpoff64 in .debug_info
for the location of thread-local variables. Resolve them as R_DTPREL,
the offset within the TLS segment (SPARC uses no DTV bias).
Assisted-by: Claude Opus 5.5
[llvm-ifs] Handle STB_GNU_UNIQUE ELF symbols (#241122)
Add an optional "Unique: true" symbol attribute to the IFS text format
for STB_GNU_UNIQUE ELF bindings and bump IFSVersionCurrent (and Clang's
-emit-interface-stubs output) from 3.0 to 3.1 while preserving backward
compatibility with existing 3.0 IFS files.
When generating ELF stubs, emit STB_GNU_UNIQUE for unique symbols and
set EI_OSABI to ELFOSABI_GNU whenever any symbol uses "Unique: true"
(keeping ELFOSABI_NONE otherwise) so static linkers handle resolution
directly.
Also reject symbols specifying both Weak and Unique, handle Unique and
major-version mismatches symmetrically when merging IFS files, diagnose
unsupported exported ELF bindings, and update unit and lit tests.
Assisted by Gemini.
vmm: Fix double free with devmem_create_cdev error
devmem_create_cdev() does not allocate name storage and should not free
it in the error path. It is already freed by the caller on error.
Reviewed by: markj
Fixes: cef5f43f819c
MFC after: 1 day
MFC to: stable/15
Differential Revision: https://reviews.freebsd.org/D61529
[RISCV] Rematerialize vmset.m and vmclr.m (#248627)
PseudoVMSET_M_* and PseudoVMCLR_M_* only take an AVL and SEW operand and
have no passthru, so they can be rematerialized like vmv.v.i and vid.v.
The pseudo's SEW/LMUL ratio is fixed by its opcode, so recomputing it
with the same AVL produces the same VL, and mask results are tail
agnostic.
Assisted-by: Claude
[LoopIdiom] Give a strlen formed in a funclet its funclet bundle (#246787)
When a strlen or wcslen loop is in a Windows EH funclet, the call that
replaced it had no "funclet" operand bundle. WinEHPrepare then treats
the call as implausible and makes the rest of the funclet unreachable,
so a catch handler with such a loop traps as soon as the string isn't
empty. Add the bundle of the preheader's funclet, as the inliner does,
and leave the loop alone if the preheader isn't in exactly one funclet.
Assisted-by: Claude Opus 5.5 (Anthropic)
[LangRef] Specify vp.strided.{load,store} is byte aligned
https://github.com/llvm/llvm-project/pull/241715 clarified in llubi that the individual lane accesses of a strided load/store are byte aligned, and that the align attribute is only applied to the base pointer. This matches how e.g. the attributor propagates the align attribute.
Update the LangRef to reflect this, and whilst we're here convert the example to opaque pointers.
[C++20] [Modules] Touch members for dtor (#248767)
Close https://github.com/llvm/llvm-project/issues/246162
The root cause of the problem is, some member of
the base of the dtor is omitted in reduced BMI.
The corresponding fix is to touch them for dtor in reduced BMI.
Assisted by AI.
[lldb] Move PlatformWasm::FindFreeTCPPort to TCPSocket::FindFreePort (NFC) (#248693)
Move the free-port lookup out of the wasm platform so other platforms
can use it.
Broken out from PR #243197 after feedback
Assisted-by: Claude Code using Opus 5.5
Co-authored-by: Michael Georgariou III <georgariou at apple.com>
[Flang] Use simple summation by default at all optimization levels
Add a scope option to SimplifyHLFIRIntrinsics and adjust the pipeline to
enable SUM expansion at -O0 while keeping other intrinsic expansions
conditional on array expression optimization. This makes simple
summation the default for SUM expansion across optimization levels.
Previously, floating-point SUM used the runtime's Kahan summation at
-O0, whereas -O1 and higher generally generated loops with simple
sequential addition. This expansion substituted a different algorithm
rather than inlining the runtime implementation, causing numerical
results to depend on the optimization level.
Add -fcompensated-sum to preserve the runtime's compensated algorithm
for REAL and COMPLEX SUM. When enabled, exclude SUM from HLFIR intrinsic
simplification and prevent SimplifyIntrinsics from replacing real SUM
runtime calls with uncompensated reduction loops.
Fixes #176282
[3 lines not shown]
Attributor: Fix inverted liveness lookup in checkForAllInstructions
attributor is 0.1-2.0% and attributor-cgscc 0.1-1.0% faster on CTMark
sources (callgrind).
Assisted-by: Claude
DAG: Don't zero a mostly empty CSE map on every clear
CSEMap never shrinks, so after one large block, clearing it zeroes a
large table even for small DAGs. Mesa hits this since it compiles many
functions with one pass manager.
Add a FoldingSetBase::clear() overload that takes the set's nodes and
zeroes only their probe chains. Use it when CSEMap is less than an
eighth full.
Compile time of radeonsi shader-db shaders: -1.0% (-0.9% cycles).
CTMark instructions:u: +0.01% (-O3), +0.003% (-O0 -g).
Assisted-by: Claude
[lldb][NFC] Don't copy the name index map in Symtab::FindFunctionSymbols (#248745)
GetNameToSymbolIndexMap() returns a reference, but `auto map = ...`
copied the whole UniqueCStringMap for each base name, method name or
selector lookup, which can be millions of entries for a large binary, to
read a few matches.
assisted-by: claude