[AMDGPU] Fix builtin crash with template parameter size argument (#175767)
## Summary
`__builtin_amdgcn_global_load_lds` and related builtins crash when the
size argument is a template parameter. The semantic checker calls
`VerifyIntegerConstantExpression` without first checking if the
expression is value-dependent, causing an assertion failure.
**Affected builtins:**
- `__builtin_amdgcn_global_load_lds`
- `__builtin_amdgcn_raw_ptr_buffer_load_lds`
- `__builtin_amdgcn_struct_ptr_buffer_load_lds`
- `__builtin_amdgcn_load_to_lds`
**Reproducer:**
```cpp
template<int N>
__device__ void load(void* src, __shared__ void* dst) {
[21 lines not shown]
[SROA] Use shufflevector instead of select for vector blend (#175756)
A patch from May 2013, commit 1e211913b56f390, changed SROA into using a
select instruction to perform vector blend. Idea was that using a select
was the canonical form, and that we optimize select better than
shufflevector.
This patch is changing SROA back into using shufflevector instead of
select when doing the blend (inserting a smaller vector into a larger
vector).
Motivation:
Nowadays InstCombine is canonicalizing this kind of vector blends, using
vector select instructions, into a shufflevector instruction. So it is
assumed that shufflevector is the canonical form now. It is also assumed
that we are better at optimizing shufflevector today, compared to back
in 2013.
Commit f26710d97d9c272be8a55 includes links to a discussion from 2016
(https://discourse.llvm.org/t/ir-canonicalization-vector-select-or-shufflevector/42257/6)
about picking shufflevector as the canonical form.
[ADT] Introduce bind_{front,back}, [not_]equal_to (#175056)
Introduce a llvm::bind_front and llvm::bind_back. To demonstrate its
utility, we pose the problem of shortening a common idiom where we use
an STL algorithm like all_of or any_of, and check the members of the
range against a value: we introduce llvm::{equal_to, not_equal_to} in
terms of llvm::bind_{front, back}.
---------
Co-authored-by: Jakub Kuderski <jakub at nod-labs.com>
Co-authored-by: Yanzuo Liu <zwuis at outlook.com>
[ADT] Add APInt::truncSSatU truncation from signed to unsigned variant (#175603)
This matches the behaviour of ISD::TRUNCATE_SSAT_U and X86ISD::PACKUS
truncations: saturate signed input to unsigned result -
`truncate(smin(smax(x, 0), C))`
Add unit test coverage and update existing PACKUS constant folding to
use the APInt helper
[RISCV][test] Fix `rda-stack.mir` test. (#175788)
It was using `BEQ $x0, $x0, ...` which is treated as conditional branch.
The intent of the test was to use unconditional branch. Replace it with
`PseudoBR ...`.
[profcheck][InstCombine] Preserve weights for xor statements (#175678)
When simplifying an xor statement with logical boolean operands, we may
be able to preserve branch weight data if the simplified instruction's
conditional was the first operand of one of the two logical boolean
inputs.
Tracking issue: #147390
Add clustered SMB state
This commit adds working configuration for stateful SMB HA failover:
* reclock helper script - determines which node holds the cluster
mutex lock based on presence of data pool system dataset.
* ctdb-related etc files. We can hard-code the nodes config based
on our known HA nodes (this significantly eases past problems with
gluster that we saw with dynamic nodes and ctdb stability).
* smbd will remain stopped on standby controller until it becomes
standby.
* keepalived will continue to manage virtual IPs
[flang][Lower] Lower OmpDependClause to Depend or Doacross (#175772)
The clause::Depend class was a variant that either held a TaskDep class
or a Doacross clause. This mirrors the OmpDependClause in the AST, which
due to changes in the OpenMP spec can contain two different forms.
This is not actually necessary, and we can save some complexity by
having clause::Depend only represent task dependence, and lowering
OmpDependClause to either clause:Depend or clause::Doacross.
loader.efi: Only use SPCR if enabled.
SerialPort in the SPCR is zeroed when serial redirection is disabled,
rather than the SPCR being omitted from the ACPI tables ony many
systems. Check to see that SerialPort.Address is non-zero before using.
FreeBSD would fail to boot on systems that could have a serial port
redireciton, but don't have it enabled because the loader would create a
bogus hw.uart.console. While one could unset this value to boot, you
couldn't do that automatically very easily. Instead, don't even look
at the SPCR table if the SerialPort is zero'd.
PR: 292206
MFC After: 3 days
Sponsored by: Netflix
Co-authored-by: Warner Losh <imp at FreeBSD.org>
Closes: https://github.com/freebsd/freebsd-src/pull/1948
(cherry picked from commit d82698ac68c23d856716dc9f6524b9ef363d7eba)
[lit] Remove error message for %T (#175782)
We left an error message for users of %T through the LLVM 22 branch
point to hopefully make it easier for anyone migrating versions rather
than having the checks silently fail with a %T ending up in the executed
command. Now that 22 has branched, we can remove this check as we all
downstream users should have seen the error by this point.