LLVM  6.0.0svn
Namespaces | Macros | Functions
SimplifyIndVar.cpp File Reference
#include "llvm/Transforms/Utils/SimplifyIndVar.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
Include dependency graph for SimplifyIndVar.cpp:

Go to the source code of this file.

Namespaces

 llvm
 Compute iterated dominance frontiers using a linear time algorithm.
 

Macros

#define DEBUG_TYPE   "indvars"
 

Functions

 STATISTIC (NumElimIdentity, "Number of IV identities eliminated")
 
 STATISTIC (NumElimOperand, "Number of IV operands folded into a use")
 
 STATISTIC (NumFoldedUser, "Number of IV users folded into a constant")
 
 STATISTIC (NumElimRem, "Number of IV remainder operations eliminated")
 
 STATISTIC (NumSimplifiedSDiv, "Number of IV signed division operations converted to unsigned division")
 
 STATISTIC (NumSimplifiedSRem, "Number of IV signed remainder operations converted to unsigned remainder")
 
 STATISTIC (NumElimCmp, "Number of IV comparisons eliminated")
 
static InstructionGetLoopInvariantInsertPosition (Loop *L, Instruction *Hint)
 
static void pushIVUsers (Instruction *Def, Loop *L, SmallPtrSet< Instruction *, 16 > &Simplified, SmallVectorImpl< std::pair< Instruction *, Instruction *> > &SimpleIVUsers)
 Add all uses of Def to the current IV's worklist. More...
 
static bool isSimpleIVUser (Instruction *I, const Loop *L, ScalarEvolution *SE)
 Return true if this instruction generates a simple SCEV expression in terms of that IV. More...
 
bool llvm::simplifyUsersOfIV (PHINode *CurrIV, ScalarEvolution *SE, DominatorTree *DT, LoopInfo *LI, SmallVectorImpl< WeakTrackingVH > &Dead, SCEVExpander &Rewriter, IVVisitor *V=nullptr)
 simplifyUsersOfIV - Simplify instructions that use this induction variable by using ScalarEvolution to analyze the IV's recurrence. More...
 
bool llvm::simplifyLoopIVs (Loop *L, ScalarEvolution *SE, DominatorTree *DT, LoopInfo *LI, SmallVectorImpl< WeakTrackingVH > &Dead)
 SimplifyLoopIVs - Simplify users of induction variables within this loop. More...
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "indvars"

Definition at line 32 of file SimplifyIndVar.cpp.

Referenced by llvm::simplifyLoopIVs().

Function Documentation

◆ GetLoopInvariantInsertPosition()

static Instruction* GetLoopInvariantInsertPosition ( Loop L,
Instruction Hint 
)
static

◆ isSimpleIVUser()

static bool isSimpleIVUser ( Instruction I,
const Loop L,
ScalarEvolution SE 
)
static

Return true if this instruction generates a simple SCEV expression in terms of that IV.

This is similar to IVUsers' isInteresting() but processes each instruction non-recursively when the operand is already known to be a simpleIVUser.

Definition at line 727 of file SimplifyIndVar.cpp.

References assert(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::SCEVAddRecExpr::getLoop(), llvm::ScalarEvolution::getSCEV(), llvm::Value::getType(), llvm::ScalarEvolution::isSCEVable(), N, llvm::SmallVectorImpl< T >::pop_back_val(), pushIVUsers(), llvm::JumpTable::Simplified, llvm::SmallPtrSetImplBase::size(), and llvm::IVVisitor::visitCast().

◆ pushIVUsers()

static void pushIVUsers ( Instruction Def,
Loop L,
SmallPtrSet< Instruction *, 16 > &  Simplified,
SmallVectorImpl< std::pair< Instruction *, Instruction *> > &  SimpleIVUsers 
)
static

Add all uses of Def to the current IV's worklist.

Definition at line 693 of file SimplifyIndVar.cpp.

References llvm::LoopBase< BlockT, LoopT >::contains(), llvm::SmallPtrSetImpl< PtrType >::insert(), and llvm::Value::users().

Referenced by isSimpleIVUser().

◆ STATISTIC() [1/7]

STATISTIC ( NumElimIdentity  ,
"Number of IV identities eliminated"   
)

◆ STATISTIC() [2/7]

STATISTIC ( NumElimOperand  ,
"Number of IV operands folded into a use  
)

◆ STATISTIC() [3/7]

STATISTIC ( NumFoldedUser  ,
"Number of IV users folded into a constant"   
)

◆ STATISTIC() [4/7]

STATISTIC ( NumElimRem  ,
"Number of IV remainder operations eliminated"   
)

◆ STATISTIC() [5/7]

STATISTIC ( NumSimplifiedSDiv  ,
"Number of IV signed division operations converted to unsigned division"   
)

◆ STATISTIC() [6/7]

STATISTIC ( NumSimplifiedSRem  ,
"Number of IV signed remainder operations converted to unsigned remainder  
)

◆ STATISTIC() [7/7]

STATISTIC ( NumElimCmp  ,
"Number of IV comparisons eliminated"   
)