MLIR  21.0.0git
Macros | Functions
DeadCodeAnalysis.cpp File Reference
#include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
#include "mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h"
#include "mlir/Analysis/DataFlow/SparseAnalysis.h"
#include "mlir/Analysis/DataFlowFramework.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Block.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Location.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/IR/Value.h"
#include "mlir/IR/ValueRange.h"
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Support/LLVM.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include <cassert>
#include <optional>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "dead-code-analysis"
 
#define DBGS()   (llvm::dbgs() << '[' << DEBUG_TYPE << "] ")
 
#define LDBG(X)   LLVM_DEBUG(DBGS() << X << "\n")
 

Functions

static bool isRegionOrCallableReturn (Operation *op)
 Returns true if the operation is a returning terminator in region control-flow or the terminator of a callable region. More...
 
static std::optional< SmallVector< Attribute > > getOperandValuesImpl (Operation *op, function_ref< const Lattice< ConstantValue > *(Value)> getLattice)
 Get the constant values of the operands of an operation. More...
 

Macro Definition Documentation

◆ DBGS

#define DBGS ( )    (llvm::dbgs() << '[' << DEBUG_TYPE << "] ")

Definition at line 30 of file DeadCodeAnalysis.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "dead-code-analysis"

Definition at line 29 of file DeadCodeAnalysis.cpp.

◆ LDBG

#define LDBG (   X)    LLVM_DEBUG(DBGS() << X << "\n")

Definition at line 31 of file DeadCodeAnalysis.cpp.

Function Documentation

◆ getOperandValuesImpl()

static std::optional<SmallVector<Attribute> > getOperandValuesImpl ( Operation op,
function_ref< const Lattice< ConstantValue > *(Value)>  getLattice 
)
static

Get the constant values of the operands of an operation.

If any of the constant value lattices are uninitialized, return std::nullopt to indicate the analysis should bail out.

Definition at line 399 of file DeadCodeAnalysis.cpp.

References mlir::Operation::getNumOperands(), mlir::Operation::getOperands(), and mlir::dataflow::Lattice< ValueT >::getValue().

◆ isRegionOrCallableReturn()

static bool isRegionOrCallableReturn ( Operation op)
static

Returns true if the operation is a returning terminator in region control-flow or the terminator of a callable region.

Definition at line 225 of file DeadCodeAnalysis.cpp.

References mlir::Operation::getBlock(), mlir::Operation::getNumSuccessors(), mlir::Operation::getParentOp(), and mlir::Block::getTerminator().

Referenced by mlir::dataflow::DeadCodeAnalysis::visit().