MLIR  20.0.0git
SROA.h
Go to the documentation of this file.
1 //===-- SROA.h - Scalar Replacement Of Aggregates ---------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef MLIR_TRANSFORMS_SROA_H
10 #define MLIR_TRANSFORMS_SROA_H
11 
13 #include "mlir/Support/LLVM.h"
14 #include "llvm/ADT/Statistic.h"
15 
16 namespace mlir {
17 
18 /// Statistics collected while applying SROA.
20  /// Total amount of memory slots destructured.
21  llvm::Statistic *destructuredAmount = nullptr;
22  /// Total amount of memory slots in which the destructured size was smaller
23  /// than the total size after eliminating unused fields.
24  llvm::Statistic *slotsWithMemoryBenefit = nullptr;
25  /// Maximal number of sub-elements a successfully destructured slot initially
26  /// had.
27  llvm::Statistic *maxSubelementAmount = nullptr;
28 };
29 
30 /// Attempts to destructure the slots of destructurable allocators. Iteratively
31 /// retries the destructuring of all slots as destructuring one slot might
32 /// enable subsequent destructuring. Returns failure if no slot was
33 /// destructured.
34 LogicalResult tryToDestructureMemorySlots(
36  OpBuilder &builder, const DataLayout &dataLayout,
37  SROAStatistics statistics = {});
38 
39 } // namespace mlir
40 
41 #endif // MLIR_TRANSFORMS_SROA_H
The main mechanism for performing data layout queries.
This class helps build Operations.
Definition: Builders.h:216
Include the generated interface declarations.
LogicalResult tryToDestructureMemorySlots(ArrayRef< DestructurableAllocationOpInterface > allocators, OpBuilder &builder, const DataLayout &dataLayout, SROAStatistics statistics={})
Attempts to destructure the slots of destructurable allocators.
Definition: SROA.cpp:198
Statistics collected while applying SROA.
Definition: SROA.h:19
llvm::Statistic * maxSubelementAmount
Maximal number of sub-elements a successfully destructured slot initially had.
Definition: SROA.h:27
llvm::Statistic * slotsWithMemoryBenefit
Total amount of memory slots in which the destructured size was smaller than the total size after eli...
Definition: SROA.h:24
llvm::Statistic * destructuredAmount
Total amount of memory slots destructured.
Definition: SROA.h:21