Remove use of Instruction::getNext
authorChris Lattner <sabre@nondot.org>
Tue, 17 Apr 2007 17:52:45 +0000 (17:52 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 17 Apr 2007 17:52:45 +0000 (17:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36201 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/LoadValueNumbering.cpp

index 5188dae5291611a40b3a083cf5fdcd517aa2c1a1..16687b0419416ca12cfe24281d6e6d07b84fe025 100644 (file)
@@ -336,15 +336,18 @@ void LoadVN::getEqualNumberNodes(Value *V,
   // we see any candidate loads, then we know they have the same value # as LI.
   //
   bool LoadInvalidatedInBBAfter = false;
-  for (BasicBlock::iterator I = LI->getNext(); I != LoadBB->end(); ++I) {
-    // If this instruction is a load, then this instruction returns the same
-    // value as LI.
-    if (isa<LoadInst>(I) && cast<LoadInst>(I)->getOperand(0) == LoadPtr)
-      RetVals.push_back(I);
+  {
+    BasicBlock::iterator I = LI;
+    for (++I; I != LoadBB->end(); ++I) {
+      // If this instruction is a load, then this instruction returns the same
+      // value as LI.
+      if (isa<LoadInst>(I) && cast<LoadInst>(I)->getOperand(0) == LoadPtr)
+        RetVals.push_back(I);
 
-    if (AA.getModRefInfo(I, LoadPtr, LoadSize) & AliasAnalysis::Mod) {
-      LoadInvalidatedInBBAfter = true;
-      break;
+      if (AA.getModRefInfo(I, LoadPtr, LoadSize) & AliasAnalysis::Mod) {
+        LoadInvalidatedInBBAfter = true;
+        break;
+      }
     }
   }