CodeGen: Simplify def segment extension in shrinkToUses (#242869)
During extendSegmentsToUses, Segments holds only one def segment per
value, and none extend past their block. Live-in segments are kept
separately in LiveIns. To extend a def to a use, find the last segment
starting before the use, check that it starts in the use's block, and
move its end to the use. This replaces extendInBlock, whose general
search and merging of overlapped segments never applies here.
Also combine the per-block live-out and live-in tables into one struct.
llc instructions:u:
CTMark x86_64: -0.07%
CTMark arm64: -0.10%
AMDGPU sample: -0.27%
Largest AMDGPU improvements:
rocprim warp_sort (gfx1100): -1.89%
rocsolver stedc (gfx942): -1.70%
[4 lines not shown]
[lldb-dap] Hide internal options from --help (#243124)
Hide internal options for lldb-dap launcher and debugging options. These
are not stable options and may change in future versions.
[ExecutionDomainFix] Ignore regmasks in early-exit check (NFC) (#242997)
Calls clobber registers in RC with regmasks, preventing the early exit
in functions that do not use them.
CTMark instructions:u geomean (x86_64): O3 -0.05%, ThinLTO -0.03%.
[mlir][OpenMP] Update declare SIMD lowering for upstream APIs
Add the property dictionary required by strict assembly formats and update declare SIMD tests to use canonical property syntax. Use the OpenMP translation helper instead of the removed ModuleTranslation builder accessor.
Co-authored-by: Copilot <223556219+Copilot at users.noreply.github.com>
vmm: release the lock when vrtc_snapshot() fails
The error path of the SNAPSHOT_*_OR_LEAVE() macros jumped past
VRTC_UNLOCK() and returned with the vrtc lock held.
Signed-off-by: Wanpeng Qian <wanpengqian at gmail.com>
Reviewed by: bnovkov, markj, jhb
Sponsored by: keelos.dev
Differential Revision: https://reviews.freebsd.org/D60232
vmm: do not let the RTC's periodic interrupt drift
The callout of the periodic interrupt was rearmed from its handler with
a timeout of one period from the time the handler ran. Each period was
longer than programmed by the latency of the callout, so the interrupt
came at a lower rate than the guest asked for. A guest that counts
these interrupts to keep its time runs slow.
Give the callout absolute deadlines one period apart, as vatpit does.
If a deadline has already passed when it is computed, for instance
after the VM was paused, start again from the current time.
Signed-off-by: Wanpeng Qian <wanpengqian at gmail.com>
Reviewed by: jhb
Sponsored by: keelos.dev
Differential Revision: https://reviews.freebsd.org/D60233
AMDGPU: Update physreg LiveIntervals accurately in SIOptimizeExecMaskingPreRA (#242860)
Instead of dropping the exec/vcc/scc register unit ranges after any
change, remove all physreg defs of the instruction. This fixes the
redundant exec copy fold leaving a stale def in the exec range for
COPY $exec, implicit-def $exec, which was hidden by always
recomputing.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[mlir] Remove forward and friend declarations of non-existent types (NFC) (#242851)
This patch removes forward and friend declarations of classes and
structs that are not defined anywhere in the codebase or do not exist
in their respective namespaces.
Assisted-by: Antigravity
[lldb] Treat calls that do not return as branches when stepping over (#243115)
A Wasm return_call is a call and a barrier, so the breakpoint that
step-over put after it was never reached.
[clang][deps] Flush the in-process module cache on a background thread
The in-process module cache keeps every PCM built during the lifetime of the
dependency scanning service in memory, and flushes them to disk at the end.
Long-running builds that scan many variants of modules (e.g. with different
search paths or macro definitions) accumulate tens of gigabytes worth of
scanning PCMs this way. Moreover, the final flush is single-threaded and
happens after all scanning work is done.
This PR makes the service start a background thread that flushes each PCM to
disk as soon as it's written, and then replaces its in-memory buffer with the
memory-mapped file. Readers of the in-memory buffer keep it alive on their own
(shared ownership), and importers of the freshly built PCM never wait for the
IO, since the file gets written without holding the entry lock. Reads and
timestamps are still served from memory. The final flush is kept, but only
writes PCMs the background thread failed to write. With
`-no-flush-module-cache`, nothing changes.
I tried several approaches, all measured on a scan of the macOS SDK where
[52 lines not shown]
[clang] Extract built PCMs from their container without copying
When a module is built implicitly, the importing instance extracts the AST
file from the module cache's view of the written PCM and stores a copy of it
in its `InMemoryModuleCache`. That's an extra heap copy of every built PCM,
kept alive for the lifetime of the translation unit.
This PR resolves the FIXME by storing a buffer that keeps the written PCM
alive and exposes just the AST file: the `__clangast` section for PCMs
wrapped in an object file (`-gmodules`), or the whole PCM otherwise. The
in-process module cache now shares the memory of its entry with the
importing instance, and the cross-process module cache gives it the
memory-mapped file.
For a regular implicit modules build importing Foundation and friends, this
reduces peak memory footprint from ~150 MB to ~100 MB. For a TU importing
Foundation with `-gmodules` (31 PCMs), the copy increased the peak memory
footprint by 12-17%.
[clang] Use the module cache's view of built PCMs (#242383)
When building a module implicitly, the compiler hands the PCM contents
to
`ModuleCache::write()` and then extracts the AST file from the PCH
container
of its own buffer, storing a copy of it in the `InMemoryModuleCache` of
the
importing instance.
This PR makes `ModuleCache::write()` return a buffer with the written
contents, which the importing instance now extracts the AST file from.
The
in-process module cache returns a buffer sharing ownership of its entry,
the
cross-process module cache returns the written file, read back from the
same
file descriptor it was written through (memory-mapped for all but small
files). This is a prerequisite for storing the module cache's view in
[15 lines not shown]
[ConstraintElim] Address compile-time regressions from getKnownSign. NFC
As a follow-up to PR235159, re-order some of the checks to reduce compile time
impact, and add early bail-outs for ConstantInt's where we can to avoid
KnownBits queries.
(cherry picked from commit feb4e0f5b8d9efe1a206ee932af8035db9f8d616)
Reapply "CodeGen: Create register unit dead defs in slot order (#242577)" (#243143) (#243171)
This reverts commit cf1cd3d96bfbd1f3542c6dd1aef80227bae1d5e3.
Fix conflict with other recent LiveInterval compile time patches.
ipfw: print the log, not the config, for "nat <name> show log"
Add a test too.
Reviewed by: ae
Fixes: d6164b77f8b7 ("Make ipfw_nat module use IP_FW3 codes.")
Found with: Claude Opus 4.8
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D61588
ipfw_nat: fix the buffer length check in IP_FW_NAT44_XGETLOG
nat44_get_log() compared the user buffer length against the request
header plus another ipfw_obj_header instead of the request header plus
the log buffer. A buffer that passed this check but was shorter than
the full reply left too little room in the sockopt window, so
ipfw_get_sopt_space() returned NULL and the following memcpy() of the
log wrote through a NULL pointer, panicking the kernel.
The handler was cloned from nat44_get_cfg() in the commit below, under
the convention of that time where ucfg->size held the payload only and
the ipfw_obj_header was added back in the length check. 9f925e8a920e
("Fix IP_FW_NAT44_LIST_NAT size calculation.") later switched
nat44_get_cfg() to count the header in ucfg->size and reduced its check
to "valsize < size", but nat44_get_log() was not updated. It kept the
stale idiom, whose check counts the header twice, and by coincidence of
the struct sizes that never leaves room for the log.
Compare against the full reply length and check the result of
[18 lines not shown]