[LiveDebugVariables] Repair stale SlotIndexes
The analysis keeps its indexes from before the first register allocator
until DBG_VALUEs are emitted, by which point passes in between have
erased some of the instructions they point at. Resolve them at the
start of each allocator run and before emitting.
SlotIndexes can then reclaim the entries of erased instructions without
sparing the ones held here, which would have made generated code depend
on -g. Emitted locations are unchanged, except that intervals resolving
to one position now emit a single DBG_VALUE rather than identical
consecutive ones.
[SlotIndexes] Add queries for stale indexes
An erased instruction leaves its index list entry in place, making the
index indistinguishable from a block boundary entry. Add
isBlockBoundaryIndex() and isStaleIndex() to tell the two apart, and
canonicalizeIndex() to resolve a stale index to the closest preceding
instruction's register slot, or the block start if none survives.
NFC. No caller yet. LiveDebugVariables is next.
[CMake] Give LLVM_EXTERNAL_PROJECTS installs a default component (#227799)
Summary:
These LLVM external projects are intended to be extension points for
extra utilitie shipped through LLVM. LLVM tries to provide dedicated
components to its targets, so we should create one by default in LLVM
for these external dependencies.
FastISel: Mark implicit physreg defs dead when emitting instructions (#227598)
fastEmitInst_* callers only use the explicit result, so the implicit
physical register defs of the emitted instruction are unused.
InstrEmitter would mark these as dead, but fast isel would end up
relying on
later dead flag computation in LiveVariables or RegAllocFast.
The X86 with-overflow lowering is the one caller that reads an implicit
def, so handle that separately.
Co-authored-by: Claude Opus 5 <noreply at anthropic.com>
[VPlan] Add epilogue VPlan print tests with AnyOf and FindIV (NFC) (#227827)
Add printing tests with epilogue loops with AnyOf and FindIV reductions.
They need special handling for their resume values, which is not
yet modeled in VPlan.
[CMake] Give LLVM_EXTERNAL_PROJECTS installs a default component (#227799)
Summary:
These LLVM external projects are intended to be extension points for
extra utilitie shipped through LLVM. LLVM tries to provide dedicated
components to its targets, so we should create one by default in LLVM
for these external dependencies.
[PGO] Avoid dangling references when LoopToCandidates grows (#227579)
PGOCounterPromoter::promoteCandidates sinks profile counter load/store
updates out of a loop L to its exit blocks.
This patch fixes the following assertion failure (and a
heap-use-after-free in -DNDEBUG builds):
assert(LoopToCandidates.isPointerIntoBucketsArray(Ptr) &&
"References into LoopToCandidates might be invalid");
where LoopToCandidates is:
DenseMap<Loop *, SmallVector<LoadStorePair, 8>> &LoopToCandidates;
Without this patch:
Cand = {nullptr, nullptr};
[18 lines not shown]
[SSAF][NFC] Enforce type constraints in insertReachable during reachability DFS
UnsafeBufferReachableAnalysis used to apply C3 (type-constrained pointers
are never unsafe) by pre-filtering three separate inputs in initialize():
the pointer-flow edges, the C1 starters, and the override-family members.
This made the family closure (C4) aware of type constraints.
Enforce C3 in one place instead: insertReachable() refuses type-constrained
pointers, and every starter, flow successor, and family member goes through
it. A constrained pointer is thus never reached, and the search never
passes through it, which is exactly what the pre-filtering achieved.
With the edge filter gone, the analysis no longer needs its own copy of the
pointer-flow graph, and walks the dependency's edges directly. This also
avoids copying the destination set of every visited node per contributor.
Addresses review feedback on #213319:
https://github.com/llvm/llvm-project/pull/213319#discussion_r4136700164
The check lives in insertReachable() rather than in each
[4 lines not shown]
[SSAF][NFC] Add type-constraint edge-case tests for unsafe-buffer reachability
Type-constrained pointers are never unsafe (C3). So far only
FamilyClosureSkipsTypeConstrainedMember exercised this in the unit tests.
Pin down the remaining cases: a constrained starter, a constrained node in
the middle of a flow chain, a constrained sink, and a constrained starter
that belongs to an override family.
This is in preparation for enforcing C3 during the reachability search
instead of pre-filtering the analysis inputs.
Co-Authored-By: claude
[AMDGPU] Price scalar integer to fp casts by source width and sign
Scalar sources between a byte and 31 bits fell to the default cost of one
while the matching vector lanes were already priced, which skewed the
difference SLP weighs a bundle against. Such a source is extended before
the conversion, and what the extension takes depends on the width, on the
sign and on whether the subtarget has SDWA and 16 bit instructions.
Sources narrower than a byte are left alone, because their vector form is
not priced either.
[AMDGPU] Price narrow integer to bfloat vector casts
A vector lane of 9 to 15 or 17 to 31 bits converted to bfloat got the
generic cost, which leaves out the rounding. Such a lane is converted to
f32 first like any other narrow lane, so price it as the f32 conversion of
the same source plus the rounding. Lanes of 8 and 16 bits keep their cost.