diff options
author | Fiona Glaser <escha@apple.com> | 2015-12-02 18:32:59 +0000 |
---|---|---|
committer | Fiona Glaser <escha@apple.com> | 2015-12-02 18:32:59 +0000 |
commit | e25b06fa233a81f216d9368ef0694c2fbbdad15f (patch) | |
tree | b7779b959ba82247045348bf580b00c2d7877dce /llvm/lib/CodeGen/MachineRegisterInfo.cpp | |
parent | aa5702d92b75427d9900703c0b4226f9bb24d1d4 (diff) | |
download | bcm5719-llvm-e25b06fa233a81f216d9368ef0694c2fbbdad15f.tar.gz bcm5719-llvm-e25b06fa233a81f216d9368ef0694c2fbbdad15f.zip |
Scheduler / Regalloc: use unique_ptr[] instead of std::vector
vector.resize() is significantly slower than memset in many STLs
and the cost of initializing these vectors is significant on targets
with many registers. Since we don't need the overhead of a vector,
use a simple unique_ptr instead.
llvm-svn: 254526
Diffstat (limited to 'llvm/lib/CodeGen/MachineRegisterInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineRegisterInfo.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp index abf9b4d6769..03c82f46da6 100644 --- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp +++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp @@ -27,12 +27,11 @@ void MachineRegisterInfo::Delegate::anchor() {} MachineRegisterInfo::MachineRegisterInfo(const MachineFunction *MF) : MF(MF), TheDelegate(nullptr), IsSSA(true), TracksLiveness(true), TracksSubRegLiveness(false) { + unsigned NumRegs = getTargetRegisterInfo()->getNumRegs(); VRegInfo.reserve(256); RegAllocHints.reserve(256); - UsedPhysRegMask.resize(getTargetRegisterInfo()->getNumRegs()); - - // Create the physreg use/def lists. - PhysRegUseDefLists.resize(getTargetRegisterInfo()->getNumRegs(), nullptr); + UsedPhysRegMask.resize(NumRegs); + PhysRegUseDefLists.reset(new MachineOperand*[NumRegs]()); } /// setRegClass - Set the register class of the specified virtual register. |