MLIR 22.0.0git
AffineExpr.cpp File Reference
#include <cmath>
#include <cstdint>
#include <utility>
#include "AffineExprDetail.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineExprVisitor.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/IntegerSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/MathExtras.h"
#include <numeric>
#include <optional>

Go to the source code of this file.

Functions

 static_cast< unsigned > (AffineExprKind::Add)
static AffineExpr simplifyMul (AffineExpr lhs, AffineExpr rhs)
 Simplify a multiply expression. Return nullptr if it can't be simplified.
static AffineExpr simplifyFloorDiv (AffineExpr lhs, AffineExpr rhs)
static AffineExpr simplifyCeilDiv (AffineExpr lhs, AffineExpr rhs)
static AffineExpr simplifyMod (AffineExpr lhs, AffineExpr rhs)
static AffineExpr getSemiAffineExprFromFlatForm (ArrayRef< int64_t > flatExprs, unsigned numDims, unsigned numSymbols, ArrayRef< AffineExpr > localExprs, MLIRContext *context)
 Constructs a semi-affine expression from a flat ArrayRef. If there are local identifiers (neither dimensional nor symbolic) that appear in the sum of products expression, localExprs is expected to have the AffineExprs for it, and is substituted into. The ArrayRef flatExprs is expected to be in the format [dims, symbols, locals, constant term]. The semi-affine expression is constructed in the sorted order of dimension and symbol position numbers. Note: local expressions/ids are used for mod, div as well as symbolic RHS terms for terms that are not pure affine.

Variables

 lhs
 rhs

Function Documentation

◆ getSemiAffineExprFromFlatForm()

AffineExpr getSemiAffineExprFromFlatForm ( ArrayRef< int64_t > flatExprs,
unsigned numDims,
unsigned numSymbols,
ArrayRef< AffineExpr > localExprs,
MLIRContext * context )
static

Constructs a semi-affine expression from a flat ArrayRef. If there are local identifiers (neither dimensional nor symbolic) that appear in the sum of products expression, localExprs is expected to have the AffineExprs for it, and is substituted into. The ArrayRef flatExprs is expected to be in the format [dims, symbols, locals, constant term]. The semi-affine expression is constructed in the sorted order of dimension and symbol position numbers. Note: local expressions/ids are used for mod, div as well as symbolic RHS terms for terms that are not pure affine.

Definition at line 1133 of file AffineExpr.cpp.

References mlir::getAffineConstantExpr(), mlir::getAffineDimExpr(), mlir::getAffineSymbolExpr(), mlir::AffineBinaryOpExpr::getLHS(), mlir::AffineBinaryOpExpr::getRHS(), indices, lhs, and rhs.

Referenced by mlir::simplifyAffineExpr().

◆ simplifyCeilDiv()

AffineExpr simplifyCeilDiv ( AffineExpr lhs,
AffineExpr rhs )
static

Definition at line 972 of file AffineExpr.cpp.

References mlir::getAffineConstantExpr(), lhs, mlir::Mul, and rhs.

Referenced by mlir::AffineExpr::ceilDiv().

◆ simplifyFloorDiv()

AffineExpr simplifyFloorDiv ( AffineExpr lhs,
AffineExpr rhs )
static

Definition at line 913 of file AffineExpr.cpp.

References mlir::Add, mlir::getAffineConstantExpr(), lhs, mlir::Mul, and rhs.

Referenced by mlir::AffineExpr::floorDiv().

◆ simplifyMod()

AffineExpr simplifyMod ( AffineExpr lhs,
AffineExpr rhs )
static

Definition at line 1019 of file AffineExpr.cpp.

References mlir::Add, mlir::getAffineConstantExpr(), lhs, mlir::Mod, and rhs.

Referenced by mlir::AffineExpr::operator%().

◆ simplifyMul()

AffineExpr simplifyMul ( AffineExpr lhs,
AffineExpr rhs )
static

Simplify a multiply expression. Return nullptr if it can't be simplified.

Definition at line 836 of file AffineExpr.cpp.

References mlir::getAffineConstantExpr(), lhs, mlir::Mul, product(), and rhs.

Referenced by mlir::AffineExpr::operator*().

◆ static_cast< unsigned >()

static_cast< unsigned > ( AffineExprKind::Add )

Variable Documentation

◆ lhs

lhs

Definition at line 832 of file AffineExpr.cpp.

Referenced by mlir::ArithBuilder::_and(), mlir::affine::AffineBuilder::add(), mlir::ArithBuilder::add(), mlir::sparse_tensor::ir_detail::VarSet::add(), mlir::xegpu::addElementwise(), addIntegerAttrs(), mlir::SimpleAffineExprFlattener::addLocalIdSemiAffine(), mlir::xegpu::addWithRightAligned(), mlir::AliasAnalysis::alias(), mlir::detail::AliasAnalysisTraits::Concept::alias(), mlir::detail::AliasAnalysisTraits::Model< ImplT >::alias(), mlir::LocalAliasAnalysis::alias(), mlir::LocalAliasAnalysis::aliasImpl(), mlir::arith::applyCmpPredicate(), mlir::arith::applyCmpPredicate(), mlir::PatternApplicator::applyCostModel(), applyToIntegerAttrs(), binaryFolder(), MmaSyncBuilder::buildMmaSync(), canonicalizeMapExprAndTermOrder(), mlir::affine::AffineBuilder::ceil(), checkDistinctObjects(), mlir::sparse_tensor::detail::checkedMul(), checkOperandAffineExprRecursively(), mlir::func::impl::DuplicateFunctionEliminationPassBase< DerivedT >::clonePass(), mlir::ValueBoundsConstraintSet::compare(), compareIndices(), mlir::OperationName::compareOpProperties(), comparePosDepth(), mlir::OperationName::UnregisteredOpModel::compareProperties(), mlir::RegisteredOperationName::Model< ConcreteOp >::compareProperties(), composedAffineMultiply(), concatArrayAttr(), mlir::constFoldBinaryOpConditional(), mlir::OperationName::copyOpProperties(), mlir::DynamicOpDefinition::copyProperties(), mlir::OperationName::UnregisteredOpModel::copyProperties(), mlir::RegisteredOperationName::Model< ConcreteOp >::copyProperties(), mlir::func::createDuplicateFunctionEliminationPass(), DEFINE_C_API_STRUCT(), deriveStaticUpperBound(), dominanceSort(), equalIterationSpaces(), mlir::intrange::evaluatePred(), mlir::OperationEquivalence::exactValueMatch(), findDepIdxSet(), mlir::affine::AffineBuilder::floor(), foldBinaryOpChecked(), foldBinaryOpUnchecked(), foldDivMul(), mlir::sparse_tensor::foreachInSparseConstant(), genBuffers(), mlir::pdl_to_pdl_interp::MatcherNode::generateMatcherTree(), mlir::ReductionNode::generateNewVariants(), mlir::quant::detail::AnyQuantizedTypeStorage::KeyTy::genericIsEqual(), mlir::quant::detail::CalibratedQuantizedTypeStorage::KeyTy::genericIsEqual(), mlir::quant::detail::UniformQuantizedPerAxisTypeStorage::KeyTy::genericIsEqual(), mlir::quant::detail::UniformQuantizedSubChannelTypeStorage::KeyTy::genericIsEqual(), mlir::quant::detail::UniformQuantizedTypeStorage::KeyTy::genericIsEqual(), genExpand(), genInvariants(), genResult(), mlir::getAffineBinaryOpExpr(), mlir::getAffineConstantExprs(), getAffineExprOfType(), mlir::arith::impl::ArithIntRangeOptsBase< DerivedT >::getArgumentName(), mlir::vector::getConstantVscaleMultiplier(), mlir::arm_sme::impl::OuterProductFusionBase< DerivedT >::getDependentDialects(), mlir::func::impl::DuplicateFunctionEliminationPassBase< DerivedT >::getDependentDialects(), mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis::getLatticeElement(), mlir::AffineBinaryOpExpr::getLHS(), mlir::MLIRContext::getLoadedDialects(), mlir::arm_sme::impl::OuterProductFusionBase< DerivedT >::getName(), mlir::arm_sme::impl::OuterProductFusionBase< DerivedT >::getPassName(), mlir::arith::getReductionOp(), mlir::MLIRContext::getRegisteredOperationsByDialect(), getSemiAffineExprFromFlatForm(), mlir::vector::ScalableValueBoundsConstraintSet::ConstantOrScalableBound::getSize(), groupByDialectPerByte(), hasSizeMismatch(), idivCheck(), mlir::OperationEquivalence::ignoreValueEquivalence(), mlir::intrange::inferAdd(), mlir::intrange::inferCeilDivS(), mlir::intrange::inferCeilDivU(), mlir::intrange::inferDivS(), inferDivSRange(), mlir::intrange::inferDivU(), inferDivURange(), mlir::intrange::inferFloorDivS(), mlir::intrange::inferMaxS(), mlir::intrange::inferMaxU(), mlir::intrange::inferMinS(), mlir::intrange::inferMinU(), mlir::intrange::inferMul(), mlir::intrange::inferRemS(), mlir::intrange::inferRemU(), mlir::intrange::inferShl(), mlir::intrange::inferShrS(), mlir::intrange::inferShrU(), mlir::intrange::inferSub(), mlir::intrange::inferXor(), inplaceAdd(), mlir::bytecode::detail::IRNumberingState::IRNumberingState(), mlir::sparse_tensor::CodegenEnv::isAdmissibleTensorExp(), mlir::linalg::isDimTimesConstantOrDimOnly(), llvm::DenseMapInfo< mlir::AsmDialectResourceHandle >::isEqual(), llvm::DenseMapInfo< mlir::Block::iterator >::isEqual(), llvm::DenseMapInfo< mlir::NamedAttribute >::isEqual(), llvm::DenseMapInfo< mlir::OperationName >::isEqual(), llvm::DenseMapInfo< mlir::PassInstrumentation::PipelineParentInfo >::isEqual(), llvm::DenseMapInfo< mlir::pdll::ast::Type >::isEqual(), llvm::DenseMapInfo< mlir::ProgramPoint >::isEqual(), llvm::DenseMapInfo< mlir::remark::detail::Remark >::isEqual(), llvm::DenseMapInfo< mlir::SuccessorRange >::isEqual(), llvm::DenseMapInfo< mlir::tblgen::Constraint >::isEqual(), llvm::DenseMapInfo< mlir::tblgen::DagLeaf >::isEqual(), llvm::DenseMapInfo< mlir::tblgen::DagNode >::isEqual(), llvm::DenseMapInfo< mlir::TypeID >::isEqual(), llvm::DenseMapInfo< mlir::TypeRange >::isEqual(), llvm::DenseMapInfo< mlir::Value >::isEqual(), llvm::DenseMapInfo< MlirTypeID >::isEqual(), llvm::DenseMapInfo< T, std::enable_if_t< mlir::detail::IsInterface< T >::value > >::isEqual(), llvm::DenseMapInfo< T, std::enable_if_t< std::is_base_of< mlir::OpState, T >::value &&!mlir::detail::IsInterface< T >::value > >::isEqual(), mlir::DataFlowSolver::isEquivalent(), mlir::OperationEquivalence::isEquivalentTo(), mlir::OperationEquivalence::isEquivalentTo(), mlir::OperationEquivalence::isRegionEquivalentTo(), mlir::OperationEquivalence::isRegionEquivalentTo(), isStaticallyTrue(), mlir::dataflow::AbstractDenseForwardDataFlowAnalysis::join(), mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::join(), mlir::dataflow::ConstantValue::join(), mlir::IntegerValueRange::join(), mlir::StridedMetadataRange::join(), mlir::tosa::ValueKnowledge::join(), mlir::affine::loopUnrollJamByFactor(), makeAtomicReductionGen(), makeReductionGen(), makeVectorShapes(), CanonicalizeContractMatmulToMMT::matchAndRewrite(), FoldAddIntoDest::matchAndRewrite(), IAddCarryFold::matchAndRewrite(), MulExtendedFold< spirv::SMulExtendedOp, true >::matchAndRewrite(), UMulExtendedOpXOne::matchAndRewrite(), materializeBinaryNanCheckIfRequired(), mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::meet(), mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis::meet(), mlir::tosa::ValueKnowledge::meet(), minMaxBy(), mlirAffineAddExprGet(), mlirAffineCeilDivExprGet(), mlirAffineExprEqual(), mlirAffineFloorDivExprGet(), mlirAffineModExprGet(), mlirAffineMulExprGet(), mlirModuleEqual(), mlir::affine::AffineBuilder::mul(), mlir::ArithBuilder::mul(), mulIntegerAttrs(), mlir::operator!=(), mlir::operator!=(), mlir::operator!=(), mlir::operator!=(), mlir::operator!=(), mlir::operator!=(), mlir::RegionSuccessor::operator!=, mlir::sparse_tensor::LevelType::operator!=(), mlir::operator&(), mlir::bufferization::ValueComparator::operator()(), mlir::AffineExpr::operator*(), operator*(), operator/(), mlir::spirv::StructType::MemberDecorationInfo::operator<, mlir::spirv::StructType::StructDecorationInfo::operator<, mlir::operator==(), mlir::operator==(), mlir::operator==(), mlir::operator==(), mlir::operator==(), mlir::operator==(), mlir::RegionBranchPoint::operator==, mlir::sparse_tensor::LevelType::operator==(), mlir::spirv::StructType::MemberDecorationInfo::operator==, mlir::spirv::StructType::StructDecorationInfo::operator==, mlir::operator|(), operator|(), mlir::operator|=(), mlir::sparse_tensor::I64BitSet::operator|=(), operator|=(), mlir::OpAsmParser::parseAssignmentList(), parseCmpOp(), mlir::OpAsmParser::parseOptionalAssignmentList(), mlir::ValueBoundsConstraintSet::populateAndCompare(), mlir::tracing::DebugCounter::print(), mlir::TranslationParser::printOptionInfo(), mlir::printRegisteredPasses(), printResultsAsList(), mlir::AffineExpr::replace(), mlir::AffineExpr::replaceDimsAndSymbols(), mlir::ArithBuilder::select(), mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::setToEntryState(), mlir::ArithBuilder::sgt(), shortenAddChainsContainingAll(), simplifyCeilDiv(), simplifyExprAndOperands(), simplifyFloorDiv(), simplifyMod(), simplifyMul(), mlir::ArithBuilder::slt(), mlir::sparse_tensor::SparseTensorStorage< P, C, V >::sortInPlace(), sortMapByName(), streq(), strne(), mlir::ValueBoundsConstraintSet::strongCompare(), mlir::affine::AffineBuilder::sub(), mlir::ArithBuilder::sub(), subIntegerAttrs(), mlir::tblgen::MethodParameters::subsumes(), mlir::detail::OpToOpPassAdaptor::tryMergeInto(), mlir::sparse_tensor::ir_detail::DimLvlExpr::unpackBinop(), mlir::SimpleAffineExprFlattener::visitAddExpr(), mlir::SimpleAffineExprFlattener::visitModExpr(), mlir::SimpleAffineExprFlattener::visitMulExpr(), mlir::arith::impl::ArithIntRangeOptsBase< DerivedT >::~ArithIntRangeOptsBase(), mlir::LocalAliasAnalysis::~LocalAliasAnalysis(), and mlir::SimpleAffineExprFlattener::~SimpleAffineExprFlattener().

◆ rhs

rhs

Definition at line 832 of file AffineExpr.cpp.