[clang][CodeGen] Emit callee_type metadata for all indirect calls
CodeGenFunction::EmitCall only attached the call graph section callee_type
metadata to an indirect call when its caller asked for the emitted call
instruction through the callOrInvoke out parameter, because the emission
was nested in the block that stores it. Indirect calls emitted by callers
that do not pass callOrInvoke, such as the virtual destructor call of a
delete expression (emitVirtualObjectDelete -> EmitCXXDestructorCall), got
no callee_type metadata and therefore no indirect callee type identifiers
in the .llvm.callgraph section, so the call graph missed those edges.
Attach the metadata to the emitted call instruction regardless of whether
the caller asked for it.
Stacked on #230831.
Assisted-by: Claude
[clang][CodeGen] Identify virtual methods by their override chain root in the call graph section
A virtual call site is annotated with the type of the method named at the
call site (e.g. `Base::clone` for `b->clone()` with `b` of type `Base *`),
but it can reach any overrider of that method. Overriders may differ from
the overridden method only in their covariant return type, in which case
their call graph section type identifier (`!callgraph`) did not match the
type identifier of the call site (`!callee_type`), so the call graph
missed the edge: `Derived *Derived::clone()` was identified as
`_ZTSFP7DerivedvE`, while calls through `Base *` were typed
`_ZTSFP4BasevE`.
Identify every method of an override chain, at the definition and at the
call site, by the type of the method that introduced the virtual function
(the root of the override chain), so that virtual calls through a pointer
to any class of the hierarchy match the overriders they can reach. A
method that overrides several virtual functions with different covariant
return types is identified after the first one; the return adjusting
thunks that fill the vtable slots created by the other overridden methods
[14 lines not shown]
[SLP]Count splats as single broadcast for in-loop trees
The loop-aware instruction-count check scaled the per-lane count of
splat gather entries by the trip count, rejecting profitable trees.
A splat is a single broadcast regardless of the loop scale. Fixes
4-6% RAJAPerf Apps_DIFFUSION3DPA regression on AArch64 introduced
by #211096.
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/230821
[ConstantFolding] Fold `bitinsert` and `bitextract` (#229115)
Constant fold `bitinsert` and `bitextract`.
- Bits of a `ConstantByte` are extracted or inserted, then reinterpreted
as if by `bitcast`.
- A `bitinsert` that overwrites every bit of the base becomes a
`bitcast` of the value.
- An out-of-range, `poison` source or `poison`/`undef` offset returns
`poison`.
```llvm
%a = bitextract i8, b32 512, i32 8 ; i8 2
%b = bitinsert b32 0, i8 1, i32 8 ; b32 256
%c = bitinsert b16 0, half 1.0, i32 0 ; b16 15360, the bits of half 1.0
%d = bitextract i8, b32 0, i32 25 ; i8 poison
```
[Option] Add OptionalValueField, OptionalEnumField, and list fields (#230812)
OptionalValueField and OptionalEnumField declare a std::optional member,
staying std::nullopt if unspecified.
ListField declares an ArrayRef member replacing a cl::list with
cl::CommaSeparated: each occurrence appends its comma-separated values,
keeping the struct trivially destructible. The elements live alongside
the argument copies, in the BumpPtrAllocator that
cl::LibraryOptions::parse now takes, until the next reset. EnumListField
maps the values to enumerators as EnumField does.
Aided by Opus 5.5