MLIR  16.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/Transforms/DialectConversion.h"
#include "mlir/Dialect/Arith/Transforms/Passes.h.inc"
+ Include dependency graph for UnsignedWhenEquivalent.cpp:

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 20 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 55 of file UnsignedWhenEquivalent.cpp.

References mlir::failure(), staticallyNonNegative(), mlir::succeeded(), and mlir::success().

Referenced by toUnsignedPred().

◆ staticallyNonNegative() [1/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 32 of file UnsignedWhenEquivalent.cpp.

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

Referenced by isCmpIConvertable(), staticallyNonNegative(), and toUnsignedPred().

◆ staticallyNonNegative() [2/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 43 of file UnsignedWhenEquivalent.cpp.

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

◆ toUnsignedPred()

static CmpIPredicate toUnsignedPred ( CmpIPredicate  pred)
static