mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +00:00
Fix Expression comparison, which in turn fixes a value numbering error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37386 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
144fd1ff0f
commit
8e21fb7df8
@ -60,19 +60,14 @@ namespace {
|
||||
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::buildExpression(ValueTable& VN, Value* V) {
|
||||
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 @@ void GVNPRE::dump(GVNPRE::ValueTable& VN, std::set<GVNPRE::Expression>& s) {
|
||||
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";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user