[LoopPredication] Check the latch exit block for unreachable
isLoopProfitableToPredicate is meant to refuse predication on a loop latch
that exits into a deoptimize or an unreachable block. The
unreachable check looked at the latch terminator, which is always a
conditional branch, so it never fired. Check the terminator of the latch
exit block instead.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[LoopPredication][NFC] Add test for latch exiting to unreachable
Add a test for predication on a latch check that exits into an
unreachable block. Run pr61022.ll with
-loop-predication-skip-profitability-checks=true, since it tests a crash
rather than profitability.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[LoopPredication] Ignore exits to deopt in profitability check
LoopPredication refuses to predicate a loop if any exit is more than
twice as likely as the latch exit, so that a widened check does not fail
when the loop would have left through an earlier exit. It also counts
exits to deopt, including the deopt exits of the guards being predicated.
An exit to deopt cannot cause such a spurious failure: if it is taken,
the loop deoptimizes with or without predication.
If every guard has a fixed, very small failure probability, e.g. weights
{983040, 1}, then with exits to deopt counted, a loop with a guard is
never predicated if it runs more than ~1.97M iterations per entry. The
range check then stays inside the loop and blocks its vectorization.
Skip exits to deopt in the profitability check. BranchProbabilityInfo
already treats them as practically never taken. This deliberately
includes deopt exits that the profile shows as frequently taken, since
they deoptimize with or without predication too. Exits to non-deopt
blocks still compete with the latch exit.
[2 lines not shown]
[LoopPredication][NFC] Add tests for guard profitability in long-running loops
Add tests for profitability of predicating guards whose exits to deopt
are more likely than the latch exit in a long-running loop.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[Clang] Fix template template param matching with constant template params of reference type. (#227290)
When matching a template template argument, we synthesized an argument
for each constant template parameters in a way that was not consistent
with Sema::BuildDeclarationNameExpr, causing an assertion failure in
ClassifyExpr.
This fixes a regression introduced by #124137
Assisted-By: Opus 5.5
Firewall: Aliases - fix performance regression introduced in https://github.com/opnsense/core/pull/8368
The captive portal model is quite expensive to construct and for our aliases we only require the data underneath.
This commit organizes a couple of things, first implement an easier handle to load a random model from disk to test:
```
Config::getInstance()->forceReload('/path/to/test/config.xml');
$before = memory_get_usage();
$start = hrtime(true);
$mdl = new \OPNsense\Firewall\Alias(true);
printf(
"Alias: %.2f ms, retained PHP memory: %.2f MiB\n",
(hrtime(true) - $start) / 1e6,
(memory_get_usage() - $before) / 1048576
);
```
[4 lines not shown]
sun4v: Try to use the hypervisor interrupt api version 1 if version 2 fails.
Version 3 systems are working ok - trying to fix the setup when a version < 2
system is used.
Not tested on yet.
bhyve: fix integer overflow in qXfer packet parser
doff + dlen overflows unsigned int when both values are close to UINT_MAX,
causing the wrong branch to execute and passing an unbounded length to
append_binary_data(). Rewrite the comparison to avoid the addition.
Reviewed by: markj
Fixes: f81cdf24ba54 ("bhyve: Add support for XML register definitions")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D60847
[flang][OpenMP] Don't treat different runtime conditions as subsets
When two METADIRECTIVE candidates have the same score and one selector is
a strict subset of the other, the superset wins. Flang ranks every
runtime condition with the same property, so isStrictSubset saw
different conditions as the same:
!$omp metadirective &
!$omp& when(user={condition(a)}, &
!$omp& implementation={vendor(score(4): llvm)}: taskyield) &
!$omp& when(user={condition(b)}, device={kind(host)}, &
!$omp& implementation={vendor(score(3): llvm)}: taskwait)
Both candidates score 5, and `b` was tested first, so TASKWAIT ran when
both conditions were true. Neither selector is a subset of the other, so
clause order should decide.
This patch adds a UserCondition key to VariantMatchInfo, and
isStrictSubset requires equal keys when the first selector has a
[12 lines not shown]
exec_elf: Nix diagnostic messages for all (unknown) fd.o notes.
Same as for unknown GNU notes. Shaves off a tiny bit of code in
non-DIAGNOSTIC builds, saves us some trouble when fd.o invariably
adds more metadata not relevant to execution semantics.
PR kern/60901: Unknown elf note type 1081871370
[flang] Respect record type changes in FIR alias analysis access paths (#231655)
pathsDivergeAtComponent compared the component names on the access paths
of two accesses to the same variable step by step. The steps are
collected while walking through views of the variable, and a view may
change the type of the addressed object, so steps at the same index
could select components of different types, and alias analysis returned
NoAlias for accesses to the same memory. This happened for:
- CLASS views and SELECT TYPE selectors of objects of extended types:
```fortran
select type (a => this) ! this is class(base)
type is (child)
a%v(2:4) = this%v(1:3) ! a%v is a%base%v
end select
```
The paths of a%v and this%v were [base, v] and [v], so InlineHLFIRAssign
turned the assignment into an in-place loop.
- EQUIVALENCE and COMMON members, e.g. x%b and y%d after `equivalence
(x, y)`, where x has the real components a and b, and y has the real
[47 lines not shown]
[Clang] Fix crash on invalid pointer argument to `__builtin_assume_aligned` (#233112)
Fixes #194289
`BuiltinAssumeAligned` reads the type of the converted pointer argument
without checking that `DefaultFunctionArrayLvalueConversion` succeeded.
It fails, after diagnosing, for an overload set that cannot be resolved
(here `baz` is typo-corrected to the enclosing template `bar`), a
function template, or a function whose address cannot be taken, and the
null result was dereferenced. The dependent alignment is not needed; C
hits it too.
Return early when the conversion is invalid, as the code did before
ecdc5289afec dropped the check together with the `checkBuiltinArgument`
call. The error is already reported by the conversion.
LLM tools were used for this contribution, mostly for the tests.