31struct NormalizeDenormalizeRewriter
41 : SCEVRewriteVisitor<NormalizeDenormalizeRewriter>(SE), Kind(Kind),
43 const SCEV *visitAddRecExpr(
const SCEVAddRecExpr *Expr);
48NormalizeDenormalizeRewriter::visitAddRecExpr(
const SCEVAddRecExpr *AR) {
52 [&](
SCEVUse Op) { return visit(Op.getPointer()); });
66 for (
int i = 0, e = Operands.
size() - 1; i < e; i++)
67 Operands[i] = SE.getAddExpr(Operands[i], Operands[i + 1]);
90 for (
int i = Operands.
size() - 2; i >= 0; i--)
91 Operands[i] = SE.getMinusSCEV(Operands[i], Operands[i + 1]);
100 bool CheckInvertible) {
106 const SCEV *Normalized =
107 NormalizeDenormalizeRewriter(
Normalize, Pred, SE).visit(S);
110 if (CheckInvertible && Denormalized != S)
117 return NormalizeDenormalizeRewriter(
Normalize, Pred, SE).visit(S);
128 return NormalizeDenormalizeRewriter(
Denormalize, Pred, SE).visit(S);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
TransformKind
TransformKind - Different types of transformations that TransformForPostIncUse can do.
@ Normalize
Normalize - Normalize according to the given loops.
@ Denormalize
Denormalize - Perform the inverse transform on the expression with the given loop set.
This node represents a polynomial recurrence on the trip count of the specified loop.
const Loop * getLoop() const
ArrayRef< SCEVUse > operands() const
This visitor recursively visits a SCEV expression and re-writes it.
This class represents an analyzed expression in the program.
static constexpr auto FlagAnyWrap
The main scalar evolution driver.
This is an optimization pass for GlobalISel generic memory operations.
OutputIt transform(R &&Range, OutputIt d_first, UnaryFunction F)
Wrapper function around std::transform to apply a function to a range and store the result elsewhere.
LLVM_ABI const SCEV * denormalizeForPostIncUse(const SCEV *S, const PostIncLoopSet &Loops, ScalarEvolution &SE)
Denormalize S to be post-increment for all loops present in Loops.
function_ref< bool(const SCEVAddRecExpr *)> NormalizePredTy
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
LLVM_ABI const SCEV * normalizeForPostIncUse(const SCEV *S, const PostIncLoopSet &Loops, ScalarEvolution &SE, bool CheckInvertible=true)
Normalize S to be post-increment for all loops present in Loops.
DWARFExpression::Operation Op
SmallPtrSet< const Loop *, 2 > PostIncLoopSet
LLVM_ABI const SCEV * normalizeForPostIncUseIf(const SCEV *S, NormalizePredTy Pred, ScalarEvolution &SE)
Normalize S for all add recurrence sub-expressions for which Pred returns true.
SCEVUseT< const SCEV * > SCEVUse