mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-30 05:29:47 +00:00
Add verification functions to GVN which check to see that an instruction was
truely deleted. These will be expanded with further checks of all of the data structures. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61347 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
00d448a341
commit
246dbbb8be
@ -173,6 +173,7 @@ namespace {
|
|||||||
void setMemDep(MemoryDependenceAnalysis* M) { MD = M; }
|
void setMemDep(MemoryDependenceAnalysis* M) { MD = M; }
|
||||||
void setDomTree(DominatorTree* D) { DT = D; }
|
void setDomTree(DominatorTree* D) { DT = D; }
|
||||||
uint32_t getNextUnusedValueNumber() { return nextValueNumber; }
|
uint32_t getNextUnusedValueNumber() { return nextValueNumber; }
|
||||||
|
void verifyRemoved(const Value *) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,6 +679,15 @@ void ValueTable::erase(Value* V) {
|
|||||||
valueNumbering.erase(V);
|
valueNumbering.erase(V);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// verifyRemoved - Verify that the value is removed from all internal data
|
||||||
|
/// structures.
|
||||||
|
void ValueTable::verifyRemoved(const Value *V) const {
|
||||||
|
for (DenseMap<Value*, uint32_t>::iterator
|
||||||
|
I = valueNumbering.begin(), E = valueNumbering.end(); I != E; ++I) {
|
||||||
|
assert(I->first != V && "Inst still occurs in value numbering map!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// GVN Pass
|
// GVN Pass
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -741,6 +751,7 @@ namespace {
|
|||||||
bool mergeBlockIntoPredecessor(BasicBlock* BB);
|
bool mergeBlockIntoPredecessor(BasicBlock* BB);
|
||||||
Value* AttemptRedundancyElimination(Instruction* orig, unsigned valno);
|
Value* AttemptRedundancyElimination(Instruction* orig, unsigned valno);
|
||||||
void cleanupGlobalSets();
|
void cleanupGlobalSets();
|
||||||
|
void verifyRemoved(const Instruction *I) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
char GVN::ID = 0;
|
char GVN::ID = 0;
|
||||||
@ -859,6 +870,7 @@ Value *GVN::GetValueForBlock(BasicBlock *BB, Instruction* orig,
|
|||||||
DEBUG(cerr << "GVN removed: " << *PN);
|
DEBUG(cerr << "GVN removed: " << *PN);
|
||||||
MD->removeInstruction(PN);
|
MD->removeInstruction(PN);
|
||||||
PN->eraseFromParent();
|
PN->eraseFromParent();
|
||||||
|
DEBUG(verifyRemoved(PN));
|
||||||
|
|
||||||
Phis[BB] = v;
|
Phis[BB] = v;
|
||||||
return v;
|
return v;
|
||||||
@ -1640,3 +1652,9 @@ void GVN::cleanupGlobalSets() {
|
|||||||
delete I->second;
|
delete I->second;
|
||||||
localAvail.clear();
|
localAvail.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// verifyRemoved - Verify that the specified instruction does not occur in our
|
||||||
|
/// internal data structures.
|
||||||
|
void GVN::verifyRemoved(const Instruction *I) const {
|
||||||
|
VN.verifyRemoved(I);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user