1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Move some key maps from std::map to DenseMap. This improves the time to optimize Anton's testcase from 17.5s

to 15.7s.

llvm-svn: 38480
This commit is contained in:
Owen Anderson 2007-07-10 00:27:22 +00:00
parent 65f9dd6973
commit 4ce919d799

View File

@ -556,6 +556,10 @@ class ValueNumberedSet {
BitVector numbers;
public:
ValueNumberedSet() { numbers.resize(1); }
ValueNumberedSet(const ValueNumberedSet& other) {
numbers = other.numbers;
contents = other.contents;
}
typedef SmallPtrSet<Value*, 8>::iterator iterator;
@ -614,9 +618,9 @@ namespace {
ValueTable VN;
std::vector<Instruction*> createdExpressions;
std::map<BasicBlock*, ValueNumberedSet> availableOut;
std::map<BasicBlock*, ValueNumberedSet> anticipatedIn;
std::map<BasicBlock*, ValueNumberedSet> generatedPhis;
DenseMap<BasicBlock*, ValueNumberedSet> availableOut;
DenseMap<BasicBlock*, ValueNumberedSet> anticipatedIn;
DenseMap<BasicBlock*, ValueNumberedSet> generatedPhis;
// This transformation requires dominator postdominator info
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@ -1175,7 +1179,7 @@ bool GVNPRE::elimination() {
isa<ExtractElementInst>(BI) || isa<SelectInst>(BI) ||
isa<CastInst>(BI) || isa<GetElementPtrInst>(BI)) {
if (availableOut[BB].test(VN.lookup(BI)) && ! availableOut[BB].count(BI)) {
if (availableOut[BB].test(VN.lookup(BI)) && !availableOut[BB].count(BI)) {
Value *leader = find_leader(availableOut[BB], VN.lookup(BI));
if (Instruction* Instr = dyn_cast<Instruction>(leader))
if (Instr->getParent() != 0 && Instr != BI) {