[MustExecute] Define the block context helpers out of line
They use BasicBlock, which MustExecute.h only declares, so the header
did not compile without precompiled headers.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
MustExecute: Remember the summaries of the last program point queried
isInContextOf looked up the summaries of the program point for every
query, but the queries come in batches for the same program point, e.g.
for all uses of a value in followUsesInContext. Remember the summaries of
the last program point. NFC.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
MustExecute: Look up the blocks of contexts by their number
isInContextOf looked up the block of every queried instruction in a hash
map of the forward context and a hash set of the backward context, which
was a few percent of the full Attributor on large functions. The blocks of
a context are all included except for a prefix of the last block of a
forward context, so keep a bit vector indexed by block number instead,
and the end of the last block. NFC.
CTMark instructions:u with -attributor-enable=full:
O3: -0.74% (sqlite3 -2.22%)
ThinLTO: -1.27% (tramp3d-v4 -4.62%, sqlite3 -2.73%)
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[MustExecute] Fix the memory regression of block number contexts
The previous commit gave every block context a bit vector with a bit for
every block of the function, which takes memory quadratic in the number
of blocks: +110 MB for a switch with 30000 cases. Use a set until the
bit vector is not larger than the list of blocks of the context.
Also assert that the block numbers are not outdated, as DominatorTree
does, and drop the unused SetVector include.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[MustExecute][NFC] Answer context queries with per-block summaries (#243532)
The Attributor explored the must-be-executed context of every program
point with its own iterator: `findInContextOf` walked the context until
it found the instruction, and `followUsesInMBEC` walked the whole
context to collect its conditional branches. In large functions with
many program points this is quadratic.
Add `isInContextOf` and `checkForAllTerminatorsInContext`, which answer
these queries from summaries shared by all program points of a function:
the instructions of each block that may not transfer execution, and the
forward and backward contexts of each block. Use them in the Attributor.
Output is unchanged on CTMark, CGBuiltin and the AMDGPU tests.
`opt` instructions on CTMark bitcode: sqlite3 -35% (attributor-light),
-78% (attributor-light-cgscc), -61% (attributor); tramp3d-v4 -46%
(attributor).
Co-authored-by: Matt Arsenault <Matthew.Arsenault at amd.com>
Assisted-by: Claude Opus 5.5
[libc][math] Collapse the assertFalse call to one line
darker flagged the multi-line split: it fits within 88 columns, so black
collapses it. Fixes the code_formatter check on this PR.
Assisted-by: pi (swift-iq3_xxs via llama-server)
[libc] Move syscall to va_args (#243647)
The `syscall` function takes 1-7 arguments. Previously this was
implemented as a macro that filled in the arguments so that the internal
function could always take 7 arguments. The kernel ignores extra
arguments anyways, so it worked fine. Alas, having a macro named
`syscall` caused problems when people defined variables named `syscall`,
and it's not a reserved name.
This PR moves our syscall to match other implementations, reading all 6
optional arguments from va_args.
Assisted-by: Automated tooling, human reviewed.
pf: Do not report a packet the outbound pass sent as dropped
For route-to on the inbound pass, pf_route() and pf_route6() run the
outbound pass on the new interface themselves and hand it the actions
of the rule. When that pass creates a state, the state has the route-to
as well, so the outbound pass sends the packet and returns PF_PASS
without an mbuf. Since 349360b17eab the caller turns this into PF_DROP,
and the pfil hook returns PFIL_DROPPED for a packet that was forwarded.
ip6_tryforward() then counts an input discard on the receiving
interface for every such packet.
Leave the action at PF_PASS, so that the hook returns PFIL_CONSUMED, as
it does when pf_route() or pf_route6() send the packet themselves.
Extend forward:v6_route_to_discards to rules that keep state.
Reviewed by: kp
Fixes: 349360b17eab ("pf: return errors from pf_route() and ...")
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D61674
Add integration tests for container hostname configuration
container.start only logs a warning if it cannot write the container's
/etc/hostname and /etc/hosts, so check the rootfs after a start, and
after a rename followed by a start.
Resolve container etc paths within the rootfs when setting the hostname
Before a container starts, middleware writes its /etc/hostname and updates
the 127.0.1.1 line of its /etc/hosts.
Look up etc and etc/hosts relative to the container's rootfs, resolving
symlinks as the container itself would, and only read an existing
etc/hosts if it is a regular file of a reasonable size. Unusual rootfs
contents (symlinks, FIFOs, very large files) are now handled predictably.
netinet6: Do not count a packet a hook consumed as discarded in ip6_tryforward()
ip6_tryforward() treats every pfil result but PFIL_PASS as a drop: it
counts a discard on the receiving interface after the inbound hooks and
on the outgoing interface after the outbound hooks. A hook that
consumes the packet returns PFIL_CONSUMED instead: pf sends a packet a
route-to rule matches out itself, and sends a packet it reassembled on
in fragments. Those packets were forwarded, yet netstat -s -I shows
them as discarded, in the outbound case on the interface the route
lookup chose, which route-to did not even use. ip6_forward() and
ip_tryforward() count nothing for a consumed packet.
Return without counting when a hook consumed the packet. The new
forward:v6_route_to_discards test checks both passes. Its rules keep
no state: pf reports a packet it sent from the inbound hook as dropped
when its own outbound pass created a state, and that packet is still
counted.
Reviewed by: kp, glebius, pouria
[4 lines not shown]
netinet6: Decrement the hop limit before the outbound hooks in ip6_tryforward()
ip6_tryforward() decrements the hop limit after the outbound pfil hooks,
whereas ip_tryforward() and ip6_forward() do it before them. The hooks
therefore see a packet one hop older than the one that leaves, and a hook
that transmits the packet itself does not decrement it at all: pf's
route-to and reply-to on an outbound state send it on with the hop limit
it arrived with.
Decrement it right after the check, before the route lookup, as the other
two paths do. Errors sent after that point quote the decremented value,
as they do on those paths.
pf_refragment6() hands the fragments of a forwarded packet it
reassembled to ip6_forward(), which decrements the hop limit again, so
on the slow path such a packet has always lost two hops at this router,
and with this change it would on the fast path as well. Give the hop
back before ip6_forward(), unless ip6stealth is on, in which case
neither path decrements, or the hop limit is 255, which a scrub
[9 lines not shown]
[DirectX] Recover constant leading components when splitting vector operands (#240593)
Recover constant components when splitting vector operands into scalar
DXIL operation arguments.
```diff
collectInsertedElements(vector)
walk insertelement chain to its base
+ initialize scalar components from the constant base
replay inserts, innermost first
```
This allows dead vector-building instructions to be removed instead of
surviving into DXIL IR.
Adds regression coverage for texture coordinates, gradients, offsets,
and texture/buffer store data.
Fixes #235864.
Assisted by: Claude Opus 5.5
netinet6: Keep a pfil-chosen next hop in ip6_tryforward()
When an inbound pfil hook chooses the next hop (ipfw fwd),
ip6_tryforward() looks up the route to it. After the outbound hooks it
decides whether they changed the destination by comparing the packet's
destination with the address it looked up, which is that next hop. The
two differ, so it looks up the route to the packet's destination again
and the fwd rule is lost. ipfw always installs an outbound hook, so
every packet such a rule matches goes the wrong way while
net.inet6.ip6.redirect is 0.
Compare with the destination as it was before the outbound hooks, as
ip6_forward() does.
Reviewed by: pouria
Fixes: 5a1842a2 ("Add ip6_tryforward() - a run to completion ...")
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D61038
[lldb] Find late-registered plugins in Language::ForEach() (#241072)
Currently Language::ForEach() completes its map of language plugins only
on its first call, so it doesn't visit a language plugin that is loaded
later until something calls Language::FindPlugin() for its language.
This patch fixes this by completing the map whenever the list of
language plugins changes.
Assisted-by: Claude
Add integration tests for container hostname configuration
container.start only logs a warning if it cannot write the container's
/etc/hostname and /etc/hosts, so check the rootfs after a start, and
after a rename followed by a start.
[libc] Add ar header (#243964)
The ar header is a GNU extension for archiver utilities. Added for
compatibility.
Assisted-by: Automated tooling, human reviewed.
TableGen: Compute DAGISel pattern sort keys before sorting
The pattern sort recomputed each pattern's complexity, cost and size on
every comparison. Compute them once per pattern instead.
RISCVGenDAGISel.inc tablegen run:
Gigainstructions Gigacycles CPU seconds
Before 61.5 31.4 9.8
After 57.1 (-7.1%) 27.8 (-11.4%) 8.7 (-10.9%)
AMDGPUGenDAGISel.inc tablegen run:
Gigainstructions Gigacycles CPU seconds
Before 94.6 46.1 14.3
After 91.4 (-3.4%) 44.6 (-3.3%) 13.9 (-3.1%)
All 376 tablegen runs in an LLVM build with all targets:
[5 lines not shown]
fixed libssh versions 0.11.2 and up
upstream changed their numbering method and it's not 0.112 but 0.11.2
This will probably not mix well, but at least new vulnerabilities
should not show up as persisting in recent versions that have them fixed
emulators/libretro-np2kai: Add new port
Neko Project II kai is an emulator for the NEC PC-9801 series. This
port builds it's libretro core for RetroArch and other frontends.
WWW: https://github.com/AZO234/NP2kai
PR: 300383