Loading llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include "Support/Debug.h" #include "Support/Statistic.h" #include "Support/STLExtras.h" #include <algorithm> using namespace llvm; namespace { Loading Loading @@ -207,6 +208,14 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { 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(); } Loading Loading
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include "Support/Debug.h" #include "Support/Statistic.h" #include "Support/STLExtras.h" #include <algorithm> using namespace llvm; namespace { Loading Loading @@ -207,6 +208,14 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { 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(); } Loading