MLIR 24.0.0git
mlir::DeadnessCache Class Reference

A cache for repeated deadness queries on nested operations. More...

#include "mlir/Interfaces/SideEffectInterfaces.h"

Public Types

enum class  State : uint8_t { Alive , Dead }

Public Member Functions

bool isOpTriviallyDead (Operation *op)
 Return true if the operation is unused and can be erased.
void invalidate (Operation *op)
 Invalidate the operation, its descendants, and its ancestors.
void invalidateAncestors (Operation *op)
 Invalidate the operation and its ancestors, preserving descendant entries.

Detailed Description

A cache for repeated deadness queries on nested operations.

All changes to an operation or its nested IR must invalidate that operation. Moves must also invalidate the old parent. Invalidate operations before erasing them.

Definition at line 554 of file SideEffectInterfaces.h.

Member Enumeration Documentation

◆ State

enum class mlir::DeadnessCache::State : uint8_t
strong
Enumerator
Alive 
Dead 

Definition at line 556 of file SideEffectInterfaces.h.

Member Function Documentation

◆ invalidate()

void DeadnessCache::invalidate ( Operation * op)

Invalidate the operation, its descendants, and its ancestors.

Definition at line 159 of file SideEffectInterfaces.cpp.

References invalidateAncestors(), and mlir::Operation::walk().

◆ invalidateAncestors()

void DeadnessCache::invalidateAncestors ( Operation * op)

Invalidate the operation and its ancestors, preserving descendant entries.

Definition at line 164 of file SideEffectInterfaces.cpp.

References mlir::Operation::getParentOp().

Referenced by invalidate().

◆ isOpTriviallyDead()

bool DeadnessCache::isOpTriviallyDead ( Operation * op)

Return true if the operation is unused and can be erased.

Terminators and symbols cannot be erased. Uses are checked on every query.

Definition at line 144 of file SideEffectInterfaces.cpp.

References Dead, mlir::Operation::mightHaveTrait(), mlir::Operation::use_empty(), and wouldOpBeTriviallyDeadImpl().


The documentation for this class was generated from the following files: