LLVM API Documentation

Defines | Functions | Variables
LoopRotation.cpp File Reference
#include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionTracker.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/CFG.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/CommandLine.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.

Defines

#define DEBUG_TYPE   "loop-rotate"

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)

Variables

static cl::opt< unsignedDefaultRotationThreshold ("rotation-max-header-size", cl::init(16), cl::Hidden, cl::desc("The default maximum header size for automatic loop rotation"))

Define Documentation

#define DEBUG_TYPE   "loop-rotate"

Definition at line 35 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 131 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().

Determine whether the instructions in this range may 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 196 of file LoopRotation.cpp.

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

STATISTIC ( NumRotated  ,
"Number of loops rotated"   
)

Variable Documentation

cl::opt<unsigned> DefaultRotationThreshold("rotation-max-header-size", cl::init(16), cl::Hidden, cl::desc("The default maximum header size for automatic loop rotation")) [static]