[mlir][arith] Fix crash in AddUIExtendedOp::fold when operand is ub.poison (#183596)
When `constFoldBinaryOp<IntegerAttr>` is called with a `ub.poison`
operand, it propagates the poison attribute as its result. The fold
method for `arith.addui_extended` then attempted to cast this result to
`TypedAttr` via `llvm::cast<TypedAttr>(sumAttr)`, which failed with an
assertion because `PoisonAttr` does not implement the `TypedAttr`
interface.
Fix this by checking whether the folded sum is a poison attribute before
the cast. When poison is detected, it is propagated to both the sum and
overflow results.
Fixes #181534
[MLIR][Vector] Fix crash in BitCastOp::fold for index element type (#183572)
`BitCastOp::fold` called `Type::getIntOrFloatBitWidth()` on the source
element type without first verifying it satisfies `isIntOrFloat()`. When
the source vector has `index` element type (e.g. `vector<16xindex>`),
the assertion `only integers and floats have a bitwidth` fires.
Add an `srcElemType.isIntOrFloat()` guard to the condition so that the
constant-folding path is skipped for non-integer/float element types.
Fixes #177835
[SCF] allow indexing operations for loop coalesceing (#183180)
Currently if there are operations between the loops we get a dominance
issue as the delinearlized index is added after the operations. This PR
fixes that.
For testing we also add a transform pattern that makes a direct call to
coalesceLoops as the existing pattern calls
coalescePerfectlyNestedSCFForLoops which does not consider the loop nest
perfectly nested if there are operations between them which is safer for
that usage.
Co-authored-by: Claude Opus 4.6 <noreply at anthropic.com>
[libunwind][PAC] Resign explicitly in loadAndAuthenticateLinkRegister
Explicitly call `ptrauth_auth_and_resign` to prevent separate auth and
sign intrinsics being emitted by Clang frontend.
Even if replacing separate "auth" and "sign" operations with a safer "resign"
would be implemented in LLVM optimizer pipeline, Clang frontend treats zero
pointer as a special case w.r.t. PtrAuth. This results in such combination of
an explicit authentication and an implicit signing to be emitted as a hard-to-
simplify comparison against zero along these lines:
tmp = auth(input)
if (tmp == 0)
*output = sign(tmp)
else
*output = 0
[clang] Fix driver resignaling when cc1 runs out-of-process (#183560)
When cc1 runs out-of-process and crashes, sys::ExecuteAndWait returns -2
for signal-killed children. The resignaling block added in 15488a7f78ce
only handled CommandRes > 128, so the driver would exit normally with
code 1 instead of dying by signal.
[CIR][docs] Fix table of contents for CIR eh and cleanups doc (#183594)
When this document was converted from rst to markdown, the contents
didn't get updated correctly.
[AllocToken] [Clang] Fix type inference for atomic types (#183571)
When evaluating whether an allocated type contains a pointer to generate
the `alloc_token` metadata, `typeContainsPointer` incorrectly stopped
recursion upon encountering an `AtomicType`. This resulted in types like
`_Atomic(int *)` (or `std::atomic<int *>` under libc++) being
incorrectly evaluated as not containing a pointer.
Add support for `AtomicType` in `typeContainsPointer` by recursively
checking the contained type.
Add tests for structs containing `_Atomic(int *)` and `_Atomic(int)`.
[Clang][Lexer][Performance] Optimize Lexer whitespace skipping logic (#180819)
... by extracting the check for space character and marking it as
`LLVM_LIKELY`. This increases performance because the space is by far
the most common horizontal character, so in most cases, this change
allows to replace a lookup table check with a simple comparison,
reducing latency and helping the cache.
This does not reduce instruction count, as a lookup table and a
comparison are both a single instruction. However, it _does_ reduce
cycles in a consistent manner, around `0.2` - `0.3`%:
[benchmark](https://llvm-compile-time-tracker.com/compare.php?from=3192fe2c7b08912cc72c86471a593165b615dc28&to=faa899a6ce518c1176f2bf59f199eb42e59d840e&stat=cycles).
I tested this locally and am able to confirm this is not noise (at least
not entirely, it does feel weird that this impacts `O3` more than
`O0`...), as I achieved almost `2`% faster PP speed in my tests.
[SPIRV] Fix legalization of zero-size external global (#183130)
`getInitializer` asserts if there's no initializer, so check first.
I found this compiling some `liboffload` unit tests.
---------
Signed-off-by: Nick Sarnie <nick.sarnie at intel.com>
[MLIR][XeVM] Enable some SPIRV extensions by default for XeVM target. (#182399)
Enable,
SPV_EXT_relaxed_printf_string_address_space
SPV_INTEL_cache_controls
SPV_INTEL_variable_length_array
[CIR] Implement flattening of nested EH cleanup scopes (#183404)
This implements flattening of nested EH cleanup scopes, rewriting the
inner scope's resume to branch to the outer scope's EH cleanup block.
I used AI tools to generate many of the changes in this PR, but I have
carefully reviewed the changes and updated as needed.
[CIR] Upstream support for pure virtual destructors (#182857)
Upstreams support for emitting traps for abstract destructors.
Signed-off-by: vishruth-thimmaiah <vishruththimmaiah at gmail.com>
[PowerPC] using milicode call for memccpy instead of lib call (#182563)
AIX has "millicode" routines, which are functions loaded at boot time
into fixed addresses in kernel memory. This allows them to be customized
for the processor. The __memccpy routine is a millicode implementation;
we use millicode for the memccpy function instead of a library call to
improve performance
---------
Co-authored-by: Matt Arsenault <arsenm2 at gmail.com>