LLVM API Documentation

Defines | Functions
LoopUnroll.cpp File Reference
#include "llvm/Transforms/Utils/UnrollLoop.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionTracker.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/Dominators.h"
#include "llvm/IR/DiagnosticInfo.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.

Defines

#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)
static BasicBlockFoldBlockIntoPredecessor (BasicBlock *BB, LoopInfo *LI, LPPassManager *LPM, SmallPtrSetImpl< Loop * > &ForgottenLoops)

Define Documentation

#define DEBUG_TYPE   "loop-unroll"

Definition at line 41 of file LoopUnroll.cpp.


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::LoopInfo::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::LoopInfo::removeBlock(), llvm::Value::replaceAllUsesWith(), llvm::Value::setName(), and llvm::iplist< NodeTy, Traits >::splice().

Referenced by llvm::UnrollLoop().

static void RemapInstruction ( Instruction I,
ValueToValueMapTy VMap 
) [inline, static]

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(), 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)"   
)