[AMDGPU][GlobalISel] Pre-commit tests for split s.buffer.load offset overflow
Add divergent-offset ptr.s.buffer.load tests where the 256- and 512-bit
loads are split into 128-bit pieces at an offset of 4092, causing
overflow on the immediate field.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[AMDGPU][GlobalISel] Fix immediate offset overflow when splitting s.buffer.load
When we're splitting a very large (>128 bit) s.buffer.load into
128-bit buffer loads, we add offsets to each split load. Currently,
when dealing with ptr.s.buffer.load, the code wouldn't subtract enough
from the immediate offset, so that when we added that +128 or +256,
we'd overflow the 12-bit immediate, causing silent overflow.
This commit fixes the issue by correctly calling the offset
splitter with a "alignment" that ensures that all those intermediate
loads don't overflow.
This matches the behavior in SDag and RegisterBankInfo.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[AMDGPU] Reduce resource align when shrinking buffer loads
Since the `align` on buffer intrinsics includes the offset argument,
the demand, `simplifyAMDGCNMemoryIntrinsicDemanded` needs to account
for the value added to that offset, which might reduce the alignment
of the load.
AI disclosure: Claude wrote the code, I looked at it and wrote the
commit message.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[AMDGPU] Pre-commit tests for buffer load shrinking with align
Buffer load demanded elements analysis isn't shrinking the `align`
annotated on the intrinsic correctly.
AI disclosure: Claude wrote these, I wrote this message
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Attributor: Preserve the function analyses in the light module pass (#240714)
AttributorLightPass preserved FunctionAnalysisManagerCGSCCProxy, which
is meaningless for a module pass, instead of
FunctionAnalysisManagerModuleProxy. When the pass changed anything,
the module proxy was invalidated, which clears all cached function
analyses, so e.g. IPSCCP recomputed the assumption cache, TTI and TLI
of every function. The pass neither adds nor removes functions, and it
already invalidates the analyses of the functions it changes.
CTMark instructions:u with -attributor-enable=light changes by O3
-0.02%,
ThinLTO -0.10% (kimwitu++ -0.50%, sqlite3 -0.38%).
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[libc][test] Align custom matchers with GoogleMock (#240616)
LibcTest custom matchers implemented stateful match(T) and
explainError()
methods writing directly to tlog, whereas GoogleMock's polymorphic
is_gtest_matcher protocol expects const MatchAndExplain(T,
MatchResultListener *), DescribeTo, and DescribeNegationTo methods.
Add a hermetic MatchResultListener wrapper around TestLogger in
LibcTest.h, allow the GoogleTest/GoogleMock hook method names in
libc/.clang-tidy, and update custom matchers across libc/test and
libc/utils to implement MatchAndExplain(..., MatchResultListener *)
const
so they work directly with GoogleMock's EXPECT_THAT and ASSERT_THAT
without macro redefinitions.
Part of #91630
Assisted-by: Gemini
[SimplifyCFG] Fix and improve code size check when merging switches into predecessors (#240837)
The function `isValueEqualityComparison` had a surprising check
`incoming_edges * outgoing_edges < 128` to prevent code size explosion.
However it had two issues:
- The function was used in a few places that didn't need the check.
- It only considered `switch`, so conditional `br` wasn't considered.
Move the check to the only place where it's needed, and make it check
conditional `br`s as well. A conditional `br` is not different than a 2-way
switch, so it doesn't make sense to distinguish them.
Also fix the function documentation.
The function becomes easier to understand as it now does what it advertises: if
the instruction is a value equality comparison it returns the value being
compared. (with no surprise checks)
[7 lines not shown]
[CIR] Make cir.condition exit to the loop, not to itself
The loop-exit successor of `cir.condition` was
`RegionSuccessor(getOperation())`, which names the condition op instead
of the loop around it. An operation successor names the op that control
resumes after, and the loop's own `getSuccessorRegions` names the loop
for the same edge. MLIR's dataflow analyses use that op. DeadCodeAnalysis
recorded the exit as a predecessor of the point after `cir.condition`, so
dense analyses never saw control leave a `cir.while`, `cir.for` or
`cir.do` without a cleanup region. The forward state after such a loop
kept its initial value, and the backward state at the condition ignored
the code after the loop. The fix names the loop. The control-flow unit
test hid the mismatch because it compared op and terminator successors
by region only. It now compares whole successors, so it fails without
the fix.
Assisted-by: Claude Code (claude-opus-5-5).
Attributor: Don't copy the triple to check for GPUs (#240718)
AA::isGPU and the GPU address space helpers copied the module's target
triple on every call, unnecessarily allocating a string.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Attributor: Reserve the initial worklist of the fixpoint iteration (#240723)
CTMark instructions:u with -attributor-enable=light changes by O3
-0.02%,
ThinLTO -0.02%. attributor-light is 0.3-1.0% faster.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
acpi_video: dim the internal panel while the lid is closed
Register an acpi_lid_event consumer that saves the current _BQC level and
drives _BCM to the lowest level _BCL offers when the lid closes, putting
the saved level back when it opens. Only an output already classified as
an internal panel is touched, and only a level this handler dimmed is
restored, so a brightness change made while the lid was shut survives.
Disabled by default; set hw.acpi.video.lid_blank=1 to enable.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D60827
acpi_video: fall back to _BCL when _DOD matches no output
vid_enum_outputs() only registers a child whose _ADR appears in the
graphics controller's _DOD. _DOD is filled in from the graphics driver's
ACPI opregion on some platforms, so with no such driver attached it can
describe no device at all while the panel still implements _BCL, _BCM and
_BQC. The match then fails for every child and the machine is left with
no brightness control.
Fall back to registering the first child that implements _BCL when _DOD
matched nothing, so such a machine gets a working
hw.acpi.video.lcd0.brightness and the brightness keys that ride on it.
MFC after: 1 week
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D60826
[CIR] Make cir.condition exit to the loop, not to itself
The loop-exit successor of `cir.condition` was
`RegionSuccessor(getOperation())`, which names the condition op instead
of the loop around it. An operation successor names the op that control
resumes after, and the loop's own `getSuccessorRegions` names the loop
for the same edge. MLIR's dataflow analyses use that op. DeadCodeAnalysis
recorded the exit as a predecessor of the point after `cir.condition`, so
dense analyses never saw control leave a `cir.while`, `cir.for` or
`cir.do` without a cleanup region. The forward state after such a loop
kept its initial value, and the backward state at the condition ignored
the code after the loop. The fix names the loop. The control-flow unit
test hid the mismatch because it compared op and terminator successors
by region only. It now compares whole successors, so it fails without
the fix.
Assisted-by: Claude Code (claude-opus-5-5).
interfaces: introduce DAD sleep for 6to4/6rd trackers; closes #11179
Add the sleep in the fringe cases only and consolidate the wait
as + 2 to simplify and make it more reliable.
[SPIR-V] Emit OpName for kernel parameters from kernel_arg_name metadata (#240766)
clang discards IR value names, so parameter names were lost in some
cases
axgbe: bound the sysctl parser writes in get_val()
Reject tokens and option counts that exceed the fixed parser buffers,
and fix the terminating NUL offset. Have the sysctl handlers propagate
parser errors before applying settings.
Handle SYSL_U32 options and reject failed numeric conversions instead of
using an uninitialized value. Fix the duplex case falling through to an
error, and initialize the link-setting strings for unexpected speeds.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61339
axgbe: return positive errno values from the sysctl handlers
Return positive errno values from the FreeBSD sysctl handlers so that
userland reports the proper error instead of "Unknown error: -22".
Convert the negative phy_config_aneg() result at the sysctl boundary,
matching axgbe_if_media_change(), and retain the PHY code's internal
error convention.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61400
[alpha.webkit.NoDeleteChecker] Handle lambdas and implicit destructors (#240297)
TrivialFunctionAnalysisVisitor had no VisitLambdaExpr, so every
LambdaExpr fell through to VisitStmt and was rejected. Any lambda
written inside a nodelete function was reported, even one as harmless as
callLambda([&] { obj->doTrivialWork(); });
The existing deleteInLambda tests passed only because everything failed.
Add VisitLambdaExpr. The capture initializers do run where the closure
is created, so visit them. The body does not, but a closure that could
destruct an object is not safe to hand out from a nodelete function
either, so check it too -- visiting it directly rather than through
IsFunctionTrivial, since the body is written inside the function being
analyzed and the blame belongs on the offending statement rather than on
the whole lambda. A generic lambda's own body is a dependent pattern
with unresolved calls, so walk the instantiated operator()
specializations instead; one that is never instantiated cannot destruct
[21 lines not shown]
pwd_mkdb: validate login names
vipw(8) never looked at names, it just hands the file to pwd_mkdb,
and pwd_mkdb only cared abuot the field layout. So something like
`user1$(id$IFS-A)` in master.passwd went straight into the db.
Do the same check pw(8) does, in scan(), so vipw, chpass and hand
edits all hit it. NIS +/- entries get checked after the prefix.
Bail out rather then warn; a file with junk names wont rebuild
anymore, whcih is kinda the point.
Add tests while here.
Reported by: Harry Sintonen (Reversec)
Sponsored by: Entersekt
Approved by: bapt
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D61405
[CIR] Use the global address space for the VTT parameter (#240548)
Match classic CodeGen, which types the VTT as a pointer into the target
global address space
Let cir.vtt.address_point carry that address space