LLVM API Documentation

Defines | Functions | Variables
LoopIdiomRecognize.cpp File Reference
#include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Transforms/Utils/Local.h"
Include dependency graph for LoopIdiomRecognize.cpp:

Go to the source code of this file.

Defines

#define DEBUG_TYPE   "loop-idiom"

Functions

 STATISTIC (NumMemSet,"Number of memset's formed from loop stores")
 STATISTIC (NumMemCpy,"Number of memcpy's formed from loop load+stores")
 INITIALIZE_PASS_BEGIN (LoopIdiomRecognize,"loop-idiom","Recognize loop idioms", false, false) INITIALIZE_PASS_END(LoopIdiomRecognize
static void deleteDeadInstruction (Instruction *I, ScalarEvolution &SE, const TargetLibraryInfo *TLI)
static void deleteIfDeadInstruction (Value *V, ScalarEvolution &SE, const TargetLibraryInfo *TLI)
static bool mayLoopAccessLocation (Value *Ptr, AliasAnalysis::ModRefResult Access, Loop *L, const SCEV *BECount, unsigned StoreSize, AliasAnalysis &AA, Instruction *IgnoredStore)
static ConstantgetMemSetPatternValue (Value *V, const DataLayout &DL)

Variables

loop idiom
loop Recognize loop idioms
loop Recognize loop false

Define Documentation

#define DEBUG_TYPE   "loop-idiom"

Definition at line 63 of file LoopIdiomRecognize.cpp.


Function Documentation

static void deleteDeadInstruction ( Instruction I,
ScalarEvolution SE,
const TargetLibraryInfo TLI 
) [static]

deleteDeadInstruction - Delete this instruction. Before we do, go through and zero out all the operands of this instruction. If any of them become dead, delete them and the computation tree that feeds them.

Definition at line 235 of file LoopIdiomRecognize.cpp.

References llvm::SmallVectorBase::empty(), llvm::Instruction::eraseFromParent(), llvm::ScalarEvolution::forgetValue(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::isInstructionTriviallyDead(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::User::setOperand(), and llvm::Value::use_empty().

Referenced by deleteIfDeadInstruction().

static void deleteIfDeadInstruction ( Value V,
ScalarEvolution SE,
const TargetLibraryInfo TLI 
) [static]

deleteIfDeadInstruction - If the specified value is a dead instruction, delete it and any recursively used instructions.

Definition at line 268 of file LoopIdiomRecognize.cpp.

References deleteDeadInstruction(), I, and llvm::isInstructionTriviallyDead().

static Constant* getMemSetPatternValue ( Value V,
const DataLayout DL 
) [static]

getMemSetPatternValue - If a strided store of the specified value is safe to turn into a memset_pattern16, return a ConstantArray of 16 bytes that should be passed in. Otherwise, return null.

Note that we don't ever attempt to use memset_pattern8 or 4, because these just replicate their input array and then pass on to memset_pattern16.

Definition at line 907 of file LoopIdiomRecognize.cpp.

References llvm::CallingConv::C, llvm::dyn_cast(), llvm::Value::getType(), llvm::DataLayout::getTypeSizeInBits(), and llvm::DataLayout::isBigEndian().

INITIALIZE_PASS_BEGIN ( LoopIdiomRecognize  ,
"loop-idiom ,
"Recognize loop idioms ,
false  ,
false   
)
static bool mayLoopAccessLocation ( Value Ptr,
AliasAnalysis::ModRefResult  Access,
Loop L,
const SCEV BECount,
unsigned  StoreSize,
AliasAnalysis AA,
Instruction IgnoredStore 
) [static]

mayLoopAccessLocation - Return true if the specified loop might access the specified pointer location, which is a loop-strided access. The 'Access' argument specifies what the verboten forms of access are (read or write).

Definition at line 871 of file LoopIdiomRecognize.cpp.

References llvm::LoopBase< BlockT, LoopT >::block_begin(), llvm::LoopBase< BlockT, LoopT >::block_end(), llvm::AliasAnalysis::getModRefInfo(), and I.

STATISTIC ( NumMemSet  ,
"Number of memset's formed from loop stores"   
)
STATISTIC ( NumMemCpy  ,
"Number of memcpy's formed from loop load+stores"   
)

Variable Documentation

loop Recognize loop false

Definition at line 226 of file LoopIdiomRecognize.cpp.

loop idiom

Definition at line 226 of file LoopIdiomRecognize.cpp.

loop Recognize loop idioms

Definition at line 226 of file LoopIdiomRecognize.cpp.