From: Owen Anderson Date: Tue, 29 May 2007 23:26:30 +0000 (+0000) Subject: Re-fix a bug, where I was now being too aggressive. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e3072b292ff0333a7c0a03372a1ac745e1317948;p=oota-llvm.git Re-fix a bug, where I was now being too aggressive. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37348 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index 7f76fa10735..d32939fe953 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/lib/Transforms/Scalar/GVNPRE.cpp @@ -376,6 +376,8 @@ bool GVNPRE::runOnFunction(Function &F) { // Second Phase of BuildSets - calculate ANTIC_IN + std::set visited; + bool changed = true; unsigned iterations = 0; while (changed) { @@ -388,6 +390,8 @@ bool GVNPRE::runOnFunction(Function &F) { PDI != E; ++PDI) { BasicBlock* BB = PDI->getBlock(); + visited.insert(BB); + std::set& anticIn = anticipatedIn[BB]; std::set old (anticIn.begin(), anticIn.end()); @@ -397,7 +401,7 @@ bool GVNPRE::runOnFunction(Function &F) { for (unsigned i = 0; i < BB->getTerminator()->getNumSuccessors(); ++i) { BasicBlock* currSucc = BB->getTerminator()->getSuccessor(i); std::set temp; - if (i == 0) + if (visted.find(currSucc) == visited.end()) temp.insert(maximalSet.begin(), maximalSet.end()); else temp.insert(anticIn.begin(), anticIn.end());