mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Use a DenseMap instead of an std::map for the value numbering. This reduces the time to optimize lencod on a PPC Debug build from ~300s to ~140s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37668 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
52471b102c
commit
4f703ec0a1
@ -25,6 +25,7 @@
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Analysis/Dominators.h"
|
||||
#include "llvm/Analysis/PostDominators.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/DepthFirstIterator.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/Support/CFG.h"
|
||||
@ -78,7 +79,7 @@ namespace {
|
||||
};
|
||||
|
||||
private:
|
||||
std::map<Value*, uint32_t> valueNumbering;
|
||||
DenseMap<Value*, uint32_t> valueNumbering;
|
||||
std::map<Expression, uint32_t> expressionNumbering;
|
||||
|
||||
std::set<Expression> maximalExpressions;
|
||||
@ -217,7 +218,7 @@ ValueTable::Expression::ExpressionOpcode ValueTable::getOpcode(CmpInst* C) {
|
||||
uint32_t ValueTable::lookup_or_add(Value* V) {
|
||||
maximalValues.insert(V);
|
||||
|
||||
std::map<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
|
||||
DenseMap<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
|
||||
if (VI != valueNumbering.end())
|
||||
return VI->second;
|
||||
|
||||
@ -255,7 +256,7 @@ uint32_t ValueTable::lookup_or_add(Value* V) {
|
||||
}
|
||||
|
||||
uint32_t ValueTable::lookup(Value* V) {
|
||||
std::map<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
|
||||
DenseMap<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
|
||||
if (VI != valueNumbering.end())
|
||||
return VI->second;
|
||||
else
|
||||
@ -265,7 +266,7 @@ uint32_t ValueTable::lookup(Value* V) {
|
||||
}
|
||||
|
||||
void ValueTable::add(Value* V, uint32_t num) {
|
||||
std::map<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
|
||||
DenseMap<Value*, uint32_t>::iterator VI = valueNumbering.find(V);
|
||||
if (VI != valueNumbering.end())
|
||||
valueNumbering.erase(VI);
|
||||
valueNumbering.insert(std::make_pair(V, num));
|
||||
|
Loading…
Reference in New Issue
Block a user