[SelectionDAG] Optimize 32-bit udiv with 33-bit magic constants on 64-bit targets (#181288)
This PR optimizes 32-bit unsigned division by constants when the magic
constant is 33 bits (IsAdd=true case in UnsignedDivisionByConstantInfo)
on 64-bit targets.
## Overview
Compiler optimization for constant division of `uint32_t` variables
(such as `x / 7`) is based on the method
proposed by Granlund and Montgomery in 1994 (hereafter referred to as
the GM method).
However, the GM method for the IsAdd=true case was optimized for 32-bit
CPUs, not 64-bit CPUs.
This patch provides optimizations specifically for 64-bit CPUs (such as
x86_64 and Apple M-series).
A simple benchmark demonstrates over 60% speedup on both Intel Xeon and
Apple M4 processors.
[66 lines not shown]
[clang][Dependency Scanning] Fix the In-Memory Buffer Used for By-Name Scanning (#183396)
This PR fixes two issues of the in-memory buffer we use for the input
file when a dependency scanner performs by-name queries.
First, it renames the buffer. The temporary file was named
`ScanningByName-%%%%%%%%.input`, which leads to weird diagnostics such
as
```
ScanningByName-2d42a1e9.input:1:1: fatal error: could not build module 'X'
```
This PR changes the name of the file buffer, so we get diagnostics such
as
```
module-include.input:1:1: fatal error: could not build module 'X'
```
which is more indicative.
[10 lines not shown]
[lldb] Use range-based for loops over plugins (#184837)
This PR replaces the Get*CallbackAtIndex pattern in the PluginManager
with returning a snapshot of callbacks that the caller can iterate over
using a range-based for loop. This is a continuation of #184452 which
added thread safety by using snapshots. However, that introduced a bunch
of unnecessary copies which are largely eliminated again by getting the
snapshot once when gather all the callbacks, rather than doing that on
each iteration when querying a plugin for a given index. It also
eliminates the possibility of the snapshot changing underneath you when
iterating over the plugins.
This change was largely mechanical and I used Claude to do the menial
work of updating the signatures and call sites.
[clang-doc] Introduce Serializer class
Serialization has mostly been done with static functions, but soon we
will need to share state, like alocator references. To avoid blowing up
our parameter lists, we can just wrap the local functions within a
class.
[clang-doc][NFC] Introduce Vector and Array abstractions
Introduce OwningVec and OwningArray aliases for vector types we want to
eventually update for arena allocations.
[clang-doc] Introduce abstractions for pointer operations
Since we're migrating from std::unique_ptr to raw pointers via
arena allocation, we want to have some interfaces that abstract
these operations away, and can be changed to keep the system working
without introducing a lot of unnecessary chrun in the code.
[clang-doc][NFC] Introduce OwnedPtr abstraction
Eventually, we want clang-doc to support arena allocation, but the
widespread use of owning pointers in the data types prevents this.
Rather than have wide scale refactoring, we can introduce a type alias
that can be swapped out atomically to switch from smart pointers to raw
pointers. This is the first of several refactorings that are intended to
make the transition simpler.
[clang-doc] Introduce type alias for OwningPtrVec/Array
We commonly have vectors/arrays of owned pointers. This should simplify
future refactoring when switching to arena allocation.
[HWASan] add optimization remark for supported lifetimes
This lets us find functions where we pessimize codegen by removing
lifetimes.
Reviewers: vitalybuka
Reviewed By: vitalybuka
Pull Request: https://github.com/llvm/llvm-project/pull/183858
[HLSL][Matrix] Make matrix truncation respect default matrix memory layout (#184280)
Fixes #183127 and #184371
This PR makes the matrix truncation cast implementation use the new
matrix flattened index helper functions introduced by #182904 so that it
reads elements from the source matrix using the default matrix memory
layout instead of always assuming column-major order.
This PR also fixes a bug where matrix truncation truncated the wrong
elements.
Assisted-by: claude-opus-4.6
NAS-140179 / 27.0.0-BETA.1 / Introduce typed event source (#18396)
## Context
Introduce `TypedEventSource` which to the `run` body gives access to the
pydantic model itself which should be used so we can statically type
check properly arguments.
17900 svc/configd: format issue while printing pid_t
Reviewed by: Gordon Ross <Gordon.W.Ross at gmail.com>
Approved by: Dan McDonald <danmcd at edgecast.io>
[CIR] Fix operator-precedence bugs in assert conditions
Due to && binding tighter than ||, asserts of the form
assert(A || B && "msg") always pass when A is true. Add
parentheses so the string message is properly attached:
assert((A || B) && "msg").