[all-commits] [llvm/llvm-project] f88f8f: [mlir] Add a generic mem2reg implementation.
Théo Degioanni via All-commits
all-commits at lists.llvm.org
Wed Apr 26 23:12:48 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f88f8fd0bca34dc8e5571cb828b1a159a50fd504
https://github.com/llvm/llvm-project/commit/f88f8fd0bca34dc8e5571cb828b1a159a50fd504
Author: Théo Degioanni <theo.degioanni at nextsilicon.com>
Date: 2023-04-27 (Thu, 27 Apr 2023)
Changed paths:
M llvm/include/llvm/ADT/DenseMap.h
M mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h
M mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
M mlir/include/mlir/Interfaces/CMakeLists.txt
A mlir/include/mlir/Interfaces/Mem2RegInterfaces.h
A mlir/include/mlir/Interfaces/Mem2RegInterfaces.td
A mlir/include/mlir/Transforms/Mem2Reg.h
M mlir/include/mlir/Transforms/Passes.h
M mlir/include/mlir/Transforms/Passes.td
M mlir/lib/Dialect/LLVMIR/CMakeLists.txt
A mlir/lib/Dialect/LLVMIR/IR/LLVMMem2Reg.cpp
M mlir/lib/Interfaces/CMakeLists.txt
A mlir/lib/Interfaces/Mem2RegInterfaces.cpp
M mlir/lib/Transforms/CMakeLists.txt
A mlir/lib/Transforms/Mem2Reg.cpp
A mlir/test/Transforms/mem2reg-llvmir-dbginfo.mlir
A mlir/test/Transforms/mem2reg-llvmir.mlir
Log Message:
-----------
[mlir] Add a generic mem2reg implementation.
This patch introduces a generic implementation of mem2reg on
unstructured control-flow, along with a specialization for LLVM IR. This
is achieved by defining three new interfaces, representing 1. allocating
operations, 2. operations doing memory accesses, 3. operations that can
be rewired and/or deleted to stop using a specific use.
The file containing the core implementation of the algorithm
(`Mem2Reg.cpp`) contains a detailed explanation of how the algorithm
works. The contract for this pass is that given a memory slot with a
single non-aliased pointer, the pass will either remove all the uses of
the pointer or not change anything.
To help review this patch, I recommend starting by looking at the
interfaces defined in `Mem2Reg.td`, along with their reference
implementation for LLVM IR defined in `LLVMMem2Reg.cpp`. Then, the core
algorithm is implemented in `Mem2Reg.cpp`.
If this is all good I also have an implementation of the interfaces for
0-dimensional memref promotion that I can upstream afterwards.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D148109
More information about the All-commits
mailing list