LLVM/project b8309c6utils/bazel/llvm-project-overlay/mlir BUILD.bazel, utils/bazel/llvm-project-overlay/mlir/test BUILD.bazel

[mlir:bazel] Expose "expsensive pattern API checks" as build flag. (#216673)

This PR exposes the `MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS`
definition as a build flag in the Bazel build. This makes it more easy
to run these expensive checks as a CI task. The new flag can be used as
follows:

```
bazelisk build \
    --@llvm-project//mlir:enable_expensive_pattern_api_checks \
    ${BUILD_TARGETS}
```

Signed-off-by: Ingo Müller <ingomueller at google.com>
DeltaFile
+18-2utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+8-1utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
+26-32 files

LLVM/project 426be1ellvm/lib/Transforms/Vectorize VPlanConstruction.cpp, llvm/test/Transforms/LoopVectorize compress-idioms.ll

Fix crash
DeltaFile
+143-0llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+9-3llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+152-32 files

LLVM/project 47c970fllvm/lib/CodeGen/GlobalISel IRTranslator.cpp

[𝘀𝗽𝗿] changes to main this commit is based on

Created using spr 1.3.7

[skip ci]
DeltaFile
+2-3llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+2-31 files

LLVM/project a07e3fallvm/include/llvm/CodeGen/GlobalISel Legalizer.h, llvm/lib/CodeGen/GlobalISel IRTranslator.cpp Legalizer.cpp

[𝘀𝗽𝗿] initial version

Created using spr 1.3.7
DeltaFile
+72-28llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
+35-17llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h
+3-3llvm/unittests/CodeGen/GlobalISel/LegalizerTest.cpp
+2-3llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+2-2llvm/test/CodeGen/MIR/AArch64/deactivation-symbols.mir
+1-1llvm/lib/Target/X86/X86TargetMachine.cpp
+115-5413 files not shown
+128-6619 files

LLVM/project a1a534cllvm/test/CodeGen/SPIRV/linkage weak-linkage.ll

[NFC][SPIR-V] Enable spirv-val for SPV_AMD_weak_linkage test (#216316)

WeakLinkageAMD is now defined in SPIR-V Headers:
https://github.com/KhronosGroup/SPIRV-Headers/pull/583
DeltaFile
+1-2llvm/test/CodeGen/SPIRV/linkage/weak-linkage.ll
+1-21 files

LLVM/project 82cfac2llvm/lib/CodeGen/GlobalISel IRTranslator.cpp

[𝘀𝗽𝗿] initial version

Created using spr 1.3.7
DeltaFile
+2-3llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+2-31 files

LLVM/project 025da4amlir/include/mlir/Dialect/Linalg/Transforms Transforms.h

[mlir] Remove dead declaration populateSparseTensorRewriting (#216942)

The corresponding function definition was removed on July 15, 2022 in
commit 28ebb0b61d110e4b108fc1ebcbc43d50fff8f087.
DeltaFile
+0-3mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+0-31 files

LLVM/project 04c879allvm/include/llvm/Analysis ScalarEvolution.h, llvm/lib/Analysis ScalarEvolution.cpp

[SCEV] Make operand use flags part of expression's identity. (#216604)

Update hashing for SCEVNodes to include the use-specific operand flags.
This makes sure expression with different operand flags distinct. Going
forward, this ensures that various maps that cache SCEV expressions
handle use-specific operands correctly.

PR: https://github.com/llvm/llvm-project/pull/216604
DeltaFile
+57-0llvm/unittests/Analysis/ScalarEvolutionTest.cpp
+15-25llvm/lib/Analysis/ScalarEvolution.cpp
+3-1llvm/include/llvm/Analysis/ScalarEvolution.h
+75-263 files

LLVM/project efd053fllvm/lib/Transforms/Utils Local.cpp PromoteMemoryToRegister.cpp, llvm/test/Transforms/PhaseOrdering always-inline-alloca-promotion.ll

[PromoteMemToReg] Insert store undef when removing lifetime markers (#191909)

The `lifetime.start` and `lifetime.end` can help avoid the creation of
spurious phi-node.

For example, when a local struct/array is declared in a loop, Clang
will generate a `alloca` outside the loop (required) and annotate
the loop body with `lifetime.start` and `lifetime.end` to remember
that there are no loop-carried live values. It is currently mostly
used by stack coloring, but we can use it to improve SSA too.

In particular, `sroa` and `mem2reg` did not leverage those lifetime
informations and will sometimes create spurious phi-nodes that
are not always cleaned-up later on (see unit test).

As `mem2reg` simply deletes the lifetime intrinsic before promoting
to SSA, it forgets the lifetime information completely. We improve this
by inserting a `store undef` in place of each
`lifetime.start`/`lifetime.end`

    [5 lines not shown]
DeltaFile
+190-0llvm/test/Transforms/SROA/lifetime-aware-phi.ll
+32-3llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+7-7llvm/test/Transforms/PhaseOrdering/ARM/arm_var_q31.ll
+2-4llvm/test/Transforms/PhaseOrdering/always-inline-alloca-promotion.ll
+3-0llvm/lib/Transforms/Utils/Local.cpp
+1-1llvm/test/Transforms/PhaseOrdering/ARM/arm_mean_q7.ll
+235-156 files

LLVM/project 6473ad5llvm/lib/Target/AMDGPU AMDGPULibCalls.cpp, llvm/test/CodeGen/AMDGPU amdgpu-simplify-libcall-constant-fold.ll

[AMDGPU] Fix miscompile folding math calls with poison/undef vector lanes (#216971)

A poison or undef lane made evaluateCall ConstantDataVector cast fail,
and evaluateScalarMathFunc silently treated the missing operand as 0.0,
producing wrong results instead of bailing out
DeltaFile
+88-0llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-constant-fold.ll
+23-20llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+111-202 files

LLVM/project 8c1cd84llvm/lib/Target/AMDGPU AMDGPULowerBufferFatPointers.cpp, llvm/test/CodeGen/AMDGPU lower-buffer-fat-pointers-p7-in-memory.ll

[AMDGPU] Fix miscompile from stale value cache in LowerBufferFatPointers (#216962)

ConvertedForStore cached a p7->int conversion per Value across the whole
function, so a second store of the same fat pointer in a non-dominating
block reused an instruction from the first block, breaking dominance
DeltaFile
+38-0llvm/test/CodeGen/AMDGPU/lower-buffer-fat-pointers-p7-in-memory.ll
+2-12llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp
+40-122 files

LLVM/project c8c439allvm/lib/Transforms/Vectorize LoopVectorizationLegality.cpp

Fixups
DeltaFile
+4-6llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+4-61 files

LLVM/project aeca99cmlir/include/mlir/Interfaces CallInterfaces.td, mlir/test/Interfaces/CallInterfaces call-op-interface-roundtrip.mlir call-op-interface-invalid.mlir

drop areTypesEqual
DeltaFile
+0-199mlir/test/Interfaces/CallInterfaces/verify-call-op-interface.mlir
+111-0mlir/test/Interfaces/CallInterfaces/call-op-interface-invalid.mlir
+63-0mlir/test/Interfaces/CallInterfaces/call-op-interface-roundtrip.mlir
+0-33mlir/test/lib/Dialect/Test/TestOpDefs.cpp
+7-21mlir/include/mlir/Interfaces/CallInterfaces.td
+0-19mlir/test/lib/Dialect/Test/TestOps.td
+181-2725 files not shown
+187-28911 files

LLVM/project eb57234llvm/lib/Target/AMDGPU AMDGPULibCalls.cpp, llvm/test/CodeGen/AMDGPU amdgpu-simplify-libcall-tdo-cos.ll

[AMDGPU] Fix crash folding cos/sin table lookups on poison/undef vector lanes (#216972)

TDOFold cast the lane directly to ConstantFP, which aborts under
assertions when a lane is poison or undef instead of a table lookup
failure
DeltaFile
+13-0llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-tdo-cos.ll
+6-2llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+19-22 files

LLVM/project 21b3511llvm/include/llvm/Analysis LoopAccessAnalysis.h, llvm/include/llvm/Transforms/Vectorize LoopVectorizationLegality.h

Rework
DeltaFile
+11-8llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+2-16llvm/lib/Analysis/LoopAccessAnalysis.cpp
+8-9llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+1-3llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+3-1llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
+25-375 files

LLVM/project 5f4af9bllvm/lib/Analysis LoopAccessAnalysis.cpp, llvm/lib/Transforms/Vectorize LoopVectorizationLegality.cpp VPlanTransforms.h

Rework
DeltaFile
+117-0llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+0-53llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+6-35llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+16-2llvm/lib/Analysis/LoopAccessAnalysis.cpp
+9-7llvm/lib/Transforms/Vectorize/VPlanTransforms.h
+11-4llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+159-1014 files not shown
+167-11610 files

LLVM/project 74562e4llvm/lib/Transforms/Vectorize VPlanHelpers.h LoopVectorize.cpp

Remove helper
DeltaFile
+0-5llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+0-4llvm/lib/Transforms/Vectorize/VPlanHelpers.h
+0-92 files

LLVM/project b77e40allvm/test/Transforms/LoopVectorize compress-idioms.ll

Add test
DeltaFile
+112-2llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+112-21 files

LLVM/project b2f2929llvm/lib/Transforms/Vectorize VPlan.h VPlanRecipes.cpp, llvm/test/Transforms/LoopVectorize compress-idioms-negative-tests.ll compress-idioms.ll

Fixups
DeltaFile
+106-2llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+3-32llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+0-32llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+0-9llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+2-2llvm/test/Transforms/LoopVectorize/compress-idioms-negative-tests.ll
+0-3llvm/lib/Transforms/Vectorize/VPlan.h
+111-806 files

LLVM/project d0c10cellvm/include/llvm/Analysis VectorUtils.h, llvm/lib/Transforms/Vectorize LoopVectorizationLegality.cpp

Fixups
DeltaFile
+1-2llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+1-1llvm/include/llvm/Analysis/VectorUtils.h
+2-32 files

LLVM/project dc0915dllvm/include/llvm/Transforms/Vectorize LoopVectorizationLegality.h, llvm/lib/Transforms/Vectorize VPlanTransforms.cpp VPRecipeBuilder.h

Fixups
DeltaFile
+112-118llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+47-32llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+18-8llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+13-3llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
+5-0llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
+4-0llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+199-1616 files

LLVM/project 2d0aa1dllvm/test/Transforms/LoopVectorize compress-store-vec-epilogue.ll compress-idioms.ll

Rebase fixups
DeltaFile
+8-8llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+3-3llvm/test/Transforms/LoopVectorize/compress-store-vec-epilogue.ll
+11-112 files

LLVM/project 20ac388llvm/test/Transforms/LoopVectorize compress-idioms.ll

Test uncond increment
DeltaFile
+96-2llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+96-21 files

LLVM/project d87b107llvm/lib/Transforms/Vectorize VPlanRecipes.cpp, llvm/test/Transforms/LoopVectorize compress-idioms-negative-tests.ll compress-idioms.ll

Move negative tests to new file
DeltaFile
+0-105llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+94-0llvm/test/Transforms/LoopVectorize/compress-idioms-negative-tests.ll
+0-1llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+94-1063 files

LLVM/project b0b7e6bllvm/lib/Transforms/Vectorize VPlanTransforms.cpp VPlan.h, llvm/test/Transforms/LoopVectorize compress-idioms.ll

[LoopVectorize] Support vectorization of compressing patterns in VPlan

RFC link: https://discourse.llvm.org/t/rfc-loop-vectorization-of-compress-store-expand-load-patterns/86442

This adds loop vectorizer support for "compressing" patterns,
for example:

```
int dst_idx = 0;
for (int i = 0; i < n; i++) {
  if (cond[i])
    dst[dst_idx++] = src[i];
}
```

Can be vectorized with a `llvm.masked.compressstore` as:

```
int dst_idx = 0;

    [52 lines not shown]
DeltaFile
+424-0llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+157-0llvm/test/Transforms/LoopVectorize/VPlan/compress-idioms.ll
+132-0llvm/test/Transforms/LoopVectorize/AArch64/compress-idioms.ll
+111-14llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+60-4llvm/lib/Transforms/Vectorize/VPlan.h
+49-0llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+933-1815 files not shown
+1,116-2621 files

LLVM/project c6c5710llvm/lib/Transforms/Vectorize VPlanConstruction.cpp VPlan.h

Don't allow null phi
DeltaFile
+4-6llvm/lib/Transforms/Vectorize/VPlan.h
+1-1llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+5-72 files

LLVM/project fc04ca0llvm/lib/Transforms/Vectorize LoopVectorize.cpp VPlan.h, llvm/test/Transforms/LoopVectorize compress-store-vec-epilogue.ll

Fix epilogue resume handling
DeltaFile
+98-0llvm/test/Transforms/LoopVectorize/compress-store-vec-epilogue.ll
+5-5llvm/lib/Transforms/Vectorize/VPlan.h
+2-1llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+105-63 files

LLVM/project a2916f7llvm/lib/Target/SPIRV SPIRVPrepareFunctions.cpp, llvm/test/CodeGen/SPIRV/passes SPIRVPrepareFunctions-invoke.ll

[SPIR-V] Patch invoke/callbr call sites when legalizing function signatures (#217000)

Only CallInst was patched before RAUW, leaving invoke/callbr with a
stale FunctionType and a broken verifier

follow up change for https://github.com/llvm/llvm-project/pull/216638
DeltaFile
+23-0llvm/test/CodeGen/SPIRV/passes/SPIRVPrepareFunctions-invoke.ll
+6-2llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp
+29-22 files

LLVM/project 0c4a910llvm/include/llvm/Analysis IVDescriptors.h, llvm/lib/Analysis IVDescriptors.cpp

Rework
DeltaFile
+20-20llvm/include/llvm/Analysis/IVDescriptors.h
+15-15llvm/lib/Analysis/IVDescriptors.cpp
+35-352 files

LLVM/project 46215d6llvm/lib/Target/AMDGPU AMDGPULowerBufferFatPointers.cpp, llvm/test/CodeGen/AMDGPU lower-buffer-fat-pointers-pointer-ops.ll

[AMDGPU] Fix poison result on inttoptr a narrow integer to ptr addrspace(7) in LowerBufferFatPointers (#216966)

The unconditional shift by BufferOffsetWidth overshifted for narrower
sources, folding to poison instead of the correctly zero-extended null
resource half
DeltaFile
+34-1llvm/test/CodeGen/AMDGPU/lower-buffer-fat-pointers-pointer-ops.ll
+10-4llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp
+44-52 files