MLIR  20.0.0git
Namespaces | Macros | Functions
BufferDeallocationSimplification.cpp File Reference
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::bufferization
 

Macros

#define GEN_PASS_DEF_BUFFERDEALLOCATIONSIMPLIFICATION
 

Functions

static Value getViewBase (Value value)
 Given a memref value, return the "base" value by skipping over all ViewLikeOpInterface ops (if any) in the reverse use-def chain. More...
 
static LogicalResult updateDeallocIfChanged (DeallocOp deallocOp, ValueRange memrefs, ValueRange conditions, PatternRewriter &rewriter)
 
static bool distinctAllocAndBlockArgument (Value v1, Value v2)
 Return "true" if the given values are guaranteed to be different (and non-aliasing) allocations based on the fact that one value is the result of an allocation and the other value is a block argument of a parent block. More...
 
static bool potentiallyAliasesMemref (BufferOriginAnalysis &analysis, ValueRange otherList, Value memref)
 Checks if memref may potentially alias a MemRef in otherList. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_BUFFERDEALLOCATIONSIMPLIFICATION

#define GEN_PASS_DEF_BUFFERDEALLOCATIONSIMPLIFICATION

Definition at line 25 of file BufferDeallocationSimplification.cpp.

Function Documentation

◆ distinctAllocAndBlockArgument()

static bool distinctAllocAndBlockArgument ( Value  v1,
Value  v2 
)
static

Return "true" if the given values are guaranteed to be different (and non-aliasing) allocations based on the fact that one value is the result of an allocation and the other value is a block argument of a parent block.

Note: This is a best-effort analysis that will eventually be replaced by a proper "is same allocation" analysis. This function may return "false" even though the two values are distinct allocations.

Definition at line 66 of file BufferDeallocationSimplification.cpp.

References mlir::Value::getDefiningOp(), and getViewBase().

Referenced by potentiallyAliasesMemref().

◆ getViewBase()

static Value getViewBase ( Value  value)
static

Given a memref value, return the "base" value by skipping over all ViewLikeOpInterface ops (if any) in the reverse use-def chain.

Definition at line 39 of file BufferDeallocationSimplification.cpp.

References mlir::Value::getDefiningOp().

Referenced by distinctAllocAndBlockArgument().

◆ potentiallyAliasesMemref()

static bool potentiallyAliasesMemref ( BufferOriginAnalysis analysis,
ValueRange  otherList,
Value  memref 
)
static

Checks if memref may potentially alias a MemRef in otherList.

It is often a requirement of optimization patterns that there cannot be any aliasing memref in order to perform the desired simplification.

Definition at line 83 of file BufferDeallocationSimplification.cpp.

References distinctAllocAndBlockArgument(), and mlir::BufferOriginAnalysis::isSameAllocation().

◆ updateDeallocIfChanged()

static LogicalResult updateDeallocIfChanged ( DeallocOp  deallocOp,
ValueRange  memrefs,
ValueRange  conditions,
PatternRewriter rewriter 
)
static