#include "llvm/Transforms/Scalar/LoopBoundSplit.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/Analysis/LoopAnalysisManager.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/LoopSimplify.h"
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
#define DEBUG_TYPE …
namespace llvm {
usingnamespacePatternMatch;
namespace {
struct ConditionInfo { … };
}
static void analyzeICmp(ScalarEvolution &SE, ICmpInst *ICmp,
ConditionInfo &Cond, const Loop &L) { … }
static bool calculateUpperBound(const Loop &L, ScalarEvolution &SE,
ConditionInfo &Cond, bool IsExitCond) { … }
static bool hasProcessableCondition(const Loop &L, ScalarEvolution &SE,
ICmpInst *ICmp, ConditionInfo &Cond,
bool IsExitCond) { … }
static bool isProcessableCondBI(const ScalarEvolution &SE,
const BranchInst *BI) { … }
static bool canSplitLoopBound(const Loop &L, const DominatorTree &DT,
ScalarEvolution &SE, ConditionInfo &Cond) { … }
static bool isProfitableToTransform(const Loop &L, const BranchInst *BI) { … }
static BranchInst *findSplitCandidate(const Loop &L, ScalarEvolution &SE,
ConditionInfo &ExitingCond,
ConditionInfo &SplitCandidateCond) { … }
static bool splitLoopBound(Loop &L, DominatorTree &DT, LoopInfo &LI,
ScalarEvolution &SE, LPMUpdater &U) { … }
PreservedAnalyses LoopBoundSplitPass::run(Loop &L, LoopAnalysisManager &AM,
LoopStandardAnalysisResults &AR,
LPMUpdater &U) { … }
}