[SPARC] Give the leaf epilogue's stack adjustment a debug location (#235247)
The stack adjustment in a leaf function's epilogue was built with an
empty DebugLoc, so it inherits the line of whatever precedes it and the
row for the return's line starts after it. A breakpoint on that line
then stops with the frame already released, and %sp-based variable
locations read the wrong slots.
Use the return's location, as the non-leaf restore already does.
The delay slot filler currently hides this by moving the adjustment
into the delay slot of the retl; it shows once that slot is not filled,
see #235235.
Assisted-by: Claude Code (Claude Opus 5.5)
[mlir] Optimize `isOpTriviallyDead` greedy rewriter checks for deeply nested IR (#231423)
See the discussion
https://github.com/llvm/llvm-project/pull/230961#issuecomment-6130021318
Driver checks `isOpTriviallyDead` after each IR modifications and
`isOpTriviallyDead` walked the entire nested chain for
`HasRecursiveMemoryEffects`.
Cache op deadness in driver and invalidate on IR change.
Also, `Operation *dumpRootOp = getDumpRootOp(op);` only needed for debug
printing was called unconditionally and was also noticeable in profiler.
Call it only if debug printing is actually enabled.
Added synthetic 1000-nested IR test, generated by python. Test doesn't
actually check execution times, but I hope someone will notice if it
suddenly start to take 30s.
[9 lines not shown]
[AMDGPU] Rename the max() of GCNRegPressure to maxPerRegFile()
The function no longer takes the maximum of each component: it takes the VGPR and AVGPR counts from the same operand. A plain max() name suggests a component-wise maximum, so the new name states that the result is the maximum per register file.
The function now computes each component once, in one loop over Value.
[flang] Undefine HUGE after including cmath (#236221)
Older glibc versions expose HUGE through <cmath> after Flang's headers
have undefined it. This breaks the RealValueImpl::HUGE definition and
calls, as well as the RealValue unit tests and their HUGE test name.
The glibc version I could reproduce the issue on was 2.26.
[InstCombine] Generalize existing pattern from "abs(val) != 0 -> val != 0" to "abs(val) == 0 -> val == 0" (#233763)
Generalize fold of `(c ? x : -x) != 0` to `x != 0` by moving the pattern
to stripNullTest() and thus also supporting `==` predicates and other
patterns supported by that helper.
The missed pattern is noticed in Google Abseil's demangler
(https://github.com/abseil/abseil-cpp/blob/master/absl/debugging/internal/demangle.cc).
Proof: https://alive2.llvm.org/ce/z/7WQeXT
Fixes #233753
Assisted-by: Qwen3.7-Plus, which helps me locate the existing pattern
instead of opening a new pattern.
[AMDGPU] Custom lower dynamic insertelt on wide vectors of 16-bit elements (#232288)
Currently, in case of dynamic-index `insertelement` into v8, v16 and v32
of i16, f16 and bf16 was set to Expand. At -O1 and above, single inserts
were expanded into a select per element and chains of inserts were
folded into a stack temporary. At -O0, every insert went through the
stack unconditionally.
This patch extends the existing `v_bfi_b32` custom lowering, previously
limited to 64-bit vectors, to the 16-bit wide vectors as well, making
`INSERT_VECTOR_ELT` as now Custom for them, so legalization uses the
custom lowering at all optimization levels, and the generic DAGCombiner
chain fold, which only applies to Expand types, no longer fires.
In 'lowerINSERT_VECTOR_ELT' each 64-bit sized piece updates with `(Mask
& splat(Val)) | (~Mask & Piece)`, where only the piece holding the index
gets a nonzero mask, alongwith skipping `performInsertVectorEltCombine`
that use select-per-element expansion for such types, since the custom
lowering is cheaper. wider i8 vectors still use the stack.
[flang][AddAliasTags] OpenMP privatization is a local allocation (#236201)
OpenMP privatization generates code which looks a bit like this
```
%host = ...
omp.parallel private(@privatizer %host -> %private_copy : !fir.ref<type>) {
%priv = fir.declare %private_copy ... -> !fir.ref<type>
}
```
`fir::AliasAnalysis` already correctly categorises accesses to these
private variables (`%priv` in this example) as local allocations. It
reports the source operation for the allocation as being the
`fir.declare` operation (as there is no allocation operation visible in
mlir).
When AddAliasTags processed this access it did not handle allocations
having `fir.declare` as their source and so was not able to give it the
local allocation tag. This commit fixes that by treating `fir.declare`
[15 lines not shown]
[MLIR] Fix regression in linking to `MLIRAnalysisBase` via dylib (#236359)
Fix the regression introduced in #232793 where the `MLIRTestIR` library
ends up linking directly to `MLIRAnalysisBase` rather than to `MLIR`
dylib, and therefore duplicate it and all the static libraries it
depends on the linker command line.
Signed-off-by: Michał Górny <mgorny at gentoo.org>
[AArch64][ISel] Fix crash for partial reduction actions (#236179)
getPartialReduceMLAAction assumed that the provided VTs would always be
simple, and crashed if not. So we should just bail out in such cases
(e.g. invalid non-power-of-two element types) by defaulting to Expand.
[AArch64] Allow selecting shifted register from and with UBFX. (#233882)
For LSL/LSR, it required a mask or field extending to MSB, but UBFX can
extract smaller fields.
[libc++] Make __thread_hardware_concurrency() an alias to an existing symbol (#234575)
This PR changes `__thread_hardware_concurrency()` to be an alias to
`std::thread::hardware_concurrency()`, which is already exported from
the ABI.
Also adds the `_LIBCPP_ABI_NAMESPACE_LEN` macro to simplify the name
mangling.
[CVP] Restructure pass to use `CVPImpl` implementation class, unify style (NFC) (#236038)
CorrelatedValuePropagation instruction-processing routines and helpers
have been abstracted out into a dedicated implementation class, so as to
avoid threading LVI, among other things. Minor opportunity to modernize
code and unify style where possible.
[mlir] Read the attr dictionary directly in getDialectAttrs (#236339)
getAttrs also copies attrs from properties on every call, but dialect
attrs are never stored there
LLVM IR translation calls getDialectAttrs() on every op, skipping the
dictionary rebuild for ops with properties makes translation faster,
visible on large modules
[lldb][test] Disable TestAttachWaitConnected.py on Linux (#236357)
It has been flaky on the AArch64 Linux buildbot and I do not think the
reason will be related to the architecture.
See #236354.