llvm::SwitchInst
authorStepan Dyatkovskiy <stpworld@narod.ru>
Sun, 11 Mar 2012 06:09:17 +0000 (06:09 +0000)
committerStepan Dyatkovskiy <stpworld@narod.ru>
Sun, 11 Mar 2012 06:09:17 +0000 (06:09 +0000)
Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default.
Added some notes relative to case iterators.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152532 91177308-0d34-0410-b5e6-96231b3b80d8

19 files changed:
include/llvm/Instructions.h
lib/Analysis/LazyValueInfo.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/ExecutionEngine/Interpreter/Execution.cpp
lib/Target/CBackend/CBackend.cpp
lib/Target/CppBackend/CPPBackend.cpp
lib/Transforms/InstCombine/InstructionCombining.cpp
lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
lib/Transforms/Scalar/GVN.cpp
lib/Transforms/Scalar/LoopUnswitch.cpp
lib/Transforms/Scalar/SCCP.cpp
lib/Transforms/Utils/Local.cpp
lib/Transforms/Utils/LowerExpectIntrinsic.cpp
lib/Transforms/Utils/LowerSwitch.cpp
lib/Transforms/Utils/SimplifyCFG.cpp
lib/VMCore/AsmWriter.cpp
lib/VMCore/Verifier.cpp
tools/llvm-diff/DifferenceEngine.cpp

index 9f13e2125292eb499c09d74be5e476ed74a1e6a3..c40016c53d5845d144ea32b8ca674b67826e6de2 100644 (file)
@@ -2616,32 +2616,34 @@ public:
 
   /// Returns a read/write iterator that points to the first
   /// case in SwitchInst.
-  CaseIt caseBegin() {
+  CaseIt case_begin() {
     return CaseIt(this, 0);
   }
   /// Returns a read-only iterator that points to the first
   /// case in the SwitchInst.
-  ConstCaseIt caseBegin() const {
+  ConstCaseIt case_begin() const {
     return ConstCaseIt(this, 0);
   }
   
   /// Returns a read/write iterator that points one past the last
   /// in the SwitchInst.
-  CaseIt caseEnd() {
+  CaseIt case_end() {
     return CaseIt(this, getNumCases());
   }
   /// Returns a read-only iterator that points one past the last
   /// in the SwitchInst.
-  ConstCaseIt caseEnd() const {
+  ConstCaseIt case_end() const {
     return ConstCaseIt(this, getNumCases());
   }
-  /// Returns an iterator that points to default case.
+  /// Returns an iterator that points to the default case.
   /// Note: this iterator allows to resolve successor only. Attempt
   /// to resolve case value causes an assertion.
-  CaseIt caseDefault() {
+  /// Also note, that increment and decrement also causes an assertion and
+  /// makes iterator invalid. 
+  CaseIt case_default() {
     return CaseIt(this, DefaultPseudoIndex);
   }
-  ConstCaseIt caseDefault() const {
+  ConstCaseIt case_default() const {
     return ConstCaseIt(this, DefaultPseudoIndex);
   }
   
@@ -2650,16 +2652,16 @@ public:
   /// return default case iterator to indicate
   /// that it is handled by the default handler.
   CaseIt findCaseValue(const ConstantInt *C) {
-    for (CaseIt i = caseBegin(), e = caseEnd(); i != e; ++i)
+    for (CaseIt i = case_begin(), e = case_end(); i != e; ++i)
       if (i.getCaseValue() == C)
         return i;
-    return caseDefault();
+    return case_default();
   }
   ConstCaseIt findCaseValue(const ConstantInt *C) const {
-    for (ConstCaseIt i = caseBegin(), e = caseEnd(); i != e; ++i)
+    for (ConstCaseIt i = case_begin(), e = case_end(); i != e; ++i)
       if (i.getCaseValue() == C)
         return i;
-    return caseDefault();
+    return case_default();
   }    
   
   /// findCaseDest - Finds the unique case value for a given successor. Returns
@@ -2668,7 +2670,7 @@ public:
     if (BB == getDefaultDest()) return NULL;
 
     ConstantInt *CI = NULL;
-    for (CaseIt i = caseBegin(), e = caseEnd(); i != e; ++i) {
+    for (CaseIt i = case_begin(), e = case_end(); i != e; ++i) {
       if (i.getCaseSuccessor() == BB) {
         if (CI) return NULL;   // Multiple cases lead to BB.
         else CI = i.getCaseValue();
@@ -2684,6 +2686,7 @@ public:
   /// removeCase - This method removes the specified case and its successor
   /// from the switch instruction. Note that this operation may reorder the
   /// remaining cases at index idx and above.
+  /// Also note, that iterator becomes invalid after this operation.
   ///
   void removeCase(CaseIt i);
 
index 6f1137eab74dd94bde4a6c1c5dae818e38b01e56..5ca2746c9f6a6c76e86fa9fb9091d12e5dedaf1e 100644 (file)
@@ -866,7 +866,7 @@ bool LazyValueInfoCache::getEdgeValue(Value *Val, BasicBlock *BBFrom,
       // BBFrom to BBTo.
       unsigned NumEdges = 0;
       ConstantInt *EdgeVal = 0;
-      for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd();
+      for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end();
            i != e; ++i) {
         if (i.getCaseSuccessor() != BBTo) continue;
         if (NumEdges++) break;
index c04c0097a0f3c09d92244d08c13a9d0df425c5d4..b25d2e96d59474f03bbf60a6f2328645dca74f3a 100644 (file)
@@ -1142,7 +1142,7 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
       Vals.push_back(VE.getTypeID(SI.getCondition()->getType()));
       Vals.push_back(VE.getValueID(SI.getCondition()));
       Vals.push_back(VE.getValueID(SI.getDefaultDest()));
-      for (SwitchInst::CaseIt i = SI.caseBegin(), e = SI.caseEnd();
+      for (SwitchInst::CaseIt i = SI.case_begin(), e = SI.case_end();
            i != e; ++i) {
         Vals.push_back(VE.getValueID(i.getCaseValue()));
         Vals.push_back(VE.getValueID(i.getCaseSuccessor()));
index b8fd8d6e1f042aa83deacd9b81c9652bee168cf2..3a79e36dc2ec80b419789f8a9ec5b9837f1f610a 100644 (file)
@@ -2411,7 +2411,7 @@ size_t SelectionDAGBuilder::Clusterify(CaseVector& Cases,
 
   BranchProbabilityInfo *BPI = FuncInfo.BPI;
   // Start with "simple" cases
-  for (SwitchInst::ConstCaseIt i = SI.caseBegin(), e = SI.caseEnd();
+  for (SwitchInst::ConstCaseIt i = SI.case_begin(), e = SI.case_end();
        i != e; ++i) {
     const BasicBlock *SuccBB = i.getCaseSuccessor();
     MachineBasicBlock *SMBB = FuncInfo.MBBMap[SuccBB];
index b021e104373134d9a59da018bafaad4d02f7b06a..af47be9c5b56f45e10cd18fd770dbca148bf9391 100644 (file)
@@ -650,7 +650,7 @@ void Interpreter::visitSwitchInst(SwitchInst &I) {
 
   // Check to see if any of the cases match...
   BasicBlock *Dest = 0;
-  for (SwitchInst::CaseIt i = I.caseBegin(), e = I.caseEnd(); i != e; ++i) {
+  for (SwitchInst::CaseIt i = I.case_begin(), e = I.case_end(); i != e; ++i) {
     GenericValue CaseVal = getOperandValue(i.getCaseValue(), SF);
     if (executeICMP_EQ(CondVal, CaseVal, ElTy).IntVal != 0) {
       Dest = cast<BasicBlock>(i.getCaseSuccessor());
index 2c1b68544dd9be587c2ed88fefbb6e396d972bf9..b6b209eb06f54234c5ebad71903fbf94d1dce059 100644 (file)
@@ -2393,7 +2393,7 @@ void CWriter::visitSwitchInst(SwitchInst &SI) {
   Out << ";\n";
 
   // Skip the first item since that's the default case.
-  for (SwitchInst::CaseIt i = SI.caseBegin(), e = SI.caseEnd(); i != e; ++i) {
+  for (SwitchInst::CaseIt i = SI.case_begin(), e = SI.case_end(); i != e; ++i) {
     ConstantInt* CaseVal = i.getCaseValue();
     BasicBlock* Succ = i.getCaseSuccessor();
     Out << "  case ";
index 36ed92569e9e5b70f0e8797aa7ceb0992dd58094..107c6ccb47dddcc876b882429b8d2fbb8d5da4a0 100644 (file)
@@ -1090,7 +1090,7 @@ void CppWriter::printInstruction(const Instruction *I,
         << getOpName(SI->getDefaultDest()) << ", "
         << SI->getNumCases() << ", " << bbname << ");";
     nl(Out);
-    for (SwitchInst::ConstCaseIt i = SI->caseBegin(), e = SI->caseEnd();
+    for (SwitchInst::ConstCaseIt i = SI->case_begin(), e = SI->case_end();
          i != e; ++i) {
       const ConstantInt* CaseVal = i.getCaseValue();
       const BasicBlock *BB = i.getCaseSuccessor();
index b5dfc8abb1353b68f5138fff55e3eb58f505aa6c..349ba83961c470da3839501b5e0022d84bc14508 100644 (file)
@@ -1246,7 +1246,7 @@ Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) {
       if (ConstantInt *AddRHS = dyn_cast<ConstantInt>(I->getOperand(1))) {
         // change 'switch (X+4) case 1:' into 'switch (X) case -3'
         // Skip the first item since that's the default case.
-        for (SwitchInst::CaseIt i = SI.caseBegin(), e = SI.caseEnd();
+        for (SwitchInst::CaseIt i = SI.case_begin(), e = SI.case_end();
              i != e; ++i) {
           ConstantInt* CaseVal = i.getCaseValue();
           Constant* NewCaseVal = ConstantExpr::getSub(cast<Constant>(CaseVal),
@@ -1873,7 +1873,7 @@ static bool AddReachableCodeToWorklist(BasicBlock *BB,
     } else if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) {
       if (ConstantInt *Cond = dyn_cast<ConstantInt>(SI->getCondition())) {
         // See if this is an explicit destination.
-        for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd();
+        for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end();
              i != e; ++i)
           if (i.getCaseValue() == Cond) {
             BasicBlock *ReachableBB = i.getCaseSuccessor();
index 3fd72a4306cb405bfdad676e8026fea307778e18..9b0aadb0b5b032bbea22b6ed21b190506847dc81 100644 (file)
@@ -199,7 +199,7 @@ bool CorrelatedValuePropagation::processSwitch(SwitchInst *SI) {
   // Analyse each switch case in turn.  This is done in reverse order so that
   // removing a case doesn't cause trouble for the iteration.
   bool Changed = false;
-  for (SwitchInst::CaseIt CI = SI->caseEnd(), CE = SI->caseBegin(); CI-- != CE;
+  for (SwitchInst::CaseIt CI = SI->case_end(), CE = SI->case_begin(); CI-- != CE;
        ) {
     ConstantInt *Case = CI.getCaseValue();
 
index 45e6aff0ee7a85740b7962574ccd7f85fa2c7bdf..ac80c489f9627edc851e0b2535d35d9dfd582a9a 100644 (file)
@@ -2158,7 +2158,7 @@ bool GVN::processInstruction(Instruction *I) {
     Value *SwitchCond = SI->getCondition();
     BasicBlock *Parent = SI->getParent();
     bool Changed = false;
-    for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd();
+    for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end();
          i != e; ++i) {
       BasicBlock *Dst = i.getCaseSuccessor();
       if (isOnlyReachableViaThisEdge(Parent, Dst, DT))
index 28e0706116668b4f143f5fc07bcff347d81e18e5..780683eb803390aa27d15cb372a194505676f24d 100644 (file)
@@ -445,7 +445,7 @@ bool LoopUnswitch::processCurrentLoop() {
         // Do not process same value again and again.
         // At this point we have some cases already unswitched and
         // some not yet unswitched. Let's find the first not yet unswitched one.
-        for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd();
+        for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end();
              i != e; ++i) {
           Constant* UnswitchValCandidate = i.getCaseValue();
           if (!BranchesInfo.isUnswitched(SI, UnswitchValCandidate)) {
@@ -575,7 +575,7 @@ bool LoopUnswitch::IsTrivialUnswitchCondition(Value *Cond, Constant **Val,
     // this. 
     // Note that we can't trivially unswitch on the default case or
     // on already unswitched cases.
-    for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd();
+    for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end();
          i != e; ++i) {
       BasicBlock* LoopExitCandidate;
       if ((LoopExitCandidate = isTrivialLoopExitBlock(currentLoop, 
@@ -1121,7 +1121,7 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
     
     SwitchInst::CaseIt DeadCase = SI->findCaseValue(cast<ConstantInt>(Val));
     // Default case is live for multiple values.
-    if (DeadCase == SI->caseDefault()) continue;
+    if (DeadCase == SI->case_default()) continue;
     
     // Found a dead case value.  Don't remove PHI nodes in the 
     // successor if they become single-entry, those PHI nodes may
index 8d0b86606a8a3d42ef11c0f0943a8d5deb378dbc..5ce82b96245d5a50f2c77268181b4a8a95e2377d 100644 (file)
@@ -1488,12 +1488,12 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
       // If the input to SCCP is actually switch on undef, fix the undef to
       // the first constant.
       if (isa<UndefValue>(SI->getCondition())) {
-        SI->setCondition(SI->caseBegin().getCaseValue());
-        markEdgeExecutable(BB, SI->caseBegin().getCaseSuccessor());
+        SI->setCondition(SI->case_begin().getCaseValue());
+        markEdgeExecutable(BB, SI->case_begin().getCaseSuccessor());
         return true;
       }
 
-      markForcedConstant(SI->getCondition(), SI->caseBegin().getCaseValue());
+      markForcedConstant(SI->getCondition(), SI->case_begin().getCaseValue());
       return true;
     }
   }
index 6ea3b935757278462addee1e429d87924de6720f..5f895eb68ba44301e9fbb2679bca180717cb1193 100644 (file)
@@ -110,7 +110,7 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions) {
     BasicBlock *DefaultDest = TheOnlyDest;
 
     // Figure out which case it goes to.
-    for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd();
+    for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end();
          i != e; ++i) {
       // Found case matching a constant operand?
       if (i.getCaseValue() == CI) {
@@ -168,7 +168,7 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions) {
     if (SI->getNumCases() == 1) {
       // Otherwise, we can fold this switch into a conditional branch
       // instruction if it has only one non-default destination.
-      SwitchInst::CaseIt FirstCase = SI->caseBegin();
+      SwitchInst::CaseIt FirstCase = SI->case_begin();
       Value *Cond = Builder.CreateICmpEQ(SI->getCondition(),
           FirstCase.getCaseValue(), "cond");
 
index 0e9cdf55b242d977d01f7af3622045845a0522f8..c70ced18e45d83eec082250c5b010af1335445ec 100644 (file)
@@ -79,7 +79,7 @@ bool LowerExpectIntrinsic::HandleSwitchExpect(SwitchInst *SI) {
   Vec.resize(n + 1 + 1); // +1 for MDString and +1 for default case
 
   Vec[0] = MDString::get(Context, "branch_weights");
-  Vec[1] = ConstantInt::get(Int32Ty, Case == SI->caseDefault() ?
+  Vec[1] = ConstantInt::get(Int32Ty, Case == SI->case_default() ?
                             LikelyBranchWeight : UnlikelyBranchWeight);
   for (unsigned i = 0; i < n; ++i) {
     Vec[i + 1 + 1] = ConstantInt::get(Int32Ty, i == Case.getCaseIndex() ?
index 84029a58731ba90b8f20bae2771d6b17cc36f2b7..a16130d3d74a33bf4c136401dd57ac09a6eebd95 100644 (file)
@@ -237,7 +237,7 @@ unsigned LowerSwitch::Clusterify(CaseVector& Cases, SwitchInst *SI) {
   unsigned numCmps = 0;
 
   // Start with "simple" cases
-  for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i)
+  for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end(); i != e; ++i)
     Cases.push_back(CaseRange(i.getCaseValue(), i.getCaseValue(),
                               i.getCaseSuccessor()));
   
index 33694e9dc07906c6ca7f27a235979deee1c5d2fe..d53a46ee0235bd136b405ccd1440a9198205f95b 100644 (file)
@@ -480,7 +480,7 @@ GetValueEqualityComparisonCases(TerminatorInst *TI,
                                                       BasicBlock*> > &Cases) {
   if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) {
     Cases.reserve(SI->getNumCases());
-    for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i)
+    for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end(); i != e; ++i)
       Cases.push_back(std::make_pair(i.getCaseValue(),
                                      i.getCaseSuccessor()));
     return SI->getDefaultDest();
@@ -605,7 +605,7 @@ SimplifyEqualityComparisonWithOnlyPredecessor(TerminatorInst *TI,
     DEBUG(dbgs() << "Threading pred instr: " << *Pred->getTerminator()
                  << "Through successor TI: " << *TI);
 
-    for (SwitchInst::CaseIt i = SI->caseEnd(), e = SI->caseBegin(); i != e;) {
+    for (SwitchInst::CaseIt i = SI->case_end(), e = SI->case_begin(); i != e;) {
       --i;
       if (DeadCases.count(i.getCaseValue())) {
         i.getCaseSuccessor()->removePredecessor(TI->getParent());
@@ -2094,7 +2094,7 @@ static bool TryToSimplifyUncondBranchWithICmpInIt(ICmpInst *ICI,
   // Ok, the block is reachable from the default dest.  If the constant we're
   // comparing exists in one of the other edges, then we can constant fold ICI
   // and zap it.
-  if (SI->findCaseValue(Cst) != SI->caseDefault()) {
+  if (SI->findCaseValue(Cst) != SI->case_default()) {
     Value *V;
     if (ICI->getPredicate() == ICmpInst::ICMP_EQ)
       V = ConstantInt::getFalse(BB->getContext());
@@ -2421,7 +2421,7 @@ bool SimplifyCFGOpt::SimplifyUnreachable(UnreachableInst *UI) {
         }
       }
     } else if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) {
-      for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd();
+      for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end();
            i != e; ++i)
         if (i.getCaseSuccessor() == BB) {
           BB->removePredecessor(SI->getParent());
@@ -2433,7 +2433,7 @@ bool SimplifyCFGOpt::SimplifyUnreachable(UnreachableInst *UI) {
       // destination and make it the default.
       if (SI->getDefaultDest() == BB) {
         std::map<BasicBlock*, std::pair<unsigned, unsigned> > Popularity;
-        for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd();
+        for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end();
              i != e; ++i) {
           std::pair<unsigned, unsigned> &entry =
               Popularity[i.getCaseSuccessor()];
@@ -2470,7 +2470,7 @@ bool SimplifyCFGOpt::SimplifyUnreachable(UnreachableInst *UI) {
             for (unsigned i = 0; i != MaxPop-1; ++i)
               MaxBlock->removePredecessor(SI->getParent());
           
-          for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd();
+          for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end();
                i != e; ++i)
             if (i.getCaseSuccessor() == MaxBlock) {
               SI->removeCase(i);
@@ -2518,10 +2518,10 @@ static bool TurnSwitchRangeIntoICmp(SwitchInst *SI, IRBuilder<> &Builder) {
 
   // Make sure all cases point to the same destination and gather the values.
   SmallVector<ConstantInt *, 16> Cases;
-  SwitchInst::CaseIt I = SI->caseBegin();
+  SwitchInst::CaseIt I = SI->case_begin();
   Cases.push_back(I.getCaseValue());
   SwitchInst::CaseIt PrevI = I++;
-  for (SwitchInst::CaseIt E = SI->caseEnd(); I != E; PrevI = I++) {
+  for (SwitchInst::CaseIt E = SI->case_end(); I != E; PrevI = I++) {
     if (PrevI.getCaseSuccessor() != I.getCaseSuccessor())
       return false;
     Cases.push_back(I.getCaseValue());
@@ -2543,10 +2543,10 @@ static bool TurnSwitchRangeIntoICmp(SwitchInst *SI, IRBuilder<> &Builder) {
     Sub = Builder.CreateAdd(Sub, Offset, Sub->getName()+".off");
   Value *Cmp = Builder.CreateICmpULT(Sub, NumCases, "switch");
   Builder.CreateCondBr(
-      Cmp, SI->caseBegin().getCaseSuccessor(), SI->getDefaultDest());
+      Cmp, SI->case_begin().getCaseSuccessor(), SI->getDefaultDest());
 
   // Prune obsolete incoming values off the successor's PHI nodes.
-  for (BasicBlock::iterator BBI = SI->caseBegin().getCaseSuccessor()->begin();
+  for (BasicBlock::iterator BBI = SI->case_begin().getCaseSuccessor()->begin();
        isa<PHINode>(BBI); ++BBI) {
     for (unsigned I = 0, E = SI->getNumCases()-1; I != E; ++I)
       cast<PHINode>(BBI)->removeIncomingValue(SI->getParent());
@@ -2566,7 +2566,7 @@ static bool EliminateDeadSwitchCases(SwitchInst *SI) {
 
   // Gather dead cases.
   SmallVector<ConstantInt*, 8> DeadCases;
-  for (SwitchInst::CaseIt I = SI->caseBegin(), E = SI->caseEnd(); I != E; ++I) {
+  for (SwitchInst::CaseIt I = SI->case_begin(), E = SI->case_end(); I != E; ++I) {
     if ((I.getCaseValue()->getValue() & KnownZero) != 0 ||
         (I.getCaseValue()->getValue() & KnownOne) != KnownOne) {
       DeadCases.push_back(I.getCaseValue());
@@ -2578,7 +2578,7 @@ static bool EliminateDeadSwitchCases(SwitchInst *SI) {
   // Remove dead cases from the switch.
   for (unsigned I = 0, E = DeadCases.size(); I != E; ++I) {
     SwitchInst::CaseIt Case = SI->findCaseValue(DeadCases[I]);
-    assert(Case != SI->caseDefault() &&
+    assert(Case != SI->case_default() &&
            "Case was not found. Probably mistake in DeadCases forming.");
     // Prune unused values from PHI nodes.
     Case.getCaseSuccessor()->removePredecessor(SI->getParent());
@@ -2630,7 +2630,7 @@ static bool ForwardSwitchConditionToPHI(SwitchInst *SI) {
   typedef DenseMap<PHINode*, SmallVector<int,4> > ForwardingNodesMap;
   ForwardingNodesMap ForwardingNodes;
 
-  for (SwitchInst::CaseIt I = SI->caseBegin(), E = SI->caseEnd(); I != E; ++I) {
+  for (SwitchInst::CaseIt I = SI->case_begin(), E = SI->case_end(); I != E; ++I) {
     ConstantInt *CaseValue = I.getCaseValue();
     BasicBlock *CaseDest = I.getCaseSuccessor();
 
index c3a352fa0d99f82e9be329aab8c4f650bef4a72b..7b39efb7c7a0fd878ffa9f36b46c5c23b83f6036 100644 (file)
@@ -1731,7 +1731,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
     Out << ", ";
     writeOperand(SI.getDefaultDest(), true);
     Out << " [";
-    for (SwitchInst::CaseIt i = SI.caseBegin(), e = SI.caseEnd();
+    for (SwitchInst::CaseIt i = SI.case_begin(), e = SI.case_end();
          i != e; ++i) {
       Out << "\n    ";
       writeOperand(i.getCaseValue(), true);
index 95f525101f0a5144f87728f070278e7362287c1f..5b9b2a5258c60150772947f9d1211fae0aa941aa 100644 (file)
@@ -813,7 +813,7 @@ void Verifier::visitSwitchInst(SwitchInst &SI) {
   // have the same type as the switched-on value.
   Type *SwitchTy = SI.getCondition()->getType();
   SmallPtrSet<ConstantInt*, 32> Constants;
-  for (SwitchInst::CaseIt i = SI.caseBegin(), e = SI.caseEnd(); i != e; ++i) {
+  for (SwitchInst::CaseIt i = SI.case_begin(), e = SI.case_end(); i != e; ++i) {
     Assert1(i.getCaseValue()->getType() == SwitchTy,
             "Switch constants must all be same type as switch value!", &SI);
     Assert2(Constants.insert(i.getCaseValue()),
index 726da71033671dc02e75a6e3546cd54eb14adfbb..a5a99f5b9c4761abd8a6359637e31e05042b5fd5 100644 (file)
@@ -320,11 +320,11 @@ class FunctionDifferenceEngine {
 
       DenseMap<ConstantInt*,BasicBlock*> LCases;
       
-      for (SwitchInst::CaseIt I = LI->caseBegin(), E = LI->caseEnd();
+      for (SwitchInst::CaseIt I = LI->case_begin(), E = LI->case_end();
            I != E; ++I)
         LCases[I.getCaseValue()] = I.getCaseSuccessor();
         
-      for (SwitchInst::CaseIt I = RI->caseBegin(), E = RI->caseEnd();
+      for (SwitchInst::CaseIt I = RI->case_begin(), E = RI->case_end();
            I != E; ++I) {
         ConstantInt *CaseValue = I.getCaseValue();
         BasicBlock *LCase = LCases[CaseValue];