[MemProf] Enhance -memprof-report-hinted-sizes with post-cloning path… (#234265)
Previously, `-memprof-report-hinted-sizes` (`printTotalSizes()`, which
runs after `assignFunctions()`) only reported the `AllocTypes` of the
leaf allocation node in the abstract CallsiteContextGraph (CCG) for each
context. It did not show the actual cloned call paths or the final
coldness state of the allocation clones that the context reaches after
function cloning.
When function clone assignment goes wrong (e.g. callers above a trimmed
MIB context cloned for another allocation, as fixed by #230351, or
cloned callsites/allocations left pointing at default `NotCold`/`None`
clones), an abstract leaf node can appear `Cold` in the old report while
the actual post-cloning call path loses the cold hint. The detail report
makes such cases visible by showing the real path from each caller
clone.
This patch adds `-memprof-report-hinted-sizes-detail` (off by default;
used together with `-memprof-report-hinted-sizes`). When enabled, it
[25 lines not shown]
[SPARC] Emit correct CFI for leaf procedures with a stack frame (#236588)
A leaf procedure that needs a stack frame allocates it by adjusting %sp
with add instead of executing save. The prologue still emitted the
non-leaf CFI (.cfi_def_cfa_register %fp, .cfi_window_save and
.cfi_register %o7, %i7), describing a register window that was never
created. An unwinder would then take the CFA from %fp and the return
address from %i7, both of which still belong to the caller.
For leaf procedures, only update the CFA offset to account for the
stack adjustment, including the stack bias on SPARC64. The CFA stays
%sp-based and the return address stays in %o7.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Attributor: Deduce noundef returns if poison-generating attributes hold
Instead of giving up on noundef for returns with poison-generating
attributes, check that the attributes are assumed to hold for all
returned values. This uses the Attributor's own deductions for the
returned values (AANonNull, AAAlign, AAValueConstantRange and
AANoFPClass), so e.g. a range only known from a callee is enough.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Attributor: Don't infer noundef returns with poison-generating attributes (#231796)
Returning a value that violates an existing return attribute results
in poison. AANoUndef did not account for this and could mark such
returns noundef. Give up on returns with poison-generating attributes.
Unlike FunctionAttrs, this does not try to prove that the attributes
hold for the returned values. This loses 2 of 3 noundef returns that
would have been proven over CTMark with -attributor-enable=full, and
no call site attributes. In the future it should check if they can be
preserved for parity with functionattrs.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[Passes] Wire up CFIFixup into NewPM (#237484)
Not sure how this got missed. This has been in TargetPassConfig for
quite a while, and this patch mirrors it in the base CGPB.
[AArch64][PowerPC][RISCV] Ignore debug instructions when trimming stackmap shadows (#219756)
Debug instructions do not emit code and therefore must not consume
stackmap
shadow bytes.
The AArch64, PowerPC, and RISC-V `LowerSTACKMAP` implementations scan
subsequent fixed-width instructions to determine how many NOP bytes are
still
required. Previously, `DBG_VALUE` stopped this scan, while other debug
instructions such as `DBG_LABEL` were incorrectly counted as encoded
instructions. This could either inhibit shadow optimization or underfill
the
requested shadow.
Skip all debug instructions without decrementing the remaining shadow
size.
Add `DBG_LABEL` and `DBG_VALUE` regression coverage for all three
targets.
[4 lines not shown]
RuntimeLibcalls: Describe vector FuncArgTypes by element type and count
Define the vector libcall argument types from an element type and
count. Derive the matching integer and mask vector types from them
instead of spelling each one out.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[MSan][Test] Add baseline test for llvm.experimental.vector.extract.last.active (#237415)
This is a baseline test before patching
https://github.com/llvm/llvm-project/pull/233552.
This test shows vector.extract.last.active is being handled strictly.
Assisted-by: Gemini
[NVPTX] Use target nodes for clz.b64 and popc.b64 (#236435)
Since #130668, 64-bit ctlz and ctpop are lowered to an i32 ctlz/ctpop of
the i64 operand. DAG combines assume the result is as wide as the
operand, so e.g. `__builtin_clzll(x | 1) >> 5` gets folded to 0, and
some compares of a 64-bit cttz hit an assertion. Use NVPTX-specific
nodes for clz.b64 and popc.b64 instead.
Fixes #235271.
Assisted-by: Claude Code (Claude Opus 5.5)
clang: Do not pass an empty -syslibroot for --sysroot= on Darwin (#229421)
-isysroot and DEFAULT_SYSROOT, but it checked only for the presence
of the option. An empty --sysroot= then produced -syslibroot "",
where previously it fell through to -isysroot. An empty --sysroot= is
the usual way to defeat DEFAULT_SYSROOT, so treat it as absent.
Use this to fix the darwin-static-lib tests when clang is built with
DEFAULT_SYSROOT or CLANG_USE_XCSELECT.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
PowerPC: Remove LiveVariables run and unused LiveIntervals requirement (#235059)
PPCTLSDynamicCall has not used LiveIntervals since 3ff319c69047, but
still required the analysis. LiveIntervals requires there to be no
unreachable blocks or otherwise it asserts. These blocks were
indirectly removed by adding the extra LiveVariables run, because
LiveVariables has a declared requirement on
UnreachableMachineBasicBlockElim.
Drop the dead analysis requirements along with the LiveVariables run.
This also avoids computing LiveIntervals at -O0 for PIC. This is
still broken if the pipeliner is explicitly enabled on optnone
functions which requires a separate fix.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Use element alignment for vector libcall out pointers
The pointer arguments of the vector modf, sincos and sincospi functions
are linear pointers to the scalar element type (e.g. the l4 in
_ZGVnN4vl4l4_sincosf), not pointers to the vector type. Only the element
alignment is guaranteed, so stop declaring them with the ABI alignment
of the vector.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
CodeGen: Maintain the dominator tree in MachinePipeliner
LiveIntervals computes live ranges using the dominator tree, but the
modulo schedule expanders change the CFG without updating
it. Intervals computed later in the pass therefore see a tree missing
the new prolog, kernel and epilog blocks. This is latent today, but
reachability. The unregistered blocks would be incorrectly treated as
unreachable.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[clang][CodeGen] Fix missing terminator when a new-expression initializer starts with a loop (#230902)
Fixes #175427
`EmitCXXNewExpr` marks the point where the operator delete cleanup
becomes active with a placeholder `unreachable` and erases it once the
initializer is emitted. If the initializer starts with a loop or a
label, `EmitBlock` takes that terminator as the end of the block and
emits no fall-through branch, so erasing the placeholder leaves the
block unterminated and valid code fails with "Broken module found".
The marker only has to be an instruction that the deactivation can
insert a store before, while the rest of CodeGen assumes the current
block has no terminator until a real one is written. The placeholder is
now the `i1` load from null that the other cleanup markers already use,
so the block stays open and `EmitBlock` branches normally. The same
marker in `EmitDelegateCallArg` is switched for consistency.
LLM tools were used for this contribution.
[AMDGPU] Address review comments on AVGPR banking
Keep the larger bank excess in initCandidate.
In checkScheduling, distribute the AVGPR pressure of each program point
across the banks instead of the region maximum, which can hide a rigid
ArchVGPR peak at another point.
Co-authored-by: Cursor <cursoragent at cursor.com>