LLVM 22.0.0git
|
#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"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "loop-bound-split" |
Functions | |
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) |
#define DEBUG_TYPE "loop-bound-split" |
Definition at line 22 of file LoopBoundSplit.cpp.
|
static |
Definition at line 50 of file LoopBoundSplit.cpp.
References llvm::cast(), Cond, llvm::dyn_cast(), llvm::PHINode::getIncomingValueForBlock(), llvm::ScalarEvolution::getSCEV(), llvm::CmpInst::getSwappedPredicate(), llvm::isa(), llvm::PatternMatch::m_ICmp(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), and std::swap().
Referenced by hasProcessableCondition().
|
static |
Definition at line 79 of file LoopBoundSplit.cpp.
References llvm::BitWidth, Cond, llvm::dyn_cast(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getConstant(), llvm::ScalarEvolution::getExitCount(), llvm::APInt::getMaxValue(), llvm::ScalarEvolution::getOne(), llvm::APInt::getSignedMaxValue(), llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm::isa(), llvm::ScalarEvolution::isKnownPredicate(), and llvm::CmpInst::isSigned().
Referenced by hasProcessableCondition().
|
static |
Definition at line 177 of file LoopBoundSplit.cpp.
References llvm::cast(), Cond, llvm::dyn_cast(), llvm::BranchInst::getCondition(), llvm::BasicBlock::getTerminator(), hasProcessableCondition(), and isProcessableCondBI().
Referenced by splitLoopBound().
|
static |
Definition at line 241 of file LoopBoundSplit.cpp.
References llvm::cast(), llvm::dyn_cast(), llvm::SCEVAddRecExpr::getStart(), llvm::SCEV::getType(), hasProcessableCondition(), llvm::ScalarEvolution::isLoopEntryGuardedByCond(), and isProcessableCondBI().
Referenced by splitLoopBound().
|
static |
Definition at line 124 of file LoopBoundSplit.cpp.
References analyzeICmp(), calculateUpperBound(), llvm::cast(), Cond, llvm::ConstantInt::getValue(), llvm::isa(), llvm::ScalarEvolution::isAvailableAtLoopEntry(), llvm::ConstantInt::isNegative(), and llvm::ConstantInt::isZero().
Referenced by canSplitLoopBound(), and findSplitCandidate().
|
static |
Definition at line 158 of file LoopBoundSplit.cpp.
References assert(), llvm::ScalarEvolution::isSCEVable(), LHS, llvm::PatternMatch::m_BasicBlock(), llvm::PatternMatch::m_Br(), llvm::PatternMatch::m_ICmp(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), and RHS.
Referenced by canSplitLoopBound(), and findSplitCandidate().
|
static |
Definition at line 221 of file LoopBoundSplit.cpp.
References llvm::BasicBlock::getSingleSuccessor(), and llvm::BranchInst::getSuccessor().
Referenced by splitLoopBound().
|
static |
Definition at line 286 of file LoopBoundSplit.cpp.
References llvm::PHINode::addIncoming(), llvm::BasicBlock::begin(), canSplitLoopBound(), llvm::cast(), llvm::DominatorTreeBase< NodeT, IsPostDom >::changeImmediateDominator(), llvm::cloneLoopWithPreheader(), Cond, llvm::dyn_cast(), llvm::Instruction::eraseFromParent(), llvm::SCEVExpander::expandCodeFor(), findSplitCandidate(), llvm::ScalarEvolution::forgetLoop(), llvm::BasicBlock::front(), llvm::BasicBlock::getContext(), llvm::LoopBase< BlockT, LoopT >::getExitBlock(), llvm::LoopBase< BlockT, LoopT >::getExitingBlock(), llvm::ConstantInt::getFalse(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::ScalarEvolution::getSCEV(), llvm::ScalarEvolution::getSMinExpr(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::ConstantInt::getTrue(), llvm::SCEV::getType(), llvm::ScalarEvolution::getUMinExpr(), llvm::CmpInst::ICMP_NE, isProfitableToTransform(), llvm::ScalarEvolution::isSCEVable(), llvm::CmpInst::isSigned(), llvm::BasicBlock::phis(), llvm::remapInstructionsInBlocks(), llvm::seq(), llvm::BranchInst::setCondition(), llvm::Instruction::setDebugLoc(), llvm::PHINode::setIncomingValueForBlock(), llvm::Value::setName(), llvm::User::setOperand(), llvm::BranchInst::setSuccessor(), llvm::simplifyLoop(), and llvm::SplitEdge().
Referenced by llvm::LoopBoundSplitPass::run().