[mlir][tensor] Fix assertion on bufferizing expand_shape with a non-strided layout (#217714)
`ExpandShapeOpInterface::bufferize` creates a `memref.expand_shape`
directly without consulting `getBufferType`. The `memref::ExpandShapeOp`
builder computes the result layout with `computeExpandedType` and
asserts when that fails. `computeExpandedType` fails when the source
layout is not identity and `getStridesAndOffset` cannot decompose it, so
a non-strided affine layout aborts the compiler instead of reporting a
failed bufferization.
Query `getBufferType` first and return failure when it fails. The
model's own `getBufferType` already propagates the `computeExpandedType`
failure.
Rest of the behaviour is unchanged: we just fail gracefully now instead
of crashing.
---
Code authored by Claude Code.
[NFC][analyzer] Remove class 'NodeBuilder' (#217319)
This change concludes the removal of the class `NodeBuilder` which
previously added lots of unnecessary complications to the logic of the
analyzer engine.
The main feature of a `NodeBuilder` was that it tracked a "frontier"
set of exploded nodes, which were freshly created and not yet superseded
by the creation of another node. This was counterproductive in almost all
code that used `NodeBuilder`s -- with the exception of `CheckerContext`
where this was useful to support arbitrary chains of `addTransition`
calls in checkers.
As earlier commits removed the counterproductive use of `NodeBuilder`s,
there was only one surviving `NodeBuilder`, a data member of
`CheckerContext`, and its `generateNode` method was called only once, so
this commit inlines still relevant fragments of `NodeBuilder` into
`CheckerContext` and removes `NodeBuilder` as a separate class.
[4 lines not shown]
[clang][bytecode] Avoid copying function call arguments (#218399)
In most cases, we dony' need the SmallVector (we only use it to reverse
the arguments in the assignment operator case).
[clang-tidy] Fix modernize-use-noexcept crash on unparsed exception specs (#218256)
A failed template instantiation can leave a function type with an
`EST_Unparsed` exception specification.
`modernize-use-noexcept` currently calls
`FunctionProtoType::isNothrow()` for that type, which reaches an
unreachable path in `FunctionProtoType::canThrow()`.
This fixes the crash by skipping unparsed exception specifications
before querying whether the function is non-throwing.
Fixes #214291
[clang][bytecode] Optimize `PtrView::isOnePastEnd()` (#218375)
We call this a lot. Optimize this by inlining and then simplifying the
callers, i.e. don't call getFieldDesc() as much.
Also remove some code duplication from the similar
`Pointer::isOnePastEnd()`.
[mlir][linalg] Fix splat fold crash on non-TypedAttr element types (#218012)
`getScalarConstantAttrFromDenseSplat` returns
`getSplatValue<TypedAttr>()`, which for a derived attribute type is an
unchecked `llvm::cast`. Complex element types store their splat as an
`ArrayAttr` of two values, and `ArrayAttr` does not implement
`TypedAttr`, so the cast asserts on
%cst = arith.constant dense<(1.0,2.0)> : tensor<3xcomplex<f32>>
%0 = linalg.broadcast ins(%cst : tensor<3xcomplex<f32>>)
outs(%init : tensor<2x3xcomplex<f32>>) dimensions = [0]
under `mlir-opt --canonicalize`. Integer and float splats yield
`IntegerAttr`/`FloatAttr`, which are `TypedAttr`, so only non-scalar
element types are affected.
Guard with a `dyn_cast` and decline the fold when the splat value has no
`TypedAttr` representation. The helper is shared by the broadcast
pattern added in PR 195980 and the transpose patterns added in PR
195991, so both call sites are fixed; a test is added for each, as the
transpose case was not previously covered.
[libc++] Implement single element vector::insert in terms of emplace (#210284)
This also ports an optimization to `emplace`: if we copy/move construct
the element we can avoid constructing a temporary.
[libc++] Revert extra-attempts to original value (#218416)
This reverts ab4cccdf16 now that lnt.llvm.org is stable, the bots have
caught up and all machines have data for all the commits.
[GlobalISel][NFC] Remove incorrect attempt to find fewest uses (#218037)
When folding: `(fadd (fma x, y, (fmul u, v)), z) -> (fma x, y, (fma u,
v, z))` remove code that was looking for the addend with the fewest uses
in an expression of the form `(fadd (fmul u, v), (fmul x, y))`. This is
a mismatch and also subsequent code already only allows optimization if
the fma and fmul each have only one non-debug use.
Also fix incorrect comment when looking for the operand with fewest uses
in (fsub (fmul u, v), (fmul x, y)).
---------
Signed-off-by: John Lu <John.Lu at amd.com>
Revert "[AssumptionCache] Limit the number of assumptions inspected p… (#218390)
Reverts llvm/llvm-project#217525
A new check introduced in a frequently executed code path affected the
build performance.
[ModuleSummary] Only compute BFI if function has profile data (#218374)
After b30971c4bb3f0654fa4fbb242126376169ae66d0 the module summary should
no longer need BFI for functions without profiling data.
Not computing it is a minor compile-time improvement.
[BOLT][RISCV] Precommit test for a call that links through t0 (#218396)
The machine outliner calls its outlined functions with "call t0, func"
and the callee returns with "jr t0". BOLT currently rewrites that call
to link through ra, which the CHECK lines below pin down.
[SystemZ][z/OS] Fix crash when personality function is null (#217947)
When the personality function is specified as `null`, then the current
code triggers an assertion. The correct behaviour, like on Linux, is to
not emit the DWARF EH data and the reference to the personality
function.
[SystemZ][z/OS] Support emitting common symbols in HLASM (#215278)
This is a follow-up to #210179. It reuses the logic to emit common
symbols in HLASM, too.
[BasicAA] Remove special malloc handling (#197180)
We currently assume that allocation functions don't ModRef other memory.
However, this is something that should be controlled by the `memory`
attribute on the allocator, which is typically inaccessiblememonly for
things like malloc.
This code path specifically only affected hardcoded allocation functions
from MemoryBuiltins (not those using allocator attributes). Nowadays,
these are only the `operator new` family functions.
For those functions, we should not unconditionally assume that they
don't access other memory: They are replaceable global allocators, which
in principle can have arbitrary memory effects (they can just be
pair-wise elided, but must be respected if not elided.)
https://github.com/llvm/llvm-project/pull/217652 changed clang to emit
`memory(inaccessiblemem: readwrite, errnomem: write)` for `operator new`
if `-fassume-sane-operator-new` is used (which is the default). We
should not make any additional assumptions in BasicAA if the attribute
is not present.
AMDGPU: Deprecate getArchAttrAMDGCN (#217769)
The legacy ArchFeatureKind bitfield returned by getArchAttrAMDGCN is
being replaced by getFeatureBitset (FEAT_* bits). All in-tree callers have
been migrated, so mark both overloads LLVM_DEPRECATED to steer out of
tree code to the bitset API before the accessor is removed.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[FunctionAttrs] Handle nofreeobj (#218364)
This adds handling for nofreeobj (introduced in
https://github.com/llvm/llvm-project/pull/206445) in two places:
* Don't infer `nofree` if we already have `nofreeobj`. `nofreeobj` is a
stronger property, it's pointless to have both.
* Use `nofreeobj` on call arguments when inferring `nofree`.
[Clang][Sema] Don't warn on accessing virtual base from abstract class (#217715)
Virtual bases are initialized by the most derived class, and they come
before non-virtual base class initializers. So an abstract class can
assume that virtual bases are already initialized by the time their
constructor runs.
It seems that the warning generally doesn't take indirect bases into
account, otherwise this would become a bit more complicated.
Fixes #204858.