[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>
[clang][Lex] Add ChenMiaoi to CODEOWNERS (#241084)
I would like to take on more sustained code review work in
`clang/lib/Lex`, so I am requesting to be added to the directory's
`CODEOWNERS`. I have been contributing fixes and reviewing PRs related
to Clang Lex, and I hope to follow changes in this area more closely and
help review them promptly.
I have not requested to join `pr-subscribers-clang` because the team
currently covers too broad an area. For now, I would like to focus on
and learn from changes in and around Lex.
I will carefully review changes I am familiar with. For questions beyond
my experience, I will seek help from contributors with greater
familiarity with the relevant code or semantics, rather than approve
changes without sufficient confidence.
I understand that joining `CODEOWNERS` means more than receiving
notifications: it is a commitment to invest time and effort consistently
[2 lines not shown]
[libc] Use make_unique_for_overwrite in dir_scan_impl.h (#241905)
Replace the AllocChecker + new allocations in dir_scan_impl.h with
make_unique_for_overwrite. ScannedEntries now also stores its entries
array in a cpp::unique_ptr<struct dirent *[]>, which lets me drop the
manual delete[] calls and the pointer juggling in release().
Assisted-by: Gemini
[LangRef][llubi] Clarify the behavior of load/store with non-byte-sized byte types (#237391)
Address comment
https://github.com/llvm/llvm-project/pull/230955#discussion_r4241760419.
In https://github.com/llvm/llvm-project/pull/180739, we force the
padding bits of non-byte-sized load/store are filled w/ zero bits.
However, it is hard to define `zext` and `trunc nuw` of a byte value, as
it may contain several poison bits.
This patch specifies that the padding bits are filled with poison iff
all non-padding bits in the padding byte are poison. This still allows
us to remove a non-byte-sized store of poison values. When loading a
non-byte-sized byte value, the byte containing padding bits is poisoned
when padding bits are not zeros. Other non-byte-sized load/store,
including scalars and vectors, are interpreted as `bitcast +
bitinsert/bitextract`.
llubi implementation is adjusted accordingly. `freeze` and `bitinsert`
[3 lines not shown]
[libc] Add <ifaddrs.h> and getifaddrs/freeifaddrs stubs (#241896)
Add the <ifaddrs.h> header, struct ifaddrs definition, and stub
implementations for getifaddrs() and freeifaddrs() (returning ENOSYS and
doing nothing, respectively).
The stubs live under src/ifaddrs/linux/ (matching net/if) so the real
netlink-based implementation can be filled in later. Since they don't do
anything useful yet, the header and entrypoints are gated on
LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS (on linux aarch64, riscv, and
x86_64, where the rest of our networking headers are enabled).
Assisted-by: Gemini
[SystemZ][z/OS] Disable threads on z/OS (#238203)
Recent uses of thread local in llvm have used dynamic initialization.
This is not supported on z/OS yet. This PR will disable thread support
for z/OS.
[Verifier] Add `immarg` to unwind argument of `@llvm.coro.end.*` (#241870)
This is used to drive coroutine splitting and should only ever be an
immediate.
Fixes #241473
[CIR] Add relative_cxx_abi_vtables to lowering-options (#241040)
This is a first in quite a few patches that I intend to commit towards
getting us 'relative-vtable' support. I believe that CIR-Gen should
abstract this away, so I am going to move get_virtual_fn_addr to return
an abstract type instead. This patch will let LowerToLLVM handle all the
'heavy lifting' of figuring out the differences between pointer and
offset addresses.
[SystemZ][test] Fix mismatched copy-like operand sizes in MIR fixtures (#238381)
Fixing some register size mismatches on COPY instructions.
Came up with: https://github.com/llvm/llvm-project/pull/234959
[csan] fixes for hexagon / 32-bit architectures (#241324)
For Consume(): cast peer PCs through uptr before converting them to
pointers.
For the access-sizes.cpp test case: use long long for the eight-byte
access case so ILP32 targets exercise the intended access size.
[Attributor][NFC] Remember IPO amendable functions (#241064)
`isFunctionIPOAmendable` runs on every AA update. Compute whether a
function has an exact definition or is inlineable once, in
`initializeInformationCache`.
With the other pending Attributor compile-time changes, attributor-light
is 0.1-0.3% faster on CTMark (`opt` instructions); the full Attributor
is unchanged.
Co-authored-by: Matt Arsenault <Matthew.Arsenault at amd.com>
Assisted-by: Claude Opus 5.5