[all-commits] [llvm/llvm-project] 8404b2: [mlir][llvm] Add memset support for mem2reg/sroa
Théo Degioanni via All-commits
all-commits at lists.llvm.org
Wed Jun 14 02:17:45 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8404b23acd70b8db1411b98a04b4ea62eaeb48dd
https://github.com/llvm/llvm-project/commit/8404b23acd70b8db1411b98a04b4ea62eaeb48dd
Author: Théo Degioanni <theo.degioanni at nextsilicon.com>
Date: 2023-06-14 (Wed, 14 Jun 2023)
Changed paths:
M mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
M mlir/include/mlir/Interfaces/MemorySlotInterfaces.td
M mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp
M mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp
M mlir/lib/Transforms/Mem2Reg.cpp
A mlir/test/Dialect/LLVMIR/mem2reg-intrinsics.mlir
A mlir/test/Dialect/LLVMIR/sroa-intrinsics.mlir
Log Message:
-----------
[mlir][llvm] Add memset support for mem2reg/sroa
This revision introduces support for memset intrinsics in SROA and
mem2reg for the LLVM dialect. This is achieved for SROA by breaking
memsets of aggregates into multiple memsets of scalars, and for mem2reg
by promoting memsets of single integer slots into the value the memset
operation would yield.
The SROA logic supports breaking memsets of static size operating at the
start of a memory slot. The intended most common case is for memsets
covering the entirety of a struct, most often as a way to initialize it
to 0.
The mem2reg logic supports dynamic values and static sizes as input to
promotable memsets. This is achieved by lowering memsets into
`ceil(log_2(n))` LeftShift operations, `ceil(log_2(n))` Or operations
and up to one ZExt operation (for n the byte width of the integer),
computing in registers the integer value the memset would create. Only
byte-aligned integers are supported, more types could easily be added
afterwards.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D152367
More information about the All-commits
mailing list