diff options
author | Nadav Rotem <nadav256@gmail.com> | 2020-07-15 17:12:48 -0700 |
---|---|---|
committer | Nadav Rotem <nadav256@gmail.com> | 2020-07-16 11:39:54 -0700 |
commit | a394aa1b974bd320242569e5bed53284010cfa63 (patch) | |
tree | 92e2a48156427c1bc2c02cea17f8ed09085200f8 /llvm/lib/CodeGen/LiveVariables.cpp | |
parent | ecb2e5bcd7e616f62a8c61722ee8d4033c78e32e (diff) | |
download | llvm-a394aa1b974bd320242569e5bed53284010cfa63.zip llvm-a394aa1b974bd320242569e5bed53284010cfa63.tar.gz llvm-a394aa1b974bd320242569e5bed53284010cfa63.tar.bz2 |
[LiveVariables] Replace std::vector with SmallVector.
Replace std::vector with SmallVector to reduce the number of mallocs.
This method is frequently executed, and the number of elements in the
vector is typically small.
https://reviews.llvm.org/D83920
Diffstat (limited to 'llvm/lib/CodeGen/LiveVariables.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveVariables.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp index 6610491..4fba8f3 100644 --- a/llvm/lib/CodeGen/LiveVariables.cpp +++ b/llvm/lib/CodeGen/LiveVariables.cpp @@ -89,10 +89,9 @@ LiveVariables::VarInfo &LiveVariables::getVarInfo(unsigned RegIdx) { return VirtRegInfo[RegIdx]; } -void LiveVariables::MarkVirtRegAliveInBlock(VarInfo& VRInfo, - MachineBasicBlock *DefBlock, - MachineBasicBlock *MBB, - std::vector<MachineBasicBlock*> &WorkList) { +void LiveVariables::MarkVirtRegAliveInBlock( + VarInfo &VRInfo, MachineBasicBlock *DefBlock, MachineBasicBlock *MBB, + SmallVectorImpl<MachineBasicBlock *> &WorkList) { unsigned BBNum = MBB->getNumber(); // Check to see if this basic block is one of the killing blocks. If so, @@ -118,7 +117,7 @@ void LiveVariables::MarkVirtRegAliveInBlock(VarInfo& VRInfo, void LiveVariables::MarkVirtRegAliveInBlock(VarInfo &VRInfo, MachineBasicBlock *DefBlock, MachineBasicBlock *MBB) { - std::vector<MachineBasicBlock*> WorkList; + SmallVector<MachineBasicBlock *, 16> WorkList; MarkVirtRegAliveInBlock(VRInfo, DefBlock, MBB, WorkList); while (!WorkList.empty()) { |