LLVM
8.0.1
|
#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 "llvm/Transforms/Utils/Local.h"
Go to the source code of this file.
Namespaces | |
llvm | |
This class represents lattice values for constants. | |
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 Instruction * | GetLoopInvariantInsertPosition (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... | |
#define DEBUG_TYPE "indvars" |
Definition at line 33 of file SimplifyIndVar.cpp.
Referenced by llvm::simplifyLoopIVs().
|
static |
Definition at line 653 of file SimplifyIndVar.cpp.
References llvm::MCID::Add, C, llvm::dbgs(), llvm::SCEV::FlagAnyWrap, llvm::IntegerType::get(), llvm::ScalarEvolution::getAddExpr(), getBitWidth(), llvm::Value::getContext(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::ScalarEvolution::getMinusSCEV(), llvm::ScalarEvolution::getMulExpr(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Value::getType(), llvm::ConstantRange::getUnsignedMin(), llvm::Instruction::hasNoSignedWrap(), llvm::Instruction::hasNoUnsignedWrap(), I, llvm::Instruction::isExact(), LLVM_DEBUG, llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::Value::replaceAllUsesWith(), Rewriter, llvm::Instruction::setHasNoSignedWrap(), llvm::Instruction::setHasNoUnsignedWrap(), llvm::Instruction::setIsExact(), llvm::APInt::uge(), and llvm::Value::users().
|
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 855 of file SimplifyIndVar.cpp.
References assert(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::SCEVAddRecExpr::getLoop(), llvm::ScalarEvolution::getSCEV(), llvm::Value::getType(), llvm::isInstructionTriviallyDead(), llvm::ScalarEvolution::isSCEVable(), N, llvm::SmallVectorImpl< T >::pop_back_val(), pushIVUsers(), llvm::JumpTable::Simplified, llvm::SmallPtrSetImplBase::size(), and llvm::IVVisitor::visitCast().
|
static |
Add all uses of Def to the current IV's worklist.
Definition at line 821 of file SimplifyIndVar.cpp.
References llvm::LoopBase< BlockT, LoopT >::contains(), llvm::SmallPtrSetImpl< PtrType >::insert(), and llvm::Value::users().
Referenced by isSimpleIVUser().
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" | |||
) |