ElectricFence found this bug where we were reading past the vector boundary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7585 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/TargetSchedInfo.cpp b/lib/Target/TargetSchedInfo.cpp
index d646523..a52f788 100644
--- a/lib/Target/TargetSchedInfo.cpp
+++ b/lib/Target/TargetSchedInfo.cpp
@@ -243,7 +243,7 @@
 	// for that resource in each cycle.
 	std::vector<resourceId_t>& rvec = this->resourcesByCycle[c];
 	int r;
-	for (r = (int) rvec.size(); r >= 0; r--)
+	for (r = rvec.size() - 1; r >= 0; r--)
 	  if (rvec[r] == delta.resourceId)
 	    {// found last entry for the resource
 	      rvec.erase(rvec.begin() + r);