Enzyme main
Loading...
Searching...
No Matches
DataFlowAliasAnalysis.cpp File Reference
#include "DataFlowAliasAnalysis.h"
#include "Dialect/Dialect.h"
#include "Dialect/Ops.h"
#include "mlir/Analysis/AliasAnalysis.h"
#include "mlir/Analysis/DataFlow/DenseAnalysis.h"
#include "mlir/Analysis/DataFlow/SparseAnalysis.h"
#include "mlir/Analysis/DataFlowFramework.h"
#include "mlir/Dialect/LLVMIR/LLVMAttrs.h"
#include "mlir/Interfaces/CastInterfaces.h"
#include "mlir/Interfaces/FunctionInterfaces.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Interfaces/ViewLikeInterface.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "llvm/ADT/SetOperations.h"
Include dependency graph for DataFlowAliasAnalysis.cpp:

Go to the source code of this file.

Functions

static bool isPointerLike (Type type)
 
template<typename T >
static ChangeResult mergeSets (DenseSet< T > &dest, const DenseSet< T > &src)
 
static void deserializePointsTo (ArrayAttr summaryAttr, DenseMap< DistinctAttr, enzyme::AliasClassSet > &summaryMap)
 
std::optional< Value > getStored (Operation *op)
 
std::optional< Value > getCopySource (Operation *op)
 
static bool isMustStore (Operation *op, Value pointer)
 
static bool isNoOp (Operation *op)
 
static bool modRefMayMod (std::optional< LLVM::ModRefInfo > modRef)
 
static bool modRefMayRef (std::optional< LLVM::ModRefInfo > modRef)
 
static bool mayReadArg (FunctionOpInterface callee, unsigned argNo, std::optional< LLVM::ModRefInfo > argMemMRI)
 
static bool mayWriteArg (FunctionOpInterface callee, unsigned argNo, std::optional< LLVM::ModRefInfo > argMemMRI)
 
static std::optional< LLVM::ModRefInfo > getFunctionArgModRef (FunctionOpInterface func)
 Returns information indicating whether the function may read or write into the memory pointed to by its arguments.
 
static std::optional< LLVM::ModRefInfo > getFunctionOtherModRef (FunctionOpInterface func)
 Returns information indicating whether the function may read or write into the memory other than that pointed to by its arguments, though still accessible from (any) calling context.
 
static std::optional< LLVM::ModRefInfo > getFunctionInaccessibleModRef (FunctionOpInterface func)
 Returns information indicating whether the function may read or write into memory previously inaccessible in the calling context.
 
static bool isAliasTransferFullyDescribedByMemoryEffects (Operation *op)
 Returns true if the alias transfer function of the operation is fully described by its memory effects.
 
void populateConservativeCallEffects (CallOpInterface call, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 
LogicalResult getEffectsForExternalCall (CallOpInterface call, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 
static void deserializeAliasSummary (ArrayAttr summary, SmallVectorImpl< enzyme::AliasClassSet > &out)
 

Variables

static constexpr llvm::StringLiteral kLLVMMemoryAttrName = "memory_effects"
 

Function Documentation

◆ deserializeAliasSummary()

◆ deserializePointsTo()

static void deserializePointsTo ( ArrayAttr summaryAttr,
DenseMap< DistinctAttr, enzyme::AliasClassSet > & summaryMap )
static

◆ getCopySource()

std::optional< Value > getCopySource ( Operation * op)

◆ getEffectsForExternalCall()

LogicalResult getEffectsForExternalCall ( CallOpInterface call,
SmallVectorImpl< MemoryEffects::EffectInstance > & effects )

◆ getFunctionArgModRef()

static std::optional< LLVM::ModRefInfo > getFunctionArgModRef ( FunctionOpInterface func)
static

Returns information indicating whether the function may read or write into the memory pointed to by its arguments.

When unknown, returns nullopt.

Definition at line 396 of file DataFlowAliasAnalysis.cpp.

References kLLVMMemoryAttrName.

Referenced by mlir::enzyme::PointsToPointerAnalysis::visitCallControlFlowTransfer(), and mlir::enzyme::AliasAnalysis::visitExternalCall().

◆ getFunctionInaccessibleModRef()

static std::optional< LLVM::ModRefInfo > getFunctionInaccessibleModRef ( FunctionOpInterface func)
static

Returns information indicating whether the function may read or write into memory previously inaccessible in the calling context.

When unknown, returns nullopt.

Definition at line 499 of file DataFlowAliasAnalysis.cpp.

References kLLVMMemoryAttrName.

Referenced by mlir::enzyme::AliasAnalysis::visitExternalCall().

◆ getFunctionOtherModRef()

static std::optional< LLVM::ModRefInfo > getFunctionOtherModRef ( FunctionOpInterface func)
static

Returns information indicating whether the function may read or write into the memory other than that pointed to by its arguments, though still accessible from (any) calling context.

When unknown, returns nullopt.

Definition at line 421 of file DataFlowAliasAnalysis.cpp.

References kLLVMMemoryAttrName.

Referenced by mlir::enzyme::PointsToPointerAnalysis::visitCallControlFlowTransfer(), and mlir::enzyme::AliasAnalysis::visitExternalCall().

◆ getStored()

std::optional< Value > getStored ( Operation * op)

◆ isAliasTransferFullyDescribedByMemoryEffects()

static bool isAliasTransferFullyDescribedByMemoryEffects ( Operation * op)
static

Returns true if the alias transfer function of the operation is fully described by its memory effects.

Definition at line 835 of file DataFlowAliasAnalysis.cpp.

◆ isMustStore()

static bool isMustStore ( Operation * op,
Value pointer )
static

◆ isNoOp()

static bool isNoOp ( Operation * op)
static

◆ isPointerLike()

◆ mayReadArg()

static bool mayReadArg ( FunctionOpInterface callee,
unsigned argNo,
std::optional< LLVM::ModRefInfo > argMemMRI )
static

◆ mayWriteArg()

static bool mayWriteArg ( FunctionOpInterface callee,
unsigned argNo,
std::optional< LLVM::ModRefInfo > argMemMRI )
static

◆ mergeSets()

template<typename T >
static ChangeResult mergeSets ( DenseSet< T > & dest,
const DenseSet< T > & src )
static

Definition at line 59 of file DataFlowAliasAnalysis.cpp.

◆ modRefMayMod()

static bool modRefMayMod ( std::optional< LLVM::ModRefInfo > modRef)
static

◆ modRefMayRef()

static bool modRefMayRef ( std::optional< LLVM::ModRefInfo > modRef)
static

◆ populateConservativeCallEffects()

void populateConservativeCallEffects ( CallOpInterface call,
SmallVectorImpl< MemoryEffects::EffectInstance > & effects )

Definition at line 981 of file DataFlowAliasAnalysis.cpp.

References isPointerLike().

Variable Documentation

◆ kLLVMMemoryAttrName

llvm::StringLiteral kLLVMMemoryAttrName = "memory_effects"
staticconstexpr