SuccessChanges

Summary

  1. [mlir][vector] Add more vector Ops canonicalization (details)
  2. clang: Build and run FrontendTests with CLANG_ENABLE_STATIC_ANALYZER=OFF too (details)
  3. [LoopIdiom] Introduce 'left-shift until bittest' idiom (details)
  4. [LoopIdiom] 'left-shift until bittest' idiom: support constant bit mask (details)
  5. [LoopIdiom] 'left-shift until bittest' idiom: support canonical sign bit mask (details)
  6. [LoopIdiom] 'left-shift until bittest' idiom: support rewriting loop as countable, allow extra cruft (details)
  7. [mlir][spirv] Create a pass for testing SCFToSPIRV patterns (details)
  8. Append ".__part." to every basic block section symbol. (details)
  9. [mlir][spirv] NFC: rename SPIR-V conversion files for consistency (details)
  10. [IROutliner] Use isa instead of dyn_cast where the casted value isn't used. NFC (details)
  11. [mlir][spirv] De-template deserialization (details)
  12. [mlir][spirv] De-template serialization (details)
  13. [InstCombine] Add tests for PR48577 (NFC) (details)
  14. [InstCombine] Check inbounds in load/store of gep null transform (PR48577) (details)
  15. [RISCV] Add ISel support for RVV vector/scalar forms (details)
  16. [format][NFC] Use unsigned char as the base of all enums in FormatStyle (details)
Commit 74186880ba99b37c0375e9d87df818beee8b4ff2 by thomasraoux
[mlir][vector] Add more vector Ops canonicalization

Add canonicalization for BroadcastOp, ExtractStrideSlicesOp and ShapeCastOp

Differential Revision: https://reviews.llvm.org/D93120
The file was modifiedmlir/test/Dialect/Vector/canonicalize.mlir
The file was modifiedmlir/include/mlir/Dialect/Vector/VectorOps.td
The file was modifiedmlir/lib/Dialect/Vector/VectorOps.cpp
Commit 4c37453a04f942dd676af1eda5d0760d4ffe8927 by thakis
clang: Build and run FrontendTests with CLANG_ENABLE_STATIC_ANALYZER=OFF too

They seem to pass fine with the analyzer off, and with this I would've
noticed my last check-clang break locally.
The file was modifiedclang/unittests/CMakeLists.txt
The file was modifiedllvm/utils/gn/secondary/clang/unittests/BUILD.gn
Commit e124844709228a076483d8b6101bbb362caf625f by lebedev.ri
[LoopIdiom] Introduce 'left-shift until bittest' idiom

The motivation here is the following inner loop in fp16/fp24 -> fp32 expander,
that runs as part of the floating-point DNG decompression in RawSpeed library:
https://github.com/darktable-org/rawspeed/blob/cd380bb9a209bd2e7a0e7022b0cab04528d151e7/src/librawspeed/decompressors/DeflateDecompressor.cpp#L112-L115
```
      while (!(fp32_fraction & (1 << 23))) {
        fp32_exponent -= 1;
        fp32_fraction <<= 1;
      }
```
(https://godbolt.org/z/r13YMh)
As one might notice, that loop is currently uncountable, and that whole code stays scalar.
Yet, it is rather trivial to make that loop countable:
https://godbolt.org/z/do8WMz
and we can prove that via alive2:
https://alive2.llvm.org/ce/z/7vQnji (ha nice, isn't it?)
... and that allow for the whole fp16->fp32 code to vectorize:
https://godbolt.org/z/7hYr13

Now, while i'd love to get there, i feel like i should take it in steps.

For now, this introduces support for the most basic case,
where the bit position is known as a variable,
and the loop *will* go away (has no live-outs other than the recurrence,
no extra instructions in the loop).

I have added sufficient (i believe) test coverage,
and alive2 is happy with those transforms.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D91038
The file was modifiedllvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
The file was modifiedllvm/test/Transforms/LoopIdiom/X86/left-shift-until-bittest.ll
Commit cb2e5980bae3bead524895f4f36e4f71cd764a1b by lebedev.ri
[LoopIdiom] 'left-shift until bittest' idiom: support constant bit mask

The handing of the case where the mask is a constant is trivial,
if said constant is a power of two, the bit in question is log2(mask),
rest just works.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D91725
The file was modifiedllvm/test/Transforms/LoopIdiom/X86/left-shift-until-bittest.ll
The file was modifiedllvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
Commit a0ddc61c5b95be2585b6b4981cf8634d7a00e4a6 by lebedev.ri
[LoopIdiom] 'left-shift until bittest' idiom: support canonical sign bit mask

If the bitmask is for sign bit, instcombine would have canonicalized
the pattern into a proper sign bit check. Supporting that is still
simple, but requires a bit of a roundtrip - we first have to use
`decomposeBitTestICmp()`, and the rest again just works.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D91726
The file was modifiedllvm/test/Transforms/LoopIdiom/X86/left-shift-until-bittest.ll
The file was modifiedllvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
Commit 2b61e7c68cda16159b186fea1a1b1252b94b7e16 by lebedev.ri
[LoopIdiom] 'left-shift until bittest' idiom: support rewriting loop as countable, allow extra cruft

The current state of the transform is still not enough to support
my motivational pattern, because it has one more "induction variable".

I have delayed posting this patch, because originally even just rewriting
the loop as countable wasn't enough to nicely transform my motivational pattern,
because i expected that extra IV to be rewritten afterwards,
but it wasn't happening until i fixed that in D91800.

So, this patch allows the  'left-shift until bittest' loop idiom
as long as the inserted ops are cheap,
and lifts any and all extra use checks on the instructions.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D92754
The file was modifiedllvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
The file was modifiedllvm/test/Transforms/LoopIdiom/X86/left-shift-until-bittest.ll
Commit a16fbff17d329c3f2cc1e49d501f61b3996e9b8a by antiagainst
[mlir][spirv] Create a pass for testing SCFToSPIRV patterns

Previously all SCF to SPIR-V conversion patterns were tested as
the -convert-gpu-to-spirv pass. That obscured the structure we
want. This commit fixed it.

Reviewed By: ThomasRaoux, hanchung

Differential Revision: https://reviews.llvm.org/D93488
The file was modifiedmlir/include/mlir/Conversion/Passes.h
The file was modifiedmlir/include/mlir/Conversion/Passes.td
The file was removedmlir/test/Conversion/GPUToSPIRV/if.mlir
The file was addedmlir/test/Conversion/GPUToSPIRV/entry-point.mlir
The file was addedmlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h
The file was modifiedmlir/lib/Conversion/SCFToSPIRV/CMakeLists.txt
The file was addedmlir/test/Conversion/SCFToSPIRV/if.mlir
The file was modifiedmlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp
The file was removedmlir/test/Conversion/GPUToSPIRV/test_spirv_entry_point.mlir
The file was addedmlir/test/Conversion/SCFToSPIRV/for.mlir
The file was addedmlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp
The file was removedmlir/test/Conversion/GPUToSPIRV/loop.mlir
Commit 34e70d722dfd0e73d460802e8d43d3a885d24784 by tmsriram
Append ".__part." to every basic block section symbol.

Every basic block section symbol created by -fbasic-block-sections will contain
".__part." to know that this symbol corresponds to a basic block fragment of
the function.

This patch solves two problems:

a) Like D89617, we want function symbols with suffixes to be properly qualified
   so that external tools like profile aggregators know exactly what this
   symbol corresponds to.
b) The current basic block naming just adds a ".N" to the symbol name where N is
   some integer. This collides with how clang creates __cxx_global_var_init.N.
   clang creates these symbol names to call constructor functions and basic
   block symbol naming should not use the same style.

Fixed all the test cases and added an extra test for __cxx_global_var_init
breakage.

Differential Revision: https://reviews.llvm.org/D93082
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-unreachable.ll
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-clusters.ll
The file was addedllvm/test/CodeGen/X86/basic-block-sections_2.ll
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-mir-parse.mir
The file was modifiedllvm/test/CodeGen/X86/cfi-inserter-basic-block-sections-callee-save-registers.ll
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-blockaddress-taken.ll
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-list.ll
The file was modifiedclang/test/CodeGen/basic-block-sections.c
The file was modifiedllvm/test/DebugInfo/X86/basic-block-sections_1.ll
The file was modifiedllvm/test/CodeGen/X86/gcc_except_table_bb_sections.ll
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-eh.ll
The file was modifiedllvm/test/CodeGen/X86/cfi-basic-block-sections-1.ll
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-clusters-eh.ll
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-listbb.ll
The file was modifiedlld/test/ELF/lto/basic-block-sections.ll
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-clusters-branches.ll
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections.ll
The file was modifiedllvm/lib/CodeGen/MachineBasicBlock.cpp
The file was modifiedllvm/test/CodeGen/X86/basic-block-sections-directjumps.ll
Commit 930c74f12d799c95e37a107bb692148b36493806 by antiagainst
[mlir][spirv] NFC: rename SPIR-V conversion files for consistency

This commit renames various SPIR-V related conversion files for
consistency. It drops the "Convert" prefix to various files and
fixes various comment headers.

Reviewed By: hanchung, ThomasRaoux

Differential Revision: https://reviews.llvm.org/D93489
The file was removedmlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
The file was modifiedmlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp
The file was modifiedmlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
The file was modifiedmlir/docs/Dialects/SPIR-V.md
The file was modifiedmlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp
The file was addedmlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h
The file was removedmlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.h
The file was addedmlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
The file was modifiedmlir/tools/mlir-spirv-cpu-runner/mlir-spirv-cpu-runner.cpp
The file was modifiedmlir/lib/Conversion/VectorToSPIRV/CMakeLists.txt
The file was modifiedmlir/lib/Conversion/StandardToSPIRV/CMakeLists.txt
The file was removedmlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp
The file was addedmlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRVPass.h
The file was modifiedmlir/lib/Conversion/GPUToSPIRV/CMakeLists.txt
The file was addedmlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp
The file was modifiedmlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h
The file was modifiedmlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h
The file was addedmlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
The file was removedmlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.h
The file was removedmlir/include/mlir/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.h
The file was addedmlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h
The file was addedmlir/lib/Conversion/StandardToSPIRV/StandardToSPIRVPass.cpp
The file was removedmlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.h
The file was modifiedmlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
The file was modifiedmlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp
The file was modifiedmlir/lib/Conversion/SPIRVToLLVM/CMakeLists.txt
The file was modifiedmlir/include/mlir/Conversion/Passes.h
The file was modifiedmlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
The file was addedmlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp
The file was modifiedmlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp
The file was addedmlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h
The file was addedmlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h
The file was addedmlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp
The file was addedmlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h
The file was removedmlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRVPass.h
The file was removedmlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVMPass.cpp
The file was removedmlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h
The file was removedmlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.cpp
The file was modifiedmlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h
The file was modifiedmlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
The file was removedmlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp
The file was addedmlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp
The file was modifiedmlir/lib/Conversion/LinalgToSPIRV/CMakeLists.txt
The file was removedmlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp
The file was removedmlir/include/mlir/Conversion/GPUToSPIRV/ConvertGPUToSPIRVPass.h
The file was addedmlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h
The file was modifiedmlir/lib/Conversion/SCFToSPIRV/CMakeLists.txt
The file was addedmlir/include/mlir/Conversion/StandardToSPIRV/StandardToSPIRV.h
The file was removedmlir/include/mlir/Conversion/VectorToSPIRV/ConvertVectorToSPIRV.h
The file was modifiedmlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRV.h
Commit 897990e614c8d609b2f62dde4f82eb3e96f9f0be by craig.topper
[IROutliner] Use isa instead of dyn_cast where the casted value isn't used. NFC

Fixes unused variable warnings.
The file was modifiedllvm/lib/Transforms/IPO/IROutliner.cpp
Commit ae895ac4b9fa86b9471617357f66c0cd6cdb70b8 by antiagainst
[mlir][spirv] De-template deserialization

Previously for each op we generate a separate deserialization
method for it. Those deserialization methods duplicate the logic
of parsing operands/results/attributes and such.

This commit creates a generic method and let suitable op-specific
deserialization method to call into it.

wc -l SPIRVSerialization.inc: before 13290; after: 8304 (So -4986)

Reviewed By: hanchung, ThomasRaoux

Differential Revision: https://reviews.llvm.org/D93504
The file was modifiedmlir/lib/Target/SPIRV/Deserialization.cpp
The file was modifiedmlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp
Commit fc41777702aae1cb88512a6aa45382736766fadf by antiagainst
[mlir][spirv] De-template serialization

Previously for each op we generate a separate serialization
method for it. Those serialization methods duplicate the logic
of parsing operands/results/attributes and such.

This commit creates a generic method and let suitable op-specific
serialization method to call into it.

wc -l SPIRVSerialization.inc: before 8304; after: 5597 (So -2707)

Reviewed By: hanchung, ThomasRaoux

Differential Revision: https://reviews.llvm.org/D93535
The file was modifiedmlir/lib/Target/SPIRV/Serialization.cpp
The file was modifiedmlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp
Commit de127d83d81228de36c487a6da28502b458e9924 by nikita.ppv
[InstCombine] Add tests for PR48577 (NFC)
The file was modifiedllvm/test/Transforms/InstCombine/load.ll
The file was modifiedllvm/test/Transforms/InstCombine/store.ll
Commit 899faa50f206073cdd8eeaaa130ffa15f850e656 by nikita.ppv
[InstCombine] Check inbounds in load/store of gep null transform (PR48577)

If the GEP isn't inbounds, then accessing a GEP of null location
is generally not UB.

While this is a minimal fix, the GEP of null handling should
probably be its own fold.
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
The file was modifiedllvm/test/Transforms/InstCombine/load.ll
The file was modifiedllvm/test/Transforms/InstCombine/store.ll
Commit 1a7ac29a89f8209dda6567a3d48594a618aa1621 by fraser
[RISCV] Add ISel support for RVV vector/scalar forms

This patch extends the SDNode ISel support for RVV from only the
vector/vector instructions to include the vector/scalar and
vector/immediate forms.

It uses splat_vector to carry the scalar in each case, except when
XLEN<SEW (RV32 SEW=64) when a custom node `SPLAT_VECTOR_I64` is used for
type-legalization and to encode the fact that the value is sign-extended
to SEW. When the scalar is a full 64-bit value we use a sequence to
materialize the constant into the vector register.

The non-intrinsic ISel patterns have also been split into their own
file.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Fraser Cormack <fraser@codeplay.com>

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D93312
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.cpp
The file was addedllvm/test/CodeGen/RISCV/rvv/vshl-sdnode-rv64.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vadd-sdnode-rv64.ll
The file was addedllvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
The file was addedllvm/test/CodeGen/RISCV/rvv/vadd-sdnode-rv32.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vsplats-i64.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
The file was addedllvm/test/CodeGen/RISCV/rvv/vshl-sdnode-rv32.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vor-sdnode-rv32.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
The file was addedllvm/test/CodeGen/RISCV/rvv/vor-sdnode-rv64.ll
The file was addedllvm/test/CodeGen/RISCV/rvv/vsrl-sdnode-rv64.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.h
The file was addedllvm/test/CodeGen/RISCV/rvv/vsrl-sdnode-rv32.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
Commit c7e825b910a96c42bda1de4e7fb34c369da76625 by n.james93
[format][NFC] Use unsigned char as the base of all enums in FormatStyle

This removes alot of unnecessary padding, trimming the size of the struct from 728->608 on 64 bit platforms.

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D93758
The file was modifiedclang/include/clang/Format/Format.h
The file was modifiedclang/docs/tools/dump_format_style.py