[CIR] Use SymbolUserMap in applyReplacements to fix quadratic behavior (#195883)
applyReplacements() previously called replaceAllSymbolUses() for each
replacement, which walks the entire module every time — O(R × M) for R
replacements and M operations. For C++ programs with heavy template
instantiation (e.g., Eigen), this quadratic behavior dominated compile
time.
Replace the per-replacement module walk with a single SymbolUserMap
built once (O(M)), then use replaceAllUsesWith() which scopes each
replacement to only the actual user operations. The debug-only
verifyPointerTypeArgs helper is also updated to reuse the map.
Measured on Eigen's basicstuff.cpp (356 lines, heavy template
instantiation): compile time dropped from 20m29s to 1m2s (20x speedup).
CIR-to-classic ratio improved from 117x to 7.2x.
Made with [Cursor](https://cursor.com)
Co-authored-by: Cursor <cursoragent at cursor.com>
[CIR] Add pass_object_size hidden parameter support (#191482)
Emit the hidden `i64` parameter that
`__attribute__((pass_object_size(N)))` requires. At call sites the size
is constant-folded when possible (e.g. `&a` → 4) and falls back to
`cir.objsize` / `@llvm.objectsize` otherwise (e.g. VLAs).
On the callee side, `buildFunctionArgList` now creates an
`ImplicitParamDecl` for each annotated parameter so that
`emitBuiltinObjectSize` can load the passed size instead of re-computing
it.
This also fixes the `llvm_unreachable("NYI")` in
`RequiredArgs::getFromProtoWithExtraSlots` and the `errorNYI` in
`appendParameterTypes` / `arrangeFreeFunctionLikeCall` that fired
whenever `hasExtParameterInfos()` was true.
New test: `clang/test/CIR/CodeGen/pass-object-size.c` (CIR / LLVM /
OGCG).
[5 lines not shown]
driver: add Apple SMC driver ported from FreeBSD asmc
Port of the FreeBSD asmc(4) driver to DragonFlyBSD with the following
adaptations:
- kmalloc/kfree instead of malloc/free
- ksnprintf instead of snprintf
- lockmgr() 2-arg form (no whandle)
- taskqueue_start_threads() with ncpu=-1 arg
- sys/bus_resource.h instead of machine/resource.h
- contrib/dev/acpica paths for acpi.h/accommon.h
- u_long instead of rman_res_t
Driver layout: sys/dev/apple/smc/
smc.c - probe/attach/detach, module glue
smc_io.c - ISA port I/O backend
smc_mmio.c - MMIO/T2 backend
smc_sysctl.c - sysctl handlers for fans, temps, SMS, light sensors
smc.h - shared types, macros, prototypes
certctl: Unstickify (un)trusted certificates
Ever since certctl was rewritten in C, the rehash command has reingested
TRUSTDESTDIR / UNTRUSTDESTDIR in addition to TRUSTPATH / UNTRUSTPATH.
This seemed like a good idea at the time but was, in retrospect, a
mistake, as it means a (un)trusted certificate remains (un)trusted
forever (or at least until it expires) even if it is removed from
(UN)TRUSTPATH. Among other issues, it causes ports QA to fail for any
port that either installs certificates or depends on a port that does.
Although this behavior was undocumented, the change may surprise users
who have added certificates manually, so update the manual page to point
it out and add prominent warnings to the trust and untrust commands.
PR: 290078
MFC after: 1 week
Reviewed by: kevans, bcr
Differential Revision: https://reviews.freebsd.org/D56617
[MLIR][XeGPU] Support pointer/dynamic-memref sources in array-length optimization (#195872)
Extend `OptimizeCreateNdDescOp` to handle the two remaining
`create_nd_tdesc` source forms — `i64` pointer and dynamic-shape memref
— by forwarding the existing shape/strides operands through the general
builder. The memory region is unchanged by the rewrite; only the
`tensor_desc` view is narrowed along the FCD and tagged with
`array_length`.
Co-authored-by: Claude Opus 4.7 <noreply at anthropic.com>
clang: Avoid dummy LAST entry in OffloadArch (#195952)
Use this as an alias of the final entry, rather than its
own enum value. This will allow writing covered switches
that don't need to handle this case. This matches how
other places with an end enum entry handle this.
[mlir][acc] Improve implicit deviceptr detection for alias (#195934)
The ACCImplicitData automatically is able to use deviceptr clause when
variable is detected as being device data. However, it was missing check
for own `acc declare deviceptr` attribute.
ahci: add workarounds for Samsung Apple PCIe SSD (0x144d:0x1600)
Add ahci_samsung_apple_attach() following the VIA/ATI/NVidia named-function
pattern in ahci_devices[]. Sets AHCI_F_IGN_FR | AHCI_F_IGN_CR |
AHCI_F_FAST_COMRESET to work around the drive's non-compliant AHCI reset
behaviour on Apple PCIe.
AHCI_F_FAST_COMRESET reduces the three comreset stall sleeps from 1000 ms
each to 10 ms each, so the device comes up without hanging the AHCI init.
[LLDB] Fix UBSan issue with ValueType enums. (#195540)
ValueTypeSyntheticMask, when bitwise OR'd with ValueType enums, produces
a value that is outside the official enum range for ValueTypes. This
causes UBSan errors, when UBSan is set to check enum values. E.g. If you
build LLDB with the Cmake flags
-DCMAKE_CXX_FLAGS="-fsanitize=enum -fsanitize-trap=enum"
-DCMAKE_C_FLAGS="-fsanitize=enum -fsanitize-trap=enum"
Then try to run the LLDB test TestScripedFrameProvider, it crashes with
a SIGILL from UBSan.
This change fixes that by pulling ValueTypeSyntheticMask into the
ValueType enums, expanding the valid enum range and making the bitwise
OR'd values valid.
revert the previous, it broke all the m68k, mips, and powerpc builds.
i had fixed most of the broken ones already, and i think thorpej has
fixed the sun2/sun3 builds that were remaining broken.
[gn] use action() instead of copy() for libcxx headers (#195948)
copy() doesn't handle file deletions. Use an action() that syncs the
output directory with the input list via a response file, removing files
that are no longer in the list.
This works because if files are added or removed, ninja's command line
tracking re-runs the script, and if contents of existing files change,
ninja's input mtime checking reruns it.
This also makes the remove_float_h workaround unnecessary.
Motivated by all the recent header removals in libc++.
clang: Avoid dummy LAST entry in OffloadArch
Use this as an alias of the final entry, rather than its
own enum value. This will allow writing covered switches
that don't need to handle this case. This matches how
other places with an end enum entry handle this.
[SSAF][WPA] Add "no-op" PointerFlow and UnsafeBufferUsage analysis (#193089)
Added 'no-op' PointerFlow and UnsafeBufferUsage analyses to convert
summary data into AnalysisResult, which DerivedAnalysis can then consume.
Also, refactored the PointerFlow and UnsafeBufferUsage serialization
for code sharing.
rdar://174874942
---------
Co-authored-by: Balázs Benics <benicsbalazs at gmail.com>
Co-authored-by: Jan Korous <jkorous at apple.com>