[AArch64] Fix SDAG lowering of small ints on the stack (#230142)
This commit fixes a bug in AArch64's SelectionDAG lowering of arguments
and call operands.
Specifically, in the Darwin calling convention, integers smaller than
i32 which were members of aggregates would be incorrectly lowered to
4-byte stack slots. This contrasted with the GlobalISel lowering of this
calling convention, which correctly assigned them to 1- or 2-byte slots.
For aggregate types, we were checking against the original type which,
since it isn't a simple type, was falling back to the i32 rule. The fix
is to instead consider each individual component of an aggregate.
In and of itself, this issue could go unnoticed as it was internally
consistent. We spotted it when a function lowered by GISel called a
function which itself fell back to SDAG lowering, resulting in an ABI
mismatch.
See #218676 which looks related.
[mlir] Detect hasLoop cycles with a single DFS
Calling isRegionReachable for every region the traversal popped made
hasLoop quadratic in the number of region successor edges. Use one
depth-first search from the entry regions instead. Reaching a region
that is still on the DFS stack is a loop, reaching a finished one is
not. Each region is queried at most once and the search stops at the
first loop.
Both traversals now get a region's successors from
RegionBranchOpInterface::getSuccessorRegions(Region &) instead of
asking each terminator with null operand attributes. The in-tree
terminators that override getSuccessorRegions (scf.condition and
cir.condition) return the same regions as their parent op when no
operand is constant.
Restore the dropped debug output. Rename the multi-branch test and
drive its mock op from attributes. Add tests for a diamond, a loop
through the entry region, a loop in an unreachable region and
[3 lines not shown]
[mlir][LLVM] Verify LLVMStructType element types in get() (#234091)
`using Base::verifyInvariants` pulled in StorageUserBase's variadic
no-op
verifier. `StorageUserBase::get` passes a `unique_function` emitter,
which
binds to that template exactly, so `getLiteral` skipped the element type
check even in assertions builds.
Drop the `using` and add a storage-key overload. Sub-element replacement
needs it because it rebuilds literal structs with `Base::get(ctx, key)`.
Assisted-by: Claude Code (Claude Opus 5.5)
[AMDGPU] Fix builtins using long int for 64-bit operands (#231500)
'long int' is 32-bit on Windows (LLP64) and 64-bit on Linux (LP64), and
HIP device compilation inherits the host integer widths via
AMDGPUTargetInfo::setAuxTarget(). Builtins declared with 'long int' but
mapped to intrinsics taking i64 therefore produce an invalid 'bitcast
i32 to i64' on Windows hosts.
[LoongArch] Lower FP_TO_SINT_SAT to [X]VFTINTRZ/FTINTRZ
The ftintrz.{w,l}.{s,d} and [x]vftintrz.{w.s,l.d} instructions saturate
out-of-range inputs to the minimum/maximum integer and convert NaN to 0
(when the invalid operation exception is not trapped), which matches the
semantics of llvm.fptosi.sat when the saturation width is the native
32/64 bits. This was verified on LA664 for all scalar, LSX and LASX variants
and matches QEMU's LoongArch model. Use them instead of the generic
expansion, which emits three compares and selects per element and fully
scalarizes vectors.
Also override shouldConvertFpToSat so DAGCombiner only folds min/max
clamps and NaN-guarded selects into FP_TO_SINT_SAT when that lowers to
a single ftintrz, avoiding the generic expansion for mismatched vector
element widths and for i64 results without the D extension.
This is what Rust emits for `f32 as i32`. rustc-perf svg-render-1 on
LA664: instructions -6.4%, cycles -4.0%.
editors/openoffice-4: fix build on powerpc64
set_soenv.in only knows the JRE library directories for gcj on powerpc64,
so the sax and bean modules were linked with three empty -L arguments
that swallowed -L/usr/local/lib. Set them for OpenJDK like on amd64.
databases/clickhouse: enable on powerpc64le
The bundled OpenSSL ships POWER8 assembly pre-generated with the
big-endian "linux64v2" perlasm flavour, which gives wrong AES results
on little-endian. Regenerate it with "linux64le" before configuring.
Until rtld annotates the end of the stack on powerpc64, the bundled
libunwind crashes when it collects a backtrace on the main thread.
Drop its fallback to the link register, as the base libunwind does.
Approved by: bofh (maintainer, via email)
databases/clickhouse-devel: enable on powerpc64le
The bundled OpenSSL ships POWER8 assembly pre-generated with the
big-endian "linux64v2" perlasm flavour, which gives wrong AES results
on little-endian. Regenerate it with "linux64le" before configuring.
Until rtld annotates the end of the stack on powerpc64, the bundled
libunwind crashes when it collects a backtrace on the main thread.
Drop its fallback to the link register, as the base libunwind does.
Approved by: bofh (maintainer, via email)
[CodeGenPrepare] Fold disjoint or into addressing modes (#233669)
The addressing-mode matcher only looks through `add`. When the address
is used in another block, the `or` is computed separately instead of
folding into the memory operand:
```
; before
leal 1(,%ecx,4), %ecx
movzbl (%eax,%ecx), %eax
; after
movzbl 1(%ecx,%eax,4), %eax
```
Treat `or disjoint` like `add`.
InstCombine canonicalizes `add X, C` to `or disjoint X, C` when the
operands have no common set bits
LLM-aided
[mlir] Detect hasLoop cycles with a single DFS
Calling isRegionReachable for every region the traversal popped made
hasLoop quadratic in the number of region successor edges. Use one
depth-first search from the entry regions instead. Reaching a region
that is still on the DFS stack is a loop, reaching a finished one is
not. Each region is queried at most once and the search stops at the
first loop.
Both traversals now get a region's successors from
RegionBranchOpInterface::getSuccessorRegions(Region &) instead of
asking each terminator with null operand attributes. The in-tree
terminators that override getSuccessorRegions (scf.condition and
cir.condition) return the same regions as their parent op when no
operand is constant.
Restore the dropped debug output. Rename the multi-branch test and
drive its mock op from attributes. Add tests for a diamond, a loop
through the entry region, a loop in an unreachable region and
[3 lines not shown]