Add some constantness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188844 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakub Staszak 2013-08-20 23:04:15 +00:00
parent 815af99a04
commit 328a4fbfbb
3 changed files with 11 additions and 8 deletions

View File

@ -118,7 +118,7 @@ class BlockFrequencyImpl {
/// isBackedge - Return if edge Src -> Dst is a reachable backedge. /// isBackedge - Return if edge Src -> Dst is a reachable backedge.
/// ///
bool isBackedge(BlockT *Src, BlockT *Dst) { bool isBackedge(BlockT *Src, BlockT *Dst) const {
unsigned a = RPO.lookup(Src); unsigned a = RPO.lookup(Src);
if (!a) if (!a)
return false; return false;

View File

@ -65,7 +65,8 @@ bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum,
/// on branchy code but not loops, and LI is most useful on code with loops but /// on branchy code but not loops, and LI is most useful on code with loops but
/// does not help on branchy code outside loops. /// does not help on branchy code outside loops.
bool isPotentiallyReachable(const Instruction *From, const Instruction *To, bool isPotentiallyReachable(const Instruction *From, const Instruction *To,
DominatorTree *DT = 0, LoopInfo *LI = 0); const DominatorTree *DT = 0,
const LoopInfo *LI = 0);
/// \brief Determine whether block 'To' is reachable from 'From', returning /// \brief Determine whether block 'To' is reachable from 'From', returning
/// true if uncertain. /// true if uncertain.
@ -74,7 +75,8 @@ bool isPotentiallyReachable(const Instruction *From, const Instruction *To,
/// Returns false only if we can prove that once 'From' has been reached then /// Returns false only if we can prove that once 'From' has been reached then
/// 'To' can not be executed. Conservatively returns true. /// 'To' can not be executed. Conservatively returns true.
bool isPotentiallyReachable(const BasicBlock *From, const BasicBlock *To, bool isPotentiallyReachable(const BasicBlock *From, const BasicBlock *To,
DominatorTree *DT = 0, LoopInfo *LI = 0); const DominatorTree *DT = 0,
const LoopInfo *LI = 0);
} // End llvm namespace } // End llvm namespace

View File

@ -116,7 +116,7 @@ bool llvm::isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum,
// LoopInfo contains a mapping from basic block to the innermost loop. Find // LoopInfo contains a mapping from basic block to the innermost loop. Find
// the outermost loop in the loop nest that contains BB. // the outermost loop in the loop nest that contains BB.
static const Loop *getOutermostLoop(LoopInfo *LI, const BasicBlock *BB) { static const Loop *getOutermostLoop(const LoopInfo *LI, const BasicBlock *BB) {
const Loop *L = LI->getLoopFor(BB); const Loop *L = LI->getLoopFor(BB);
if (L) { if (L) {
while (const Loop *Parent = L->getParentLoop()) while (const Loop *Parent = L->getParentLoop())
@ -126,7 +126,7 @@ static const Loop *getOutermostLoop(LoopInfo *LI, const BasicBlock *BB) {
} }
// True if there is a loop which contains both BB1 and BB2. // True if there is a loop which contains both BB1 and BB2.
static bool loopContainsBoth(LoopInfo *LI, static bool loopContainsBoth(const LoopInfo *LI,
const BasicBlock *BB1, const BasicBlock *BB2) { const BasicBlock *BB1, const BasicBlock *BB2) {
const Loop *L1 = getOutermostLoop(LI, BB1); const Loop *L1 = getOutermostLoop(LI, BB1);
const Loop *L2 = getOutermostLoop(LI, BB2); const Loop *L2 = getOutermostLoop(LI, BB2);
@ -135,7 +135,8 @@ static bool loopContainsBoth(LoopInfo *LI,
static bool isPotentiallyReachableInner(SmallVectorImpl<BasicBlock *> &Worklist, static bool isPotentiallyReachableInner(SmallVectorImpl<BasicBlock *> &Worklist,
BasicBlock *StopBB, BasicBlock *StopBB,
DominatorTree *DT, LoopInfo *LI) { const DominatorTree *DT,
const LoopInfo *LI) {
// When the stop block is unreachable, it's dominated from everywhere, // When the stop block is unreachable, it's dominated from everywhere,
// regardless of whether there's a path between the two blocks. // regardless of whether there's a path between the two blocks.
if (DT && !DT->isReachableFromEntry(StopBB)) if (DT && !DT->isReachableFromEntry(StopBB))
@ -179,7 +180,7 @@ static bool isPotentiallyReachableInner(SmallVectorImpl<BasicBlock *> &Worklist,
} }
bool llvm::isPotentiallyReachable(const BasicBlock *A, const BasicBlock *B, bool llvm::isPotentiallyReachable(const BasicBlock *A, const BasicBlock *B,
DominatorTree *DT, LoopInfo *LI) { const DominatorTree *DT, const LoopInfo *LI) {
assert(A->getParent() == B->getParent() && assert(A->getParent() == B->getParent() &&
"This analysis is function-local!"); "This analysis is function-local!");
@ -191,7 +192,7 @@ bool llvm::isPotentiallyReachable(const BasicBlock *A, const BasicBlock *B,
} }
bool llvm::isPotentiallyReachable(const Instruction *A, const Instruction *B, bool llvm::isPotentiallyReachable(const Instruction *A, const Instruction *B,
DominatorTree *DT, LoopInfo *LI) { const DominatorTree *DT, const LoopInfo *LI) {
assert(A->getParent()->getParent() == B->getParent()->getParent() && assert(A->getParent()->getParent() == B->getParent()->getParent() &&
"This analysis is function-local!"); "This analysis is function-local!");