[llvm][Object] Handle unknown COFF machine types (#240047)
machineToStr() previously used llvm_unreachable() to handle unknown
machine types, which could cause a crash when an unsupported machine
type was encountered. This fix makes function return "unknown" instead,
when handling machine types not supported by this function
AI assisted with investigating the issue, discussing the testing
approach, and reviewing the implementation. I implemented the fix,
adapted existing LLVM tests to add regression coverage and ran the tests
locally
Related to #239535.
Allow configured origins to read /api/versions for TrueNAS Connect
nginx answered CORS on /api/versions only when the system was registered
with TrueNAS Connect, and only for the TNC web app plus `ng serve` on
dev and staging, recognised from the account service's hostname. A TNC
client run against an unregistered system (an ephemeral TNC stack, local
development, CI) could not read the versions, so @truenas/api-client fell
back to v25.10.0 on systems that serve newer API versions.
* tn_connect gains `allowed_origins`, set with the private
tn_connect.update_environment. Each entry is normalized to the exact
Origin header a browser sends; plain http is accepted only for
localhost, 127.0.0.1 and [::1]. Unlike the endpoints it may change
while TNC is enabled, and a change reloads nginx.
* /api/versions answers CORS when the system is registered or
allowed_origins is not empty. /_download still requires registration.
* The origin map uses exact matches built in plugins/truenas_connect/
cors.py. It was a regex built from tnc_base_url with unescaped dots,
so https://web.truenasconnect.net also matched look-alike hosts such
as https://webxtruenasconnect.net.
math/blacs: use MPI compiler wrappers
Use the compiler wrappers and installation path provided by mpi.mk.
Use MPI-2 communicator conversion for MPICH and OpenMPI.
Merge their identical build configuration patches.
Approved by: thierry (mentor, implicit)
[CIR] Return function pointer from `getCallableForCallee` (#237275)
Currently any indirect call will cause an assertion failure if openmp is
enabled together with CIR. This is because one of omp dialect-specific
passes (MarkDeclareTarget) will dyn_cast a pointer returned from
`getCallableForCallee`. The patch follows the same approach as FIR: if
there is no function, return first CallOp argument.
[CodeGen] Skip pseudo probes in the ImplicitNullChecks scan (#240239)
Implicit null checks (`-enable-implicit-null-checks`, used by frontends
that lower nil checks to a `SIGSEGV` handler) are silently disabled when
pseudo probes are enabled.
`PSEUDO_PROBE` is marked as having side effects so that it is not
dropped, so `canHandle()` rejects it and `analyzeBlockForNullChecks()`
gives up on the whole non-null successor. Probes start every
instrumented block, so `-fpseudo-probe-for-profiling` together with
`-enable-implicit-null-checks` loses the optimization for essentially
every candidate.
Skip debug instructions and pseudo probes while scanning the successor;
neither is the faulting operation nor counts against
`MaxInstsToConsider`. The probes stay in their block, and only the
faulting load is hoisted into the predecessor, so samples on that load
are attributed to the predecessor's probe.
[17 lines not shown]
[mlir][ArmNeon][NFC] Replace `NeonVectorOfLength` with common constraints (#239225)
Replace the custom `NeonVectorOfLength` type constraint with
`VectorOfLengthAndType` and `FixedVectorOfRankAndLengthAndType` from
`CommonTypeConstraints.td`.
This is a step towards unifying the `ArmNeon` and `ArmSVE` dialects.
More work will be required, but I am deliberately implementing it in
small, incremental steps to simplify the review process.
[libc] Fix LLVM_LIBC_ADD_FUNCTION_C_ALIAS lint namespace error (#240751)
When LIBC_COPT_PUBLIC_PACKAGING is disabled, as in internal object
targets linted by libc-lint, LLVM_LIBC_ADD_FUNCTION_C_ALIAS expanded to
static_assert(true, "Require semicolon."). Because callers place this
macro at translation-unit scope outside LIBC_NAMESPACE_DECL,
llvmlibc-implementation-in-namespace rejected the static_assert
declaration in libc/src/errno/libc_errno.cpp and the scanf sources.
Replace that stub with an extern "C" type alias referring to
LIBC_NAMESPACE::name. ImplementationInNamespaceCheck already exempts
extern "C" linkage specifications at file scope, the semicolon
requirement is preserved, and the referenced internal symbol is still
verified at compile time.
Assisted-by: Automated tooling, human reviewed.
[AArch64][DAG] Improve codegen for clearing upper vector lanes (#237259)
Add patterns to use FMOV to implicitly clear the upper lanes of a vector
while preserving lane 0
Will fix this open
[issue](https://github.com/llvm/llvm-project/issues/228317) upon the
stack being merged
[InstCombine] Canonicalise Zero Vector operand to always be RHS of a shuffle vector (#237258)
shuffle zero, x, mask --> shuffle x, zero, mask'
Canonicalize ZeroVector of a shuffle to always be the RHS operand.
The motivation can be viewed in the next PR where the zero vector on the
RHS results in the same DAG, allowing for less patterns required for
instruction selection
Some riscv intrinsic test failed. This was due to the intrinsics
emitting shuffle vectors with a zero operand.
One of the intrinsics (ppaire) were not lowering correctly due to the
change. The reason being is that a function that checks whether we lower
to the intrinsic was dependent on whether the zero was a LHS operand or
RHS operand.
I modified this so that it checks both operand orders (via commuting the
mask). The function is only used for this one intrinsic so I am not
expecting any more regressions from this
[X86] Add missing v8bf16/v16bf16 VPBROADCASTW patterns without AVX512BW+VLX
X86ISD::VBROADCAST of a v8bf16 register only had isel patterns for
[HasBWI, HasVLX] (VPBROADCASTWZ128rr). On AVX2 targets without
AVX512BW+VLX, a splat of a bf16 vector that is live across basic blocks
fails with:
LLVM ERROR: Cannot select: v8bf16 = X86ISD::VBROADCAST (v8bf16 CopyFromReg ...)
The splat itself is lowered as a v8i16 shuffle, but combineTargetShuffle
then turns VBROADCAST(bitcast(x)) into bitcast(VBROADCAST(x)), which
creates the v8bf16 node.
This has been latent since AVX-NE-CONVERT made v8bf16 a legal type (it
already fails with -mcpu=sierraforest in LLVM 18). #230953 and #221225
made v8bf16 legal with AVX512BW and with plain AVX respectively, so it
now fails on every AVX2 target without AVX512BW+VLX, including common
AMD Zen 2/Zen 3 (-mcpu=znver2/znver3) hosts.
[10 lines not shown]
[X86] Add bf16 broadcast tests (NFC)
Add tests for bf16 vector splats that end up as X86ISD::VBROADCAST or
X86ISD::VBROADCAST_LOAD:
- values live across basic blocks
- volatile loads
- loads whose other uses are simplified away after legalization
- broadcasts of v8bf16 values that are bitcast to vXi16/vXi32
Only -mattr=+avx512bw,+avx512vl is tested in this commit. Targets without
AVX512BW+VLX crash on all of these tests; the follow-up commit fixes that.
Assisted-by: Antigravity
[flang][OpenACC] Test unstructured seq loops that stay TODO in kernels
Cover the unstructured `acc loop seq` shapes in kernels that still hit
the "unstructured do loop in acc kernels" TODO on the seq loop's own
DO: a seq loop inside an unstructured IF, SELECT CASE, BLOCK or DO
WHILE, a loop that is seq only for a non-default device_type, and auto
loops. Each case checks its pre-FIR tree, and every TODO check in the
file now names the line of the loop it fires on, using split-file
--leading-lines.
[flang][OpenACC] Lower unstructured seq loops directly in kernels
An `acc loop seq` with an early exit directly in a kernels region still
hit the "unstructured do loop in acc kernels" TODO, because the kernels
construct around it stays unstructured. Its control flow stays in the
acc.kernels region, its acc.loop privatizes its induction variables,
and no parallel loop runs it on more than one thread, so lower it like
a structured seq loop in kernels.
[flang][OpenACC] Privatize nested DO variables of unstructured seq loops
A DO nested in the body of an unstructured `acc loop seq` that the
directive does not own has no acc.loop of its own when it is
unstructured, so nothing privatized its induction variable and it hit
the "unstructured do loop in acc kernels" TODO. It runs on the thread
executing the seq loop, and its induction variable is predetermined
private to that thread, so privatize it on the seq loop's acc.loop.
Factor the check for the default device_type in a list of device_type
attributes into a helper, used here and by the two existing copies.
pfil: Avoid potential mbuf tag leak
In '398254f9999e mbuf: simplify m_free' we removed tag processing
on m_free() of M_NOFREE mbufs. It is possible that a packet filter
could attach a tag to this stack mbuf and call m_free()
on it, meaning that 398254f9999e may have introduced a tag leak.
However,if a tag is attached without anyone calling m_free(), then
this leak was pre-existing.
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D60686
Fixes: 398254f9999e
Sponsored by: Netflix
(cherry picked from commit f4ff995e361fa72cea240c4dbac2d0931965c80f)
igmp: Refresh the ip header pointer after m_pullup()
There is a chance that the m_pullup() call immediately above invalidated
the "ip" pointer, so refresh it as we do with the IGMP header.
Otherwise the test in igmp_input_v3_query() for whether the packet is an
IGMPv3 general query might use a pointer to a freed mbuf.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit dc47a6940d60d393b3d36ba0fc5cb84d06fafaea)
igmp: Deindent some code
No functional change intended.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 123342f3d2cccf432d3d0082097b6c97397ecc67)
carp: fix global demotion counter to VRRP advertisements
When net.inet.carp.preempt=1 and a physical interface goes down, the global
V_carp_demotion counter is incremented. For CARP this was already reflected in
outgoing advertisements via DEMOTE_ADVSKEW(), but VRRP sent the raw
sc_vrrp_prio unchanged, so demotion had no effect.
Add DEMOTE_VRRP_PRIO(), a macro analogous to DEMOTE_ADVSKEW():
It subtracts V_carp_demotion from the configured priority and clamps the result
to [0, 254]. Priority 0 is VRRPv3's "resign" signal and causes backups to
preempt immediately. Priority 255 (IP address owner) is never demoted.
Reviewed by: kp
Approved by: kp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D55558
(cherry picked from commit 9f71153aec0cb455cd49af6d4ca7e4c16fd45d7a)