[libc] Use a syscall wrapper for sendfile
This PR move sendfile behind the centralized syscall wrappers, following libc/docs/dev/syscall_wrapper_refactor.md.
[libc] Use a syscall wrapper for uname
This PR move uname behind the centralized syscall wrappers, following libc/docs/dev/syscall_wrapper_refactor.md.
[clang][bytecode] Add a variable scope for virtual base initializers (#237933)
Otherwise we have no scope to attach temporary variables created as part
of the virtual base initializer to.
Revert "[mlir][LLVMIR] Decouple ModuleTranslation from the OpenMP dialect" (#237944)
Reverts llvm/llvm-project#236777
Doing so while investigating the build failure
[MLIR][XeGPU][LayoutPropagation] Only use 'transformed' load when uArch allows it (#233485)
The PR fixes behavior where 'transformed' load could have been picked
for `dataShape` that doesn't support it.
Before performing 'mxfp-fallback' to the 'transform-load' we now query
`uArch` for [supported
`dataShape`s](https://github.com/llvm/llvm-project/blob/cbbb5acd6db3c9ccf3bae60b7ffbe56ab213f110/mlir/include/mlir/Dialect/XeGPU/uArch/uArchBase.h#L337-L356)
via `get2DBlockIOInstDataLayout`. If transform-load is not possible we
proceed with the regular load and let the `xegpu.convert_layout` handle
the conflict.
Signed-off-by: Dmitry Chigarev <dmitry.chigarev at intel.com>
[mlir][LLVMIR] Decouple ModuleTranslation from the OpenMP dialect (#236777)
`ModuleTranslation.h` included `OpenMPDialect.h` and owned
OpenMP-specific state. Every consumer of the LLVM IR export, and every
dialect whose header includes `ModuleTranslation.h` (NVVM, XeVM),
therefore depended on the OpenMP dialect, and `MLIRNVVMDialect`,
`MLIRXeVMDialect` and `MLIRLLVMIRTransforms` linked `MLIROpenMPDialect`
for that reason only.
This PR decouples this by adding a TypeID-keyed
`ModuleTranslation::Extension` mechanism (similar to ones seen in
bufferization or the transform dialect) for state that lives as long as
the translation and move the OpenMP state into an extension owned by the
OpenMP translation.
[libc] Use a syscall wrapper for writev (#237182)
This PR move writev behind the centralized syscall wrappers, following
libc/docs/dev/syscall_wrapper_refactor.md.
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
[libc] Use a syscall wrapper for readv (#237181)
This PR move readv behind the centralized syscall wrappers, following
libc/docs/dev/syscall_wrapper_refactor.md.
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
[SPIRV] Emit DebugLexicalBlockDiscriminator for a DILexicalBlockFile.
A location scoped at a DILexicalBlockFile was emitted as a DebugScope of the compilation unit, so the discriminator did not round-trip.
Use the discriminator as the DebugScope operand, matching SPIRV-LLVM-Translator.
[SPIRV] Drop --verify-machineinstrs from new lexical-block RUN lines.
The machine verifier already runs on the buildbots.
Co-authored-by: Cursor <cursoragent at cursor.com>
[SPIRV] Drop --verify-machineinstrs from new forward-ref tests.
The machine verifier already runs on the buildbots.
Co-authored-by: Cursor <cursoragent at cursor.com>
[SPIRV] Forward-reference debug scopes with a reserved result id.
Visiting a scope reserves its result id. With SPV_KHR_relaxed_extended_instruction a back edge uses that id through OpExtInstWithForwardRefsKHR, and a later failure defines it as DebugInfoNone when an emitted instruction already named it.
Without the extension the edge is dropped and a later walk can retry the scope.
[SPIRV] Expect no unlisted DebugTypeMember in the self-pointer forward-refs test.
Without forward references, member next is no longer emitted after S and
its pointer, since S cannot list it.
Co-authored-by: Cursor <cursoragent at cursor.com>
[InstCombine] Fold min/max of int-to-fp casts into integer min/max (#237190)
When both operands of a floating-point min/max intrinsic are the same
int-to-fp cast, the min/max can be done on the integers and converted
once:
m(uitofp X, uitofp Y) -> uitofp(umin/umax(X, Y))
m(sitofp X, sitofp Y) -> sitofp(smin/smax(X, Y))
Integer-to-float conversion is monotonic, so it preserves the order of
the operands. This covers all six min/max intrinsics.
Alive2: https://alive2.llvm.org/ce/z/PKQyse
[mlir][SPIR-V] Pass serialization options in --serialize-spirv (#237710)
serializeModule dropped its options, so --spirv-emit-debug-info had no
effect
---------
Co-authored-by: Igor Wodiany <dev at wodiany.com>
[clang][bytecode] Resolve FIXME comment in CheckArraySize (#237860)
Add `getActiveBits()` to primitive integral types so we don't have to go
through `APSInt`.
[MLIR][XeGPU] Fix memref-i4 offsets computation (#233474)
Introduces a new utility function `xegpu::addElemOffsetInBytes` for
byte-offset computation and use it in `xegpu-to-xevm` and
`peephole-optimizer`.
In comparison with the old logic, the new utility function handles
sub-byte (i4) types correctly by first multiplying the element-offset by
bit-width and dividing by 8 later:
```c++
// old logic
byteOffset = elemOffset * (bitWidth / 8);
basePtr += byteOffset;
// old logic breaks on sub-byte types:
byteOffset = 1024 * (4 / 8); // 1024 * 0 == 0
basePtr += 0; // reads from the start of the buffer
// new logic in 'addElemOffsetInBytes'
[6 lines not shown]
[OpenMP][clang] Correctly widen loop iteration calculation
For a loop like `for (uint32_t i = 0; i < (size_t)13; i += 2)`, widen
the `lower - step + 1` calculation to the size of the upper bound type,
aka size_t in this case. Otherwise, we would not caluclate 13 - (-1),
but instead 13 - (0xFFFFFFFF) and get the wrong result.
Fixes https://github.com/llvm/llvm-project/issues/70687.
Claude assisted with this patch.
[AArch64][LSR] Prefer LSR solutions with less pre/post-index (#234264)
In AArch64 CPUs a pre or post indexed load/store typically uses an extra
ALU resource compared to a load/store that uses offset addressing.
Therefore in Loop Strength Reduce we should favor solutions with fewer
of these instructions when the Insns and NumRegs costs are equal.
This currently has no effect, as the preferred addressing mode for
AArch64 is None so LSR assumes pre/post index instructions don't exist,
but I'm planning on changing the addressing mode in the future.
[clang][Lex] Fix assertion on unclosed paren in PP directive (#234992)
Clangd's preamble scan runs the preprocessor in single file parse mode.
If a directive contains an undefined identifier and ends inside a
subexpression (e.g. due to an unclosed parenthesis), PeekTok is already
eod when DiscardUntilEndOfDirective is called. That function lexes one
more token which is eof on the truncated buffer and triggers an
assertion.
Only discard if the current token is not eod, analogous to the other
callers of DiscardUntilEndOfDirective.
Fixes #226555
[lldb] Read Wasm globals through a frame of the stub's own thread (#237195)
This commit fixes an unconditional cast from Thread to ThreadWasm, which
ignores the possibility of an OS plugin, by using the real thread list.
Note that using the qWasmGlobal variant that expects a frame index is
unlikely to succeed in the presence of a custom unwinder that presents a
different view of frames. But at the very least we shouldn't crash by
doing an invalid cast, which this fixes.