MLIR  20.0.0git
Namespaces | Macros | Functions
UnsignedWhenEquivalent.cpp File Reference
#include "mlir/Dialect/Arith/Transforms/Passes.h"
#include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
#include "mlir/Analysis/DataFlow/IntegerRangeAnalysis.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/WalkPatternRewriteDriver.h"
#include "mlir/Dialect/Arith/Transforms/Passes.h.inc"

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::arith
 

Macros

#define GEN_PASS_DEF_ARITHUNSIGNEDWHENEQUIVALENT
 

Functions

static LogicalResult staticallyNonNegative (DataFlowSolver &solver, Value v)
 Succeeds when a value is statically non-negative in that it has a lower bound on its value (if it is treated as signed) and that bound is non-negative. More...
 
static LogicalResult staticallyNonNegative (DataFlowSolver &solver, Operation *op)
 Succeeds if an op can be converted to its unsigned equivalent without changing its semantics. More...
 
static LogicalResult isCmpIConvertable (DataFlowSolver &solver, CmpIOp op)
 Succeeds when the comparison predicate is a signed operation and all the operands are non-negative, indicating that the cmpi operation op can have its predicate changed to an unsigned equivalent. More...
 
static CmpIPredicate toUnsignedPred (CmpIPredicate pred)
 Return the unsigned equivalent of a signed comparison predicate, or the predicate itself if there is none. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_ARITHUNSIGNEDWHENEQUIVALENT

#define GEN_PASS_DEF_ARITHUNSIGNEDWHENEQUIVALENT

Definition at line 21 of file UnsignedWhenEquivalent.cpp.

Function Documentation

◆ isCmpIConvertable()

static LogicalResult isCmpIConvertable ( DataFlowSolver solver,
CmpIOp  op 
)
static

Succeeds when the comparison predicate is a signed operation and all the operands are non-negative, indicating that the cmpi operation op can have its predicate changed to an unsigned equivalent.

Definition at line 59 of file UnsignedWhenEquivalent.cpp.

◆ staticallyNonNegative() [1/2]

static LogicalResult staticallyNonNegative ( DataFlowSolver solver,
Operation op 
)
static

Succeeds if an op can be converted to its unsigned equivalent without changing its semantics.

This is the case when none of its openands or results can be below 0 when analyzed from a signed perspective.

Definition at line 47 of file UnsignedWhenEquivalent.cpp.

References mlir::Operation::getOperands(), mlir::Operation::getResults(), and staticallyNonNegative().

◆ staticallyNonNegative() [2/2]

static LogicalResult staticallyNonNegative ( DataFlowSolver solver,
Value  v 
)
static

Succeeds when a value is statically non-negative in that it has a lower bound on its value (if it is treated as signed) and that bound is non-negative.

Definition at line 36 of file UnsignedWhenEquivalent.cpp.

References mlir::DataFlowSolver::lookupState(), and mlir::ConstantIntRanges::smin().

Referenced by staticallyNonNegative().

◆ toUnsignedPred()

static CmpIPredicate toUnsignedPred ( CmpIPredicate  pred)
static

Return the unsigned equivalent of a signed comparison predicate, or the predicate itself if there is none.

Definition at line 76 of file UnsignedWhenEquivalent.cpp.