Add an assertion instead of crashing when the scavenger goes past the end
authorBob Wilson <bob.wilson@apple.com>
Tue, 5 Apr 2011 20:44:15 +0000 (20:44 +0000)
committerBob Wilson <bob.wilson@apple.com>
Tue, 5 Apr 2011 20:44:15 +0000 (20:44 +0000)
of a basic block.

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

lib/CodeGen/RegisterScavenging.cpp

index b9dd28e5c7841db95e5a1ba215ee40d1612aaea5..ebfe533838d5d2c71460bac340807b3f9a596855 100644 (file)
@@ -126,9 +126,10 @@ void RegScavenger::forward() {
     MBBI = MBB->begin();
     Tracking = true;
   } else {
-    assert(MBBI != MBB->end() && "Already at the end of the basic block!");
+    assert(MBBI != MBB->end() && "Already past the end of the basic block!");
     MBBI = llvm::next(MBBI);
   }
+  assert(MBBI != MBB->end() && "Already at the end of the basic block!");
 
   MachineInstr *MI = MBBI;