[llvm-commits] CVS: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Dec 15 11:35:02 PST 2003
Changes in directory llvm/lib/Transforms/Scalar:
IndVarSimplify.cpp updated: 1.44 -> 1.45
---
Log message:
Fix for PR185 & IndVarsSimplify/2003-12-15-Crash.llx
---
Diffs of the changes: (+9 -0)
Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.44 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.45
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.44 Wed Dec 10 14:43:04 2003
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Dec 15 11:34:02 2003
@@ -26,6 +26,7 @@
#include "Support/Debug.h"
#include "Support/Statistic.h"
#include "Support/STLExtras.h"
+#include <algorithm>
using namespace llvm;
namespace {
@@ -206,6 +207,14 @@
PHIOps.insert(PHIOps.end(), MaybeDead->op_begin(),
MaybeDead->op_end());
MaybeDead->getParent()->getInstList().erase(MaybeDead);
+
+ // Erase any duplicates entries in the PHIOps list.
+ std::vector<Value*>::iterator It =
+ std::find(PHIOps.begin(), PHIOps.end(), MaybeDead);
+ while (It != PHIOps.end()) {
+ PHIOps.erase(It);
+ It = std::find(PHIOps.begin(), PHIOps.end(), MaybeDead);
+ }
// Erasing the instruction could invalidate the AfterPHI iterator!
AfterPHIIt = Header->begin();
More information about the llvm-commits
mailing list