From: Rong Xu <xur@google.com> Date: Fri, 20 Nov 2015 23:02:06 +0000 (+0000) Subject: Add some constantness to GetSuccessorNumber(). X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ba29cc35f84c7b3887a49de1f000d03c605d09d2;p=oota-llvm.git Add some constantness to GetSuccessorNumber(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253733 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/CFG.h b/include/llvm/Analysis/CFG.h index 7c4df780198..35165f4061f 100644 --- a/include/llvm/Analysis/CFG.h +++ b/include/llvm/Analysis/CFG.h @@ -40,7 +40,7 @@ void FindFunctionBackedges( /// Search for the specified successor of basic block BB and return its position /// in the terminator instruction's list of successors. It is an error to call /// this with a block that is not a successor. -unsigned GetSuccessorNumber(BasicBlock *BB, BasicBlock *Succ); +unsigned GetSuccessorNumber(const BasicBlock *BB, const BasicBlock *Succ); /// Return true if the specified edge is a critical edge. Critical edges are /// edges from a block with multiple successors to a block with multiple diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index 041fcb6313b..0dfd57d3cb6 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -69,8 +69,9 @@ void llvm::FindFunctionBackedges(const Function &F, /// and return its position in the terminator instruction's list of /// successors. It is an error to call this with a block that is not a /// successor. -unsigned llvm::GetSuccessorNumber(BasicBlock *BB, BasicBlock *Succ) { - TerminatorInst *Term = BB->getTerminator(); +unsigned llvm::GetSuccessorNumber(const BasicBlock *BB, + const BasicBlock *Succ) { + const TerminatorInst *Term = BB->getTerminator(); #ifndef NDEBUG unsigned e = Term->getNumSuccessors(); #endif