RuntimeLibcalls: Only provide fp128 long double libcalls when long double is fp128
The l-suffixed long double math functions (e.g, acosl, sqrtl, ...) are fp128 only
when the target's long double is fp128. The default set provided them on every
target that was not x87 or ppc_fp128, so targets using double as long
double wrongly reported the fp128 l-suffixed functions.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[lldb] Remove duplicate declarations after merge (#214949)
I'm not sure why Git decided to add two duplicate declarations when
merging #212015, but this removes the duplicate ones.
[lldb] Allow multiple ABI runtimes for C++ (#212015)
This allows `CPPLanguageRuntime` to contain more than one ABI runtime.
For dynamic types, we ask each runtime if it knows how to deal with a
vtable symbol. For exception breakpoints, we will create all
breakpoints. Note that the MS ABI will only be added on Windows targets.
So the MS ABI will not be added to `m_abi_runtimes` on other targets.
[clang][CIR][docs] Fix invalid MyST toctree 'numbered' option (#213898)
Similar to #207217
The RST-to-Markdown migration (#206181) converted the RST flag
`:numbered:` into `:numbered: true`.
MyST parses the toctree `numbered` option as `int_or_nothing`, so the
string `true` fails with:
```
'toctree': Invalid option value for 'numbered': true:
invalid literal for int() with base 10: 'true'
```
This breaks the `-W` (warnings-as-errors) `docs-clang-html` build. Make
`numbered` a valueless flag, which MyST accepts (equivalent to the
original RST behavior of numbering all levels).
[lldb] Move dynamic type cache to common ABI runtime (#212014)
Both the Itanium and the MS ABI want some cache for dynamic types. This
moves the functionality from the Itanium ABI to the base class.
[IR] Set Number of Hungoff Uses after allocation (#213304)
If allocation of the Use[] in allocHungoffUses fails (e.g. due to OOM),
it may happen that the destructor of User is called with NumUserOperands
> 0. Then `Use::zap` tries to destruct Uses that were not constructed in
the first place.
Example scenario for SwitchInst:
`SwitchInst::init()` is called, which means the constructor of the
parent class User went through successfully, which means the destructor
of User will be called eventually. If now `SwitchInst::init()` calls
first `setNumHungOffUseOperands(2)` and then `allocHungoffUses()` and
the allocation there fails, `~User()` is called and tries to destruct 2
Uses, which can lead to problems.
This patch consequently ensures that first the allocation happens and
then NumUserOperands is set accordingly, so that this problem is
prevented.
[CostModel][X86] Update logic vector reduction costs to match llvm-mca estimates (#214191)
Replaces the olds costs which were just instruction counts
Still working on the bool reduction costs - these will be handled in a followup
[NVPTX] Add Rubin extensions to tcgen05.commit (#211577)
The Rubin architecture extends `tcgen05.commit` operations with two
additional features: support for 32-bit CTA multicast masks and the
ability to track completion of Matrix A reads from shared memory for all
prior `tcgen05.mma` operations.
This change adds support for these features to the `tcgen05.commit`
intrinsics. In addition, it also replaces generic/shared variants with
overloaded intrinsics.
[mlir][wasm] Support for saturating FP truncations (#212709)
Add support for saturate truncation of float to int operations.
This also requires the support of parser with sub-opcodes.
This is handled by supporting parser with extra argument for sub-opcode.
---------
Co-authored-by: Ferdinand Lemaire <ferdinand.lemaire at woven-planet.global>
[libclc] Add math smoke test for cos special values (#214786)
Summary:
Basic math version of unit tests used to give reference for how these
can test the known special values. SImilar to LLVM libc's smoke math
tests on the GPU. More can be added later,
[libc++] Include range access headers in `<optional>` only since C++26 (#214688)
Inclusions of internal range access headers address LWG4131 which
patches P3168R2 "Give `std::optional` Range Support". As P3168R2 is
certainly a new feature in C++26, these includes are unnecessary in old
modes.
It was reported that these increased the size of `<optional>` by ~8%, so
probably it is better to avoid such cost in old modes.
[NVPTX] Drop cache hints on volatile loads/stores (#214830)
https://github.com/llvm/llvm-project/pull/204067 added cache hint
metadata support for NVPTX. I forgot to handle volatile loads/stores
correctly. Volatile loads only support .level::prefetch_size and
volatile stores don't support any cache hints. This PR drops unsupported
metadata for volatile loads/stores.
[libclc][test] Update cos.cl checks after fneg FP-options fix (#214906)
ceaff22ed2c3 ([Clang][CodeGen] Respect FP pragma options for fneg and
calls) scopes fneg's fast-math flags to the expression's own FPOptions
instead of the ambient IRBuilder state, so one fneg in cos.cl's
generated IR no longer carries contract. Regenerate check.
Co-authored-by: Claude Sonnet 5 <noreply at anthropic.com>
[Driver][KCFI] Forward -fsanitize-kcfi-hash= to cc1 (#214827)
-fsanitize-kcfi-hash= is a CC1Option that selects the hash algorithm
used to derive KCFI type IDs (xxHash64 or FNV-1a), but the driver never
claimed or forwarded it. As a result, invocations like
clang -fsanitize=kcfi -fsanitize-kcfi-hash=FNV-1a foo.c
silently dropped the flag with an "argument unused during compilation"
warning; users had to route it through -Xclang to reach cc1. This is
particularly awkward for build systems (e.g. the Linux kernel) that want
to select FNV-1a for -fsanitize=kcfi builds.
Handle the option in SanitizerArgs alongside -fsanitize-kcfi-arity:
capture the last-specified value when KCFI is enabled and forward it to
cc1 as -fsanitize-kcfi-hash=<value>. Values are still validated by cc1's
tablegen-driven Values<"xxHash64,FNV-1a"> checker, so bad values produce
the usual "invalid value" diagnostic. When -fsanitize=kcfi is not
specified, the flag remains unclaimed and triggers
[9 lines not shown]
[MC] Make pseudo-probe divisions ordering stable (#214803)
**Problem**
`MCPseudoProbeSections::emit` sorts probe divisions only by section
ordinal.
Functions sharing a section will have a nondeterministic `unordered_map`
iteration order, producing *different .pseudo_probe bytes for identical
inputs.*
**Solution**
Use the function symbol name as a stable tie-breaker when section
ordinals match.
Add an MC regression test that reverses pseudo-probe insertion order and
requires byte-identical object files.
[4 lines not shown]
[RISC-V] Use an optional offset operand instead of zero-offset InstAliases
Introduce OptionalMemOffsetAsmOperand, which wraps a memory-offset
operand class into a variant with `IsOptional` set so that a memory
operand written without an offset, e.g. "lb a0, (a1)", parses with a
default offset of 0, and use it for a simm12_lo_optional operand. This
replaces the hand-written "(${rs1})" zero-offset InstAlias that every
load/store-style instruction needed (scalar and FP loads/stores, Zilsd,
jr/jalr and the .insn_i/.insn_s memory forms).
OptionalMemOffsetAsmOperand is somewhat complicated, but this makes it
easier to replace all the other optional zero memory operands which I
will do in follow-up commits, removing all the InstAlias duplication.
This change was assisted by AI.
Pull Request: https://github.com/llvm/llvm-project/pull/210901
[BOLT] Page out .dwo files
Split-DWARF inputs at big binaries scale ship 100+ GiB of .dwo
files. BOLT opened a fair number of them during readDebugInfo, putting
a lot of pressure on the OS memory management: mmap'd reads always
populate the page cache; with every .dwo mapped at once those pages
accumulated, refaulted, and registered as memory pressure that got the
process oomd-killed.
Now, .dwo page-cache pages are reclaimed as soon as BOLT is done with
each file: madvise(MADV_PAGEOUT) on the live mapping, then
posix_fadvise(POSIX_FADV_DONTNEED) once it is unmapped. Controlled by
-drop-dwo-page-cache, OFF by default, as it is unlikely upstream
will be processing gigantic sets of dwo files.
[BOLT] Create and release .dwo DWARF contexts incrementally
BOLT opened a DWARFContext for every .dwo during
readDebugInfo and kept them all alive until teardown. On large
split-DWARF targets that is tens of GiB held resident through
emission, the point of peak RSS.
Make the DWOCUs map a lazily-populated cache instead:
* Use the newly added DWARFUnit::clearDWO()/hasDWO() to directly
manage DWARFUnit's DIE caching mechanism.
* BinaryContext::getDWOCU() opens a context on demand (keyed off a
stable DWOId -> skeleton CU map).
* Release contexts as soon as they are done with: all of them at the
end of readDebugInfo, and per-bucket at the DWARF rewrite merge
point.
* Remove DWOCUs map, which became redundant and whose purpose can
now be served by the new id-to-skeleton map, and then fetching
the split CU from the skeleton via getNonSkeletonUnitDIE().
[5 lines not shown]