LLVM API Documentation
#include "llvm/Analysis/IVUsers.h"#include "llvm/Constants.h"#include "llvm/Instructions.h"#include "llvm/Type.h"#include "llvm/DerivedTypes.h"#include "llvm/Analysis/Dominators.h"#include "llvm/Analysis/LoopInfo.h"#include "llvm/Analysis/LoopPass.h"#include "llvm/Analysis/ScalarEvolutionExpressions.h"#include "llvm/ADT/STLExtras.h"#include "llvm/Support/Debug.h"#include "llvm/Support/raw_ostream.h"#include <algorithm>
Go to the source code of this file.
Defines | |
| #define | DEBUG_TYPE "iv-users" |
Functions | |
| Pass * | llvm::createIVUsersPass () |
| static bool | containsAddRecFromDifferentLoop (const SCEV *S, Loop *L) |
| static bool | getSCEVStartAndStride (const SCEV *&SH, Loop *L, Loop *UseLoop, const SCEV *&Start, const SCEV *&Stride, ScalarEvolution *SE, DominatorTree *DT) |
| static bool | IVUseShouldUsePostIncValue (Instruction *User, Instruction *IV, Loop *L, LoopInfo *LI, DominatorTree *DT, Pass *P) |
Variables | |
| static RegisterPass< IVUsers > | X ("iv-users","Induction Variable Users", false, true) |
| #define DEBUG_TYPE "iv-users" |
Definition at line 15 of file IVUsers.cpp.
containsAddRecFromDifferentLoop - Determine whether expression S involves a subexpression that is an AddRec from a loop other than L. An outer loop of L is OK, but not an inner loop nor a disjoint loop.
Definition at line 42 of file IVUsers.cpp.
References DE, and llvm::LoopInfo::isNotAlreadyContainedIn().
Referenced by containsAddRecFromDifferentLoop(), and getSCEVStartAndStride().
| static bool getSCEVStartAndStride | ( | const SCEV *& | SH, | |
| Loop * | L, | |||
| Loop * | UseLoop, | |||
| const SCEV *& | Start, | |||
| const SCEV *& | Stride, | |||
| ScalarEvolution * | SE, | |||
| DominatorTree * | DT | |||
| ) | [static] |
getSCEVStartAndStride - Compute the start and stride of this expression, returning false if the expression is not a start/stride pair, or true if it is. The stride must be a loop invariant expression, but the start may be a mix of loop invariant and loop variant expressions. The start cannot, however, contain an AddRec from a different loop, unless that loop is an outer loop of the current loop.
Definition at line 83 of file IVUsers.cpp.
References containsAddRecFromDifferentLoop(), DEBUG, llvm::SCEV::dominates(), llvm::dyn_cast(), llvm::errs(), llvm::ScalarEvolution::getAddExpr(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::SCEVAddRecExpr::getLoop(), llvm::LoopBase< BlockT, LoopT >::getLoopPreheader(), llvm::ScalarEvolution::getSCEVAtScope(), llvm::SCEVAddRecExpr::getStart(), llvm::SCEVAddRecExpr::getStepRecurrence(), and Preheader.
Referenced by llvm::IVUsers::AddUsersIfInteresting().
| static bool IVUseShouldUsePostIncValue | ( | Instruction * | User, | |
| Instruction * | IV, | |||
| Loop * | L, | |||
| LoopInfo * | LI, | |||
| DominatorTree * | DT, | |||
| Pass * | P | |||
| ) | [static] |
IVUseShouldUsePostIncValue - We have discovered a "User" of an IV expression and now we need to decide whether the user should use the preinc or post-inc value. If this user should use the post-inc version of the IV, return true.
Choosing wrong here can break dominance properties (if we choose to use the post-inc value when we cannot) or it can end up adding extra live-ranges to the loop, resulting in reg-reg copies (if we use the pre-inc value when we should use the post-inc value).
Definition at line 148 of file IVUsers.cpp.
References llvm::LoopBase< BlockT, LoopT >::contains(), llvm::DominatorTree::dominates(), llvm::dyn_cast(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::LoopBase< BlockT, LoopT >::getLoopLatch(), llvm::PHINode::getNumIncomingValues(), and llvm::Instruction::getParent().
Referenced by llvm::IVUsers::AddUsersIfInteresting().
RegisterPass<IVUsers> X("iv-users","Induction Variable Users", false, true) [static] |