[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp
Owen Anderson
resistor at mac.com
Tue May 29 16:26:59 PDT 2007
Changes in directory llvm/lib/Transforms/Scalar:
GVNPRE.cpp updated: 1.4 -> 1.5
---
Log message:
Re-fix a bug, where I was now being too aggressive.
---
Diffs of the changes: (+5 -1)
GVNPRE.cpp | 6 +++++-
1 files changed, 5 insertions(+), 1 deletion(-)
Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp
diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.4 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.5
--- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.4 Tue May 29 18:15:21 2007
+++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Tue May 29 18:26:30 2007
@@ -376,6 +376,8 @@
// Second Phase of BuildSets - calculate ANTIC_IN
+ std::set<BasicBlock*> visited;
+
bool changed = true;
unsigned iterations = 0;
while (changed) {
@@ -388,6 +390,8 @@
PDI != E; ++PDI) {
BasicBlock* BB = PDI->getBlock();
+ visited.insert(BB);
+
std::set<Expression>& anticIn = anticipatedIn[BB];
std::set<Expression> old (anticIn.begin(), anticIn.end());
@@ -397,7 +401,7 @@
for (unsigned i = 0; i < BB->getTerminator()->getNumSuccessors(); ++i) {
BasicBlock* currSucc = BB->getTerminator()->getSuccessor(i);
std::set<Expression> temp;
- if (i == 0)
+ if (visted.find(currSucc) == visited.end())
temp.insert(maximalSet.begin(), maximalSet.end());
else
temp.insert(anticIn.begin(), anticIn.end());
More information about the llvm-commits
mailing list