mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-21 01:06:46 +00:00
Use a cheaper test, delaying calling find_leader() until we know that it's necessary. This improves
the time to optimize Anton's testcase from 21.1s to 17.6s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38479 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2038252c6a
commit
a05a81b10a
@ -565,6 +565,7 @@ class ValueNumberedSet {
|
||||
bool insert(Value* v) { return contents.insert(v); }
|
||||
void insert(iterator I, iterator E) { contents.insert(I, E); }
|
||||
void erase(Value* v) { contents.erase(v); }
|
||||
unsigned count(Value* v) { return contents.count(v); }
|
||||
size_t size() { return contents.size(); }
|
||||
|
||||
void set(unsigned i) {
|
||||
@ -1173,15 +1174,16 @@ bool GVNPRE::elimination() {
|
||||
isa<ShuffleVectorInst>(BI) || isa<InsertElementInst>(BI) ||
|
||||
isa<ExtractElementInst>(BI) || isa<SelectInst>(BI) ||
|
||||
isa<CastInst>(BI) || isa<GetElementPtrInst>(BI)) {
|
||||
Value *leader = find_leader(availableOut[BB], VN.lookup(BI));
|
||||
|
||||
if (leader != 0)
|
||||
|
||||
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) {
|
||||
replace.push_back(std::make_pair(BI, leader));
|
||||
erase.push_back(BI);
|
||||
++NumEliminated;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user