[X86] Prefer AVX512 VPCMP against zero over splat(1) for sle/slt (#216716)
InstCombine canonicalizes `icmp sle x, 0` to `icmp slt x, 1`. AVX512 `VPCMP`
can encode LE/GE against a zeroed register, but we were loading splat(1)
from the constant pool (`vpcmpltb .LCPI`).
### Approach
In `combineSetCC`, for AVX512 `vXi1` integer compares:
- Rewrite `slt x, splat(1)` / `sgt splat(1), x` to `sle x, 0`
- Rewrite `sgt x, splat(-1)` / `slt splat(-1), x` to `sge x, 0`
- Skip the existing LE/GE → LT/GT `incDecVectorConstant` fold when it
would
replace a zero splat with ±1 (avoids oscillating with the rewrite above)
This is the vector analog of scalar `TranslateX86CC` (`SETLT x, 1` →
`COND_LE`
vs 0). InstCombine is left unchanged.
Pre-AVX512 (`-mcpu=x86-64-v3`) still uses `vpcmpgtb` vs zero + `not`.
[9 lines not shown]
[libc] Make File::FileLock public in File data structure (#221005)
Commit 9db0037bf1b3 moved FileLock from namespace scope into class File
so internal methods could use RAII locking, but placed it in the private
section.
Move FileLock to the public section of class File so that external
callers operating on File streams can use RAII locking instead of manual
lock and unlock calls.
Port callers in puts, fgets, perror, fgetws, reopenfile, and the pwd
flat file database parser to use File::FileLock, and add a unit test
verifying RAII locking on File streams.
Assisted-by: Automated tooling, human reviewed.
[ELF] Fix --lto-obj-path with the ThinLTO cache (#211062)
The --lto-obj-path option no longer writes empty files if the ThinLTO
cache is enabled or DTLTO is used.
The implementation of --lto-obj-path derives the native ELF file
contents from the buf[] array. When the ThinLTO cache or DTLTO is used
the native ELF file contents may be in the files[] array instead. Delay
the writing of the native ELF file till after the existing code that
extracts the native ELF file contents from either files[] or buf[].
Assisted-by: codex
Signed-off-by: Longjun Luo <luolongjuna at gmail.com>
[lldb] Fix iterator invalidation in SigchldHandler (#219752)
While SigchldHandler iterates over m_processes with llvm::any_of to
find the process that owns a waitpid event, handling an event can
create or destroy a NativeProcessLinux instance, mutating m_processes.
Comparing iterators after m_processes is mutated (such as the
find_if(...) != end() check in libstdc++'s std::any_of) triggers
assertion failures under epoch checks.
Operating on a temporary copy of m_processes via llvm::to_vector
ensures that iterator traversal is safe from container mutations.
This bug was discovered with tightened epoch checks in
SmallPtrSetIterator.
Assisted-by: Antigravity
[flang][OpenMP] Track reachable metadirective replacement paths
The existing semantic checks can validate loop-associated directives in a
METADIRECTIVE against the following loop, but they do not model how the
METADIRECTIVE chooses among its replacements.
Today each WHEN is considered independently: if its selector can match, its
replacement is checked. Selection instead ranks all applicable candidates as
a set. An unguarded higher-ranked candidate makes lower-ranked candidates
unreachable, while a dynamically guarded candidate leaves them reachable
when its condition is false. Treating both cases alike can diagnose loop
requirements on a replacement that can never be selected.
The selected replacement can also affect later selection. Its directive
contributes to the construct context seen by a nested metadirective. The
checker currently retains only syntactic nesting, so nested construct
selectors cannot observe a directive selected by an enclosing
metadirective.
[44 lines not shown]
[LowerTypeTests] Keep imported CFI functions inlinable in the ThinLTO backend (#220786)
In the ThinLTO backend, importFunction() treated imported
available_externally definitions like declarations: it created a
bodiless declaration of the real function (foo.cfi) and redirected all
direct calls to it so that they skip the jump table. Since
LowerTypeTests runs at the start of the backend pipeline, this happened
before the inliner ever saw the call, and the imported body became
unreferenced. As a result, with -fsanitize=cfi-icall and ThinLTO, no
function that is a member of a jump table (i.e. whose type is checked by
any indirect call in the program) could be inlined across modules, which
defeats the main purpose of importing it.
Handle imported definitions the same way as local definitions instead:
rename the body to foo.cfi, keep direct calls pointing at it, and
redirect only address-taken uses to the jump table entry.
Assisted-by: Claude Code
[Flang] Switch to runCodeGenPipeline abstraction
This lets flang share some more code with clang around CodeGen pipeline
setup. It also already has a switch for enabling the NewPM and will
default to the NewPM for targets that opt in.
Reviewers: arsenm, valerydmit, jeanPerier, tarunprabhu, clementval, aengelke
Pull Request: https://github.com/llvm/llvm-project/pull/220307
[Clang] Switch to runCodeGenPipeline abstraction
This moves some code to LLVM where it can be shared with other
frontends. It also enables a common spot for switching between PMs, so
we can drop the clang specific option.
Reviewers: efriedma-quic, arsenm, aengelke, jansvoboda11
Pull Request: https://github.com/llvm/llvm-project/pull/220306
[clang] Fix FoldingSet lookups that disagree with the node's Profile (#220168)
Some clang code calls FoldingSetImpl::insert with a node whose profile
doesn't match its insert token, leading to missing hash-consing.
* getObjCTypeParamType keys on Decl->getUnderlyingType() where Profile()
reports getCanonicalTypeInternal(). Canonicalize before the lookup: the
decl's underlying type can be updated later.
* getUnaryTransformType drops UnderlyingType for a dependent base after
building the ID.
* getFunctionTypeInternal keys canonically where Profile() passes
isCanonicalUnqualified(), which differs for a computed noexcept.
* getConstantArrayType keys on the full index qualifiers; only the three
CVR bits are stored.
* LoanManager keys a PlaceholderBase on the bare decl pointer where
Profile() reports the PointerUnion's opaque value.
These issues would be caught by #220166
Aided by Opus 5
[MSAN] Handle PtrToAddrInst in MemorySanitizer (#219307)
PR #210729 changed how pointer diffs are handled, specifically when
pointer overflow isn't defined it sometimes emits CreatePtrToAddr, which
MSAN currently doesn't handle. This PR adds a visitor for PtrToAddrInst
which fixes the issue as well as a regression test.
https://github.com/llvm/llvm-project/pull/210729#issuecomment-5445402022
has my minimal reproducer.
Assisted-By: Automated tooling, human reviewed
Merge tag 's390-7.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fixes from Heiko Carstens:
- Use jiffies instead of jiffies_64 to address a data-race reported by
KCSAN
- Unpoison cpacf instruction results to address KMSAN reports
- Drop unused member from ap_device_id
- Fix potential NULL pointer dereferences in IPL code
- Add missing length check to SCLP error report handling
- Add missing length check to zcrypt CCA code
- Fix return code handling in diag324 code
[33 lines not shown]
Skip the S3 suites that need the daemon
The service and bucket suites start truenas_s3 and talk to it, and the
daemon is not in the TrueNAS image yet. They are skipped whole, with
the TODO at the top of each file, so the middleware side can land
while the daemon is still in development. The access key suite needs
no daemon and keeps running.
Ask the S3 daemon whether a reload took
The daemon used to say only in the journal whether a reload went in
force, so middleware predicted the answer from a copy of which keys
hold to a restart, diffing the files it had just rendered against the
ones before. It also carried the listen address to the daemon through
a systemd drop in, reloading systemd before every start and restart,
and rendered a PAM stack of its own for the account gate.
The daemon now answers over its control socket, takes its listen
addresses from the configuration and gates accounts through the
truenas-unix stack middleware already renders. So render_and_apply
renders and asks. reloading is done, restart means service.control
RESTART, invalid is a CallError carrying the daemon's text with the
running deployment left in force, and draining or no socket means the
next start reads the files. The key lists, the text diff, the drop in
renderer and its etc entry, the daemon reload hooks, the PAM template
and its etc entry are gone. bindip renders as [server] listen and may
name up to eight addresses now that the daemon binds them all.
[2 lines not shown]
Delete a local account's S3 access keys with it
A key left behind by user.delete sat in the table with no account,
read USER_MISSING and could only be cleaned up by hand. Deleting the
account now deletes every key bound to its datastore id, then the
credentials file is re rendered as before. USER_MISSING keeps its
meaning for directory accounts, which are bound by SID and never pass
through user.delete, and the test that covered the local case now
simulates an unresolved SID instead.