MLIR
20.0.0git
|
#include "mlir/Transforms/LoopInvariantCodeMotionUtils.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Interfaces/SubsetOpInterface.h"
#include "llvm/Support/Debug.h"
#include <queue>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "licm" |
Functions | |
static bool | canBeHoisted (Operation *op, function_ref< bool(OpOperand &)> condition) |
Checks whether the given op can be hoisted by checking that. More... | |
static bool | canBeHoisted (Operation *op, function_ref< bool(Value)> definedOutside) |
static OpOperand * | getSingleTerminatorUse (Value value) |
If the given value has a single use by an op that is a terminator, return that use. More... | |
static LoopLikeOpInterface | hoistSubsetAtIterArg (RewriterBase &rewriter, LoopLikeOpInterface loopLike, BlockArgument iterArg) |
Hoist all subset ops that operate on the idx-th region iter_arg of the given loop-like op and index into loop-invariant subset locations. More... | |
#define DEBUG_TYPE "licm" |
Definition at line 23 of file LoopInvariantCodeMotionUtils.cpp.
|
static |
Checks whether the given op can be hoisted by checking that.
Definition at line 31 of file LoopInvariantCodeMotionUtils.cpp.
References mlir::WalkResult::advance(), mlir::Operation::hasTrait(), mlir::WalkResult::interrupt(), mlir::Operation::isAncestor(), and mlir::Operation::walk().
Referenced by canBeHoisted(), hoistSubsetAtIterArg(), and mlir::moveLoopInvariantCode().
|
static |
Definition at line 53 of file LoopInvariantCodeMotionUtils.cpp.
References canBeHoisted(), and mlir::IROperand< DerivedT, IRValueT >::get().
If the given value has a single use by an op that is a terminator, return that use.
Otherwise, return nullptr.
Definition at line 230 of file LoopInvariantCodeMotionUtils.cpp.
References mlir::detail::IROperandBase::getOwner(), mlir::Value::getUses(), mlir::Value::hasOneUse(), and mlir::Operation::hasTrait().
|
static |
Hoist all subset ops that operate on the idx-th region iter_arg of the given loop-like op and index into loop-invariant subset locations.
Return the newly created loop op (that has extra iter_args) or the original loop op if nothing was hoisted.
Definition at line 321 of file LoopInvariantCodeMotionUtils.cpp.
References canBeHoisted(), mlir::IROperand< DerivedT, IRValueT >::get(), mlir::BlockArgument::getOwner(), mlir::Block::getParentOp(), mlir::RewriterBase::moveOpAfter(), mlir::RewriterBase::moveOpBefore(), and mlir::RewriterBase::replaceAllUsesWith().
Referenced by mlir::hoistLoopInvariantSubsets().