32#define DEBUG_TYPE "loop-split-utils"
36 cl::desc(
"Iteration offsets (relative to the induction start) "
37 "at which to split each loop"),
41 "loop-split-unguarded",
42 cl::desc(
"Partition indices whose entry guard is omitted (the caller "
43 "guarantees they run at least one iteration)"),
59 if (!
match(IndVarSCEV,
65 const SCEV *End = IndAR->evaluateAtIteration(BTC, SE);
66 Type *Ty = Start->getType();
75 const SCEV *PrevStart = Start;
114 for (
unsigned P = 0;
P <
N; ++
P) {
115 dbgs() <<
"LS-MAP partition " <<
P <<
":\n";
120 dbgs() <<
"LS-MAP " << VH->getName() <<
" -> "
121 << (M ? M->getName() :
"<none>") <<
"\n";
142 for (
Loop *L : Worklist) {
static cl::list< unsigned > UnguardedPartitions("loop-split-unguarded", cl::desc("Partition indices whose entry guard is omitted (the caller " "guarantees they run at least one iteration)"), cl::CommaSeparated)
static bool splitLoop(Loop *L, ScalarEvolution &SE, DominatorTree &DT, LoopInfo &LI)
Build the partition list for L from the command-line split offsets and run the transform.
static cl::list< unsigned > SplitPoints("loop-split-points", cl::desc("Iteration offsets (relative to the induction start) " "at which to split each loop"), cl::CommaSeparated)
This file defines the SmallVector class.
Class for arbitrary precision integers.
bool isAllOnes() const
Determine if all bits are set. This is true for zero-width values.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
LLVM Basic Block Representation.
Analysis pass which computes a DominatorTree.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Analysis pass that exposes the LoopInfo for a function.
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Splits a counted loop into a chain of per-partition sub-loops.
LLVM_ABI bool split()
Perform the split.
LLVM_ABI unsigned getNumPartitions() const
LLVM_ABI PHINode * getInductionVariable() const
Return the loop's induction variable. Valid only after isLegal() succeeds.
LLVM_ABI bool isLegal()
Analyze L and return true if it is a counted loop this utility can split: a bottom-tested single-exit...
LLVM_ABI void addPartition(const SCEV *Start, const SCEV *End)
Append an inclusive partition range [Start, End] in iteration order.
LLVM_ABI Value * getPartitionValue(Value *V, unsigned PartitionIndex) const
Return the counterpart of original-loop value V in partition PartitionIndex (0-based).
LLVM_ABI void avoidPartitionGuard(unsigned PartitionIndex)
Suppress the entry guard for partition PartitionIndex (already added).
Represents a single loop in the control flow graph.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
This class represents an analyzed expression in the program.
Type * getType() const
Return the LLVM type of this SCEV expression.
Analysis pass that exposes the ScalarEvolution for a function.
The main scalar evolution driver.
LLVM_ABI const SCEV * getBackedgeTakenCount(const Loop *L, ExitCountKind Kind=Exact)
If the specified loop has a predictable backedge-taken count, return it, otherwise return a SCEVCould...
LLVM_ABI const SCEV * getConstant(ConstantInt *V)
LLVM_ABI const SCEV * getSCEV(Value *V)
Return a SCEV expression for the full generality of the specified expression.
LLVM_ABI const SCEV * getMinusSCEV(SCEVUse LHS, SCEVUse RHS, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Return LHS-RHS.
const SCEV * getOne(Type *Ty)
Return a SCEV for the constant 1 of a specific type.
LLVM_ABI const SCEV * getTruncateExpr(const SCEV *Op, Type *Ty, unsigned Depth=0)
LLVM_ABI const SCEV * getAddExpr(SmallVectorImpl< SCEVUse > &Ops, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap, unsigned Depth=0)
Get a canonical add expression, or something simpler if possible.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
Value handle that is nullable, but tries to track the Value.
bind_cst_ty m_scev_APInt(const APInt *&C)
Match an SCEV constant and bind it to an APInt.
bool match(const SCEV *S, const Pattern &P)
SCEVAffineAddRec_match< Op0_t, Op1_t, match_isa< const Loop > > m_scev_AffineAddRec(const Op0_t &Op0, const Op1_t &Op1)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.