[SPIR-V] Do not add ImageMemory semantics to fence in the kernel environment (#240448)
Image accesses are opaque builtin calls rather than LLVM memory
operations, and OpenCL requests image ordering explicitly via
CLK_IMAGE_MEM_FENCE.
Lower the LLVM `fence` instruction with `WorkgroupMemory |
CrossWorkgroupMemory` semantics in the kernel environment. The shader
environment and the OpenCL fence builtins are unchanged.
Follow up to #223023
AI-assisted: Claude Opus 5.5 (commercial SaaS)
[libc] Use a syscall wrapper for geteuid (#241769)
This PR move geteuid behind the centralized syscall wrappers, following
libc/docs/dev/syscall_wrapper_refactor.md.
[libc] Use a syscall wrapper for fchown (#241768)
This PR move fchown behind the centralized syscall wrappers, following
libc/docs/dev/syscall_wrapper_refactor.md.
[libc] Use a syscall wrapper for chown (#241767)
This PR move chown behind the centralized syscall wrappers, following
libc/docs/dev/syscall_wrapper_refactor.md.
[mlir][ODS] Add partitions for attributes and types
Allow attributes and types to be grouped into named partitions, like
ops. Each def can set `partition` to a `Partition` record. Passing
`-attrdefs-partition=<name>` or `-typedefs-partition=<name>` to the
attrdef/typedef decls and defs generators then emits only the defs of
that partition. A large dialect can thus split its attributes and types
over several compilation units with narrower headers.
The implementation mirrors the approach used in op partitioning
with a `register<DialectClass>Attributes` function (or Types) is used to register every attribute (or type) of the dialect and dispatches to partition specific functions.
The `generated{Parser,Printer}` function saw the biggest change.
It is not generated as `generated<DialectClass>{Attribute,Type}{Parser,Printer}` which is a method with public linkage.
This method is also generated for non-partitioned dialects and the old `generated{Parser,Printer}` function soft-deprecated (but for now retained for migration purposes).
The additional testing, the test dialect's attributes and types are split into the
partitions `Core` and `Syntax`.
This roughly halves the compile time (15.1s -> 6.7s + 6.9s) and peak memory (721 MiB -> 385 and
376 MiB) of the largest test dialect attribute compilation unit.
[2 lines not shown]
[ItaniumDemangle] Print the full target type of cast expressions (#240977)
CastExpr only prints the left half of its target type. Instead, print
the full type.
With the example from the test:
```
llvm-cxxfilt _Z1fIXscA_iLi0EEEvv
Before: void f<static_cast<int>(0)>()
With this patch: void f<static_cast<int []>(0)>()
```
Fixes https://github.com/llvm/llvm-project/issues/240962
assisted-by: claude
[CIR] Match classic codegen for saturating fixed-point negation and padded conversions (#236702)
Three ClangIR fixed-point paths diverged from classic codegen:
- Unary minus on a saturating type emitted a plain subtraction. It is
now a saturating `0 - x`.
- With `-fpadding-on-unsigned-fixed-point`, float to unsigned
fixed-point conversion produced the `fptosi.sat` result in an unsigned
CIR type, so its clamp to 0 compared as unsigned and never fired. It now
converts and clamps in a signed type, like `llvm::FixedPointBuilder`,
and casts to the unsigned type afterwards.
- A saturating conversion that kept the width but changed signedness
returned a value of the source CIR type, which broke the `cir.cmp`
verifier and needed a pointer bitcast to store. It now casts to the
destination type.
Assisted-by: Claude Code (Claude Opus 5.5).
[libc] Use CheckedPtr in environ_internal (#241777)
Replace the manual AllocChecker allocations with make_unique and
friends. The allocations are only held in CheckedPtrs locally, and
released into the raw member pointers once nothing can fail anymore. I'm
deliberately not making the members themselves unique_ptrs, as that
would make the EnvironmentManager singleton non-trivially destructible.
Assisted-by: Claude
[libc] Read the whole netlink dump in if_nameindex (#241874)
This patch makes us call recvfrom in a loop until we get NLMSG_DONE. The
interface entries are copied out of the buffer, so we can reuse it for
each read. The kernel shouldn't send empty datagrams, but I'm treating
them as an error (EIO) anyway, so that we can't end up spinning in the
loop. This also means that tests which don't provide an NLMSG_DONE
message get an error (instead of hanging).
Now that we keep reading, silently skipping over data we can't parse is
no longer harmless, as we would block forever if we skipped the
NLMSG_DONE message. Anything left over at the end of a datagram is
garbage or a truncated message, and I'm returning EIO in that case as
well. TruncatedNetlinkHeaderPacket now expects that.
I'm also checking the error code in the NLMSG_DONE payload, since that's
how the kernel reports errors which happen in the middle of the dump.
Assisted-by: Claude
[Support] Add LLVM_WINDOWS_RESTRICTED_APIS to avoid shell32 (#209448)
Replace the unconditional environment variable lookups with an opt-in
option. With it OFF, behavior is unchanged.
With it ON, Support does not import shell32:
- Home, config and cache directories come from USERPROFILE and
LOCALAPPDATA and are created if missing, like KF_FLAG_CREATE.
- remove_directories() uses RemoveDirectoryW and DeleteFileW, removes
read-only entries, and does not follow junctions or symlinks.
- shell32 is dropped from the link libraries and delay-load flags.
A unit test checks the import and delay-import tables for shell32.
---------
Co-authored-by: Reid Kleckner <rkleckner at nvidia.com>
rtprio*: Add capability mode checks
These syscalls are allowed in capability mode but accept an arbitrary
pid or lwpid. Restrict them to the calling process in capability mode.
In capability mode rtprio_thread(2) only looks up threads of the
calling process, and returns ECAPMODE for any other lwpid, including
one that does not exist.
Sponsored by: Advanced Micro Devices, Inc.
Signed-off-by: Osvaldo Janeri Filho <ojanerif at amd.com>
Reviewed by: olce