LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
LoopRotation.cpp File Reference
#include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/CodeMetrics.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/SSAUpdater.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
Include dependency graph for LoopRotation.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "loop-rotate"
 
#define MAX_HEADER_SIZE   16
 

Functions

 STATISTIC (NumRotated,"Number of loops rotated")
 
static void RewriteUsesOfClonedInstructions (BasicBlock *OrigHeader, BasicBlock *OrigPreheader, ValueToValueMapTy &ValueMap)
 
static bool shouldSpeculateInstrs (BasicBlock::iterator Begin, BasicBlock::iterator End)
 

Macro Definition Documentation

#define DEBUG_TYPE   "loop-rotate"

Definition at line 14 of file LoopRotation.cpp.

#define MAX_HEADER_SIZE   16

Definition at line 33 of file LoopRotation.cpp.

Function Documentation

static void RewriteUsesOfClonedInstructions ( BasicBlock OrigHeader,
BasicBlock OrigPreheader,
ValueToValueMapTy ValueMap 
)
static

RewriteUsesOfClonedInstructions - We just cloned the instructions from the old header into the preheader. If there were uses of the values produced by these instruction that were outside of the loop, we have to insert PHI nodes to merge the two values. Do this now.

Definition at line 102 of file LoopRotation.cpp.

References llvm::SSAUpdater::AddAvailableValue(), llvm::BasicBlock::begin(), llvm::dyn_cast(), llvm::BasicBlock::end(), llvm::PHINode::getBasicBlockIndex(), llvm::Value::getName(), llvm::Instruction::getParent(), llvm::Value::getType(), llvm::Use::getUser(), I, llvm::SSAUpdater::Initialize(), llvm::PHINode::removeIncomingValue(), llvm::SSAUpdater::RewriteUse(), llvm::Value::use_begin(), llvm::Value::use_empty(), and llvm::Value::use_end().

static bool shouldSpeculateInstrs ( BasicBlock::iterator  Begin,
BasicBlock::iterator  End 
)
static

Determine whether the instructions in this range my be safely and cheaply speculated. This is not an important enough situation to develop complex heuristics. We handle a single arithmetic instruction along with any type conversions.

Definition at line 167 of file LoopRotation.cpp.

References llvm::APIntOps::And(), I, llvm::isSafeToSpeculativelyExecute(), llvm::APIntOps::Or(), and llvm::APIntOps::Xor().

STATISTIC ( NumRotated  ,
"Number of loops rotated"   
)