[mlir][SPIR-V] Round trip OpConstantNull of pointer and composite types (#241923)
Deserializer failed with "unsupported OpConstantNull type" on thes
types, map them to and from #spirv.null
Depends on #241765
[AArch64] Update test generator script for atomics (#241331)
Update the test generator script for AArch64 atomics to generate tests
for FP load/stores.
Also, update the test files accordingly.
[LLVM][SelectionDAG] Use WidenVecRes_Binary to widen fcopysign variants with matching operand types. (#238807)
ISD::FCOPYSIGN cannot trap, so doesn't need to call
WidenVecRes_BinaryCanTrap.
[cmake] Centralize LLVM ABI compile definitions (#239689)
This adds a helper function, `llvm_update_abi_definitions()`, that
updates the ABI-related compile definitions in a centralized manner. The
helper narrows down the compile definitions to where they are actually
needed, which is only in the MSVC/clang-cl dylib build. As a side
effect, this removes PCH-related warnings concerning these defines in
the non-dylib and non-MSVC builds.
This changes the `LLVM_BUILD_LLVM_DYLIB=ON`/`LLVM_LINK_LLVM_DYLIB=OFF`
MSVC build behavior, which is non-functional anyway, and object
libraries now receive the same definitions as their target, which is
more correct.
This also updates the `abi-breaking.h` definitions for MinGW to match
`llvm/Support/Compiler.h` to prevent breakage.
This is a first step toward supporting PCHs in the LLVM dylib build on
Windows, tracked in #226993.
[31 lines not shown]
[AMDGPU] Expand 32-bit constant addresses for VMEM loads (#240829)
Uniform addrspace(6) loads that cannot use SMEM can pass a 32-bit
pointer to a VMEM instruction requiring a 64-bit address, causing
invalid copies or assertions during register allocation.
Fixes https://github.com/llvm/llvm-project/issues/239192
[CostModel] NFC: Rename masked_compress_load.ll -> masked_compress_store.ll (#242259)
Also simplified masked_expand_load.ll and masked_compress_store.ll by
moving the target triple from the RUN line to the IR.
[libc] Enable -Werror in baremetal_common.cmake cache file
After recent fixes, all the warnings are gone in baremetal builds.
Enable -Werror again so that we can catch warnings as they come.
[mlir][SPIR-V] Add ComplexToSPIRV lowering for complex.tan and complex.tanh (#242054)
Both ops share a single pattern parameterized on which trig/hyperbolic
functions play the real and imaginary roles, decomposed using
GLSL.std.450/OpenCL extended instructions
[MLIR][tensor] Missed Optimization: Incomplete elimination of a tensor.empty (#228032)
Earlier the replacement logic could only select one of the immediate
uses of tensor.empty. This patch fixes it by considering all the
immediate uses of tensor.empty (which is a potential candidate for
replacement) in different control flow paths.
So now for input.mlir:
```
module {
func.func @shared_empty(%arg0: i1, %arg1: f32, %arg2: f32, %arg3: tensor<16xf32>) -> tensor<16xf32> {
%0 = tensor.empty() : tensor<4xf32>
%1 = scf.if %arg0 -> (tensor<4xf32>) {
%2 = linalg.fill ins(%arg1 : f32) outs(%0 : tensor<4xf32>) -> tensor<4xf32>
scf.yield %2 : tensor<4xf32>
} else {
%2 = linalg.fill ins(%arg2 : f32) outs(%0 : tensor<4xf32>) -> tensor<4xf32>
scf.yield %2 : tensor<4xf32>
[51 lines not shown]
[mlir][bufferization] Avoid quadratic alias checks for known allocation roots (#242131)
### Summary
`SplitDeallocWhenNotAliasingAnyOther` currently rebuilds the remaining
operand list and performs pairwise alias checks for every memref in a
`bufferization.dealloc`. For a wide dealloc with distinct allocation
roots, this work scales quadratically with the number of operands.
This patch introduces an allocation-root fast path:
- Trace each candidate operand through `getViewBase` to a `memref.alloc`
root.
- Count occurrences of each root using `llvm::DenseMap<Value, int64_t>`.
- When all roots are known, determine whether a memref can split off by
checking if its root occurs exactly once.
- Keep the existing alias-analysis path for inputs with unknown origins.
The fast path avoids N copies of the operand list and N(N-1) pairwise
[34 lines not shown]
[LoongArch][NFC] Pre-commit tests for [x]vbitset/[x]vbitrev through bitcast
Add tests where the shift of splat(1) is done in a narrower element type
and then bitcast to the type of the or/xor operation.
Assisted-By: LLM
[LoongArch] Select [x]vbitset/[x]vbitrev for or/xor of bitcasted shl(splat(1), y)
When the shift of splat(1) is performed in a narrower element type than
the or/xor, e.g.
```llvm
%s = shl <8 x i16> splat (i16 1), %y
%m = bitcast <8 x i16> %s to <2 x i64>
%r = xor <2 x i64> %x, %m
```
the existing [x]vbitset.{b/h/w} and [x]vbitrev.{b/h/w} patterns fail to
match and we emit vrepli + vsll + vor.v/vxor.v.
Fold OP(bitcast(shl(splat(1), y)), x) into
bitcast(OP(shl(splat(1), y), bitcast(x))) for OP in {or, xor} so that
the operation is done in the shift's element type and selected as a
single [x]vbitset or [x]vbitrev.
Assisted-By: LLM
[WebAssembly] Truncate more with NARROW_U (#239626)
Add support for the following conversions:
- v4i16 -> v4i8
- v8i16 -> v8i8
- v4i32 -> v4 i16/i8
- v4i64 -> v4 i32/i16/i8
- v8i64 -> v8 16/i8
The cost model has also been updated.
[CIR] Return undef for unimplemented target builtin results (#236332)
A null RValue from an NYI target builtin crashed later uses of the
result
Return undef instead, like the other NYI paths in emitBuiltinExpr
[mlir][ODS] Add partitions for attributes and types
Allow attributes and types to be grouped into named partitions, like
ops. Each def can set `partition` to a `Partition` record. Passing
`-attrdefs-partition=<name>` or `-typedefs-partition=<name>` to the
attrdef/typedef decls and defs generators then emits only the defs of
that partition. A large dialect can thus split its attributes and types
over several compilation units with narrower headers.
The implementation mirrors the approach used in op partitioning
with a `register<DialectClass>Attributes` function (or Types) is used to register every attribute (or type) of the dialect and dispatches to partition specific functions.
The `generated{Parser,Printer}` function saw the biggest change.
It is not generated as `generated<DialectClass>{Attribute,Type}{Parser,Printer}` which is a method with public linkage.
This method is also generated for non-partitioned dialects and the old `generated{Parser,Printer}` function soft-deprecated (but for now retained for migration purposes).
The additional testing, the test dialect's attributes and types are split into the
partitions `Core` and `Syntax`.
This roughly halves the compile time (15.1s -> 6.7s + 6.9s) and peak memory (721 MiB -> 385 and
376 MiB) of the largest test dialect attribute compilation unit.
[2 lines not shown]