[llvm] r253733 - Add some constantness to GetSuccessorNumber().

Rong Xu via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 20 15:02:06 PST 2015


Author: xur
Date: Fri Nov 20 17:02:06 2015
New Revision: 253733

URL: http://llvm.org/viewvc/llvm-project?rev=253733&view=rev
Log:
Add some constantness to GetSuccessorNumber().

Modified:
    llvm/trunk/include/llvm/Analysis/CFG.h
    llvm/trunk/lib/Analysis/CFG.cpp

Modified: llvm/trunk/include/llvm/Analysis/CFG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CFG.h?rev=253733&r1=253732&r2=253733&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CFG.h (original)
+++ llvm/trunk/include/llvm/Analysis/CFG.h Fri Nov 20 17:02:06 2015
@@ -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

Modified: llvm/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFG.cpp?rev=253733&r1=253732&r2=253733&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CFG.cpp (original)
+++ llvm/trunk/lib/Analysis/CFG.cpp Fri Nov 20 17:02:06 2015
@@ -69,8 +69,9 @@ void llvm::FindFunctionBackedges(const 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




More information about the llvm-commits mailing list