LLVM
8.0.1
|
#include "llvm/Transforms/Scalar/LoopSimplifyCFG.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/DependenceAnalysis.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/MemorySSAUpdater.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/IR/DomTreeUpdater.h"
#include "llvm/IR/Dominators.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "llvm/Transforms/Utils.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/LoopUtils.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "loop-simplifycfg" |
Functions | |
STATISTIC (NumTerminatorsFolded, "Number of terminators folded to unconditional branches") | |
STATISTIC (NumLoopBlocksDeleted, "Number of loop blocks deleted") | |
STATISTIC (NumLoopExitsDeleted, "Number of loop exiting edges deleted") | |
static BasicBlock * | getOnlyLiveSuccessor (BasicBlock *BB) |
If BB is a switch or a conditional branch, but only one of its successors can be reached from this block in runtime, return this successor. More... | |
static bool | constantFoldTerminators (Loop &L, DominatorTree &DT, LoopInfo &LI, ScalarEvolution &SE, MemorySSAUpdater *MSSAU) |
Turn branches and switches with known constant conditions into unconditional branches. More... | |
static bool | mergeBlocksIntoPredecessors (Loop &L, DominatorTree &DT, LoopInfo &LI, MemorySSAUpdater *MSSAU) |
static bool | simplifyLoopCFG (Loop &L, DominatorTree &DT, LoopInfo &LI, ScalarEvolution &SE, MemorySSAUpdater *MSSAU) |
INITIALIZE_PASS_BEGIN (LoopSimplifyCFGLegacyPass, "loop-simplifycfg", "Simplify loop CFG", false, false) INITIALIZE_PASS_END(LoopSimplifyCFGLegacyPass | |
Variables | |
static cl::opt< bool > | EnableTermFolding ("enable-loop-simplifycfg-term-folding", cl::init(false)) |
loop | simplifycfg |
loop Simplify loop | CFG |
loop Simplify loop | false |
#define DEBUG_TYPE "loop-simplifycfg" |
Definition at line 42 of file LoopSimplifyCFG.cpp.
|
static |
Turn branches and switches with known constant conditions into unconditional branches.
Definition at line 546 of file LoopSimplifyCFG.cpp.
References EnableTermFolding, and llvm::LoopBase< BlockT, LoopT >::getLoopLatch().
Referenced by simplifyLoopCFG().
|
static |
If BB
is a switch or a conditional branch, but only one of its successors can be reached from this block in runtime, return this successor.
Otherwise, return nullptr.
Definition at line 57 of file LoopSimplifyCFG.cpp.
References llvm::LoopBase< BlockT, LoopT >::addChildLoop(), llvm::LoopInfoBase< BlockT, LoopT >::addTopLevelLoop(), llvm::any_of(), assert(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::LoopBlocksDFS::beginPostorder(), llvm::LoopBlocksDFS::beginRPO(), llvm::LoopBase< BlockT, LoopT >::blocks(), llvm::LoopInfoBase< BlockT, LoopT >::changeLoopFor(), llvm::concat(), llvm::LoopBase< BlockT, LoopT >::contains(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::dbgs(), llvm::DeleteDeadBlock(), llvm::DomTreeUpdater::deleteEdge(), DFS(), llvm::dump(), llvm::dyn_cast(), E, llvm::DomTreeUpdater::Eager, llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::LoopBlocksDFS::endPostorder(), llvm::LoopBlocksDFS::endRPO(), llvm::LoopInfo::erase(), llvm::Instruction::eraseFromParent(), llvm::ScalarEvolution::forgetTopmostLoop(), From, llvm::UndefValue::get(), llvm::LoopBase< BlockT, LoopT >::getExitBlocks(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::LoopBase< BlockT, LoopT >::getLoopDepth(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::Value::getName(), llvm::LoopBase< BlockT, LoopT >::getNumBlocks(), llvm::BasicBlock::getParent(), llvm::LoopBase< BlockT, LoopT >::getParentLoop(), llvm::Instruction::getSuccessor(), llvm::BasicBlock::getTerminator(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::DomTreeUpdater::insertEdge(), llvm::LoopBlocksDFS::isComplete(), llvm::LoopInfoBase< BlockT, LoopT >::isLoopHeader(), llvm::DominatorTree::isReachableFromEntry(), llvm::ConstantInt::isZero(), LLVM_DEBUG, llvm::LoopBlocksDFS::perform(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::LoopInfoBase< BlockT, LoopT >::removeBlock(), llvm::MemorySSAUpdater::removeBlocks(), llvm::MemorySSAUpdater::removeDuplicatePhiEdgesBetween(), llvm::MemorySSAUpdater::removeEdge(), RPO, SI, llvm::SmallVectorBase::size(), llvm::SmallPtrSetImplBase::size(), llvm::BasicBlock::splitBasicBlock(), llvm::successors(), llvm::DominatorTreeBase< NodeT, IsPostDom >::verify(), and llvm::LoopInfoBase< BlockT, LoopT >::verify().
INITIALIZE_PASS_BEGIN | ( | LoopSimplifyCFGLegacyPass | , |
"loop-simplifycfg" | , | ||
"Simplify loop CFG" | , | ||
false | , | ||
false | |||
) |
Referenced by llvm::LoopSimplifyCFGPass::run().
|
static |
Definition at line 561 of file LoopSimplifyCFG.cpp.
References llvm::LoopBase< BlockT, LoopT >::blocks(), llvm::DomTreeUpdater::Eager, llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::BasicBlock::getSinglePredecessor(), llvm::BasicBlock::getSingleSuccessor(), and llvm::MergeBlockIntoPredecessor().
Referenced by simplifyLoopCFG().
|
static |
Definition at line 589 of file LoopSimplifyCFG.cpp.
References constantFoldTerminators(), llvm::ScalarEvolution::forgetTopmostLoop(), and mergeBlocksIntoPredecessors().
Referenced by llvm::LoopSimplifyCFGPass::run().
STATISTIC | ( | NumTerminatorsFolded | , |
"Number of terminators folded to unconditional branches" | |||
) |
STATISTIC | ( | NumLoopBlocksDeleted | , |
"Number of loop blocks deleted" | |||
) |
STATISTIC | ( | NumLoopExitsDeleted | , |
"Number of loop exiting edges deleted" | |||
) |
loop Simplify loop CFG |
Definition at line 660 of file LoopSimplifyCFG.cpp.
|
static |
Referenced by constantFoldTerminators().
loop Simplify loop false |
Definition at line 660 of file LoopSimplifyCFG.cpp.
loop simplifycfg |
Definition at line 660 of file LoopSimplifyCFG.cpp.