[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp
Owen Anderson
resistor at mac.com
Fri Jun 1 10:35:08 PDT 2007
Changes in directory llvm/lib/Transforms/Scalar:
GVNPRE.cpp updated: 1.8 -> 1.9
---
Log message:
Fix Expression comparison, which in turn fixes a value numbering error.
---
Diffs of the changes: (+11 -12)
GVNPRE.cpp | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp
diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.8 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.9
--- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.8 Thu May 31 17:44:11 2007
+++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Fri Jun 1 12:34:47 2007
@@ -60,19 +60,14 @@
return false;
if (opcode == 0) {
- if (value < other.value)
- return true;
- else
- return false;
+ return value < other.value;
} else {
if (lhs < other.lhs)
return true;
else if (other.lhs < lhs)
- return true;
- else if (rhs < other.rhs)
- return true;
- else
return false;
+ else
+ return rhs < other.rhs;
}
}
@@ -214,7 +209,8 @@
GVNPRE::Expression GVNPRE::add(ValueTable& VN, std::set<Expression>& MS,
Instruction* V) {
Expression e = buildExpression(VN, V);
- if (VN.insert(std::make_pair(e, nextValueNumber)).second)
+ std::pair<ValueTable::iterator, bool> ret = VN.insert(std::make_pair(e, nextValueNumber));
+ if (ret.second)
nextValueNumber++;
if (e.opcode != 0 || (e.opcode == 0 && isa<PHINode>(e.value)))
MS.insert(e);
@@ -391,9 +387,12 @@
DOUT << VN[*I] << ": ";
DOUT << "( ";
DOUT << (char)(I->opcode+48);
- DOUT << ", "
- << (I->value == 0 ? "0" : I->value->getName().c_str())
- << ", value." << I->lhs << ", value." << I->rhs << " ) ";
+ DOUT << ", ";
+ if (I->value == 0)
+ DOUT << "0";
+ else
+ DEBUG(I->value->dump());
+ DOUT << ", value." << I->lhs << ", value." << I->rhs << " ) ";
}
DOUT << "}\n\n";
}
More information about the llvm-commits
mailing list