Use a SmallSet when we can to reduce memory allocations.

This speeds up a particular testcase from 0.0302s to 0.0222s in LiveVariables.

llvm-svn: 52819
This commit is contained in:
Owen Anderson 2008-06-27 07:05:59 +00:00
parent 59ed35b2c2
commit e0604d46c2

View File

@ -34,6 +34,7 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Config/alloca.h"
#include <algorithm>
@ -387,7 +388,7 @@ bool LiveVariables::HandlePhysRegKill(unsigned Reg) {
void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr *MI) {
// What parts of the register are previously defined?
std::set<unsigned> Live;
SmallSet<unsigned, 32> Live;
if (PhysRegDef[Reg] || PhysRegUse[Reg]) {
Live.insert(Reg);
for (const unsigned *SS = TRI->getSubRegisters(Reg); *SS; ++SS)