LLVM  3.7.0
Macros | Functions
LoopUnroll.cpp File Reference
#include "llvm/Transforms/Utils/UnrollLoop.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopIterator.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/LoopUtils.h"
#include "llvm/Transforms/Utils/SimplifyIndVar.h"
Include dependency graph for LoopUnroll.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "loop-unroll"
 

Functions

 STATISTIC (NumCompletelyUnrolled,"Number of loops completely unrolled")
 
 STATISTIC (NumUnrolled,"Number of loops unrolled (completely or otherwise)")
 
static void RemapInstruction (Instruction *I, ValueToValueMapTy &VMap)
 RemapInstruction - Convert the instruction operands from referencing the current values into those specified by VMap. More...
 
static BasicBlockFoldBlockIntoPredecessor (BasicBlock *BB, LoopInfo *LI, LPPassManager *LPM, SmallPtrSetImpl< Loop * > &ForgottenLoops)
 FoldBlockIntoPredecessor - Folds a basic block into its predecessor if it only has one predecessor, and that predecessor only has one successor. More...
 

Macro Definition Documentation

#define DEBUG_TYPE   "loop-unroll"

Definition at line 41 of file LoopUnroll.cpp.

Referenced by llvm::UnrollLoop().

Function Documentation

static BasicBlock* FoldBlockIntoPredecessor ( BasicBlock BB,
LoopInfo LI,
LPPassManager LPM,
SmallPtrSetImpl< Loop * > &  ForgottenLoops 
)
static

FoldBlockIntoPredecessor - Folds a basic block into its predecessor if it only has one predecessor, and that predecessor only has one successor.

The LoopInfo Analysis that is passed will be kept consistent. If folding is successful references to the containing loop must be removed from ScalarEvolution by calling ScalarEvolution::forgetLoop because SE may have references to the eliminated BB. The argument ForgottenLoops contains a set of loops that have already been forgotten to prevent redundant, expensive calls to ScalarEvolution::forgetLoop. Returns the new combined block.

Definition at line 76 of file LoopUnroll.cpp.

References llvm::dbgs(), DEBUG, llvm::StringRef::empty(), llvm::BasicBlock::end(), llvm::BasicBlock::eraseFromParent(), llvm::FoldSingleEntryPHINodes(), llvm::Pass::getAnalysisIfAvailable(), llvm::BasicBlock::getInstList(), llvm::LoopInfoBase< N, M >::getLoopFor(), llvm::Value::getName(), llvm::TerminatorInst::getNumSuccessors(), llvm::BasicBlock::getSinglePredecessor(), llvm::BasicBlock::getTerminator(), llvm::Value::hasName(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::iplist< NodeTy, Traits >::pop_back(), llvm::LoopInfoBase< N, M >::removeBlock(), llvm::Value::replaceAllUsesWith(), llvm::Value::setName(), and llvm::iplist< NodeTy, Traits >::splice().

Referenced by llvm::UnrollLoop().

static void RemapInstruction ( Instruction I,
ValueToValueMapTy VMap 
)
inlinestatic

RemapInstruction - Convert the instruction operands from referencing the current values into those specified by VMap.

Definition at line 49 of file LoopUnroll.cpp.

References llvm::ValueMap< KeyT, ValueT, Config >::end(), llvm::ValueMap< KeyT, ValueT, Config >::find(), llvm::User::getNumOperands(), llvm::User::getOperand(), op, llvm::ValueMapIterator< DenseMapT, KeyT >::ValueTypeProxy::second, and llvm::User::setOperand().

STATISTIC ( NumCompletelyUnrolled  ,
"Number of loops completely unrolled"   
)
STATISTIC ( NumUnrolled  ,
"Number of loops unrolled (completely or otherwise)"   
)