diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-07-28 22:41:50 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-07-28 22:41:50 +0000 |
commit | f849ace2abc4408d3326cf3595e2b9619e4e4e22 (patch) | |
tree | f38ee573ff67e515ec2fd759d7434f8d98763e6e /llvm/lib/Bitcode/Writer | |
parent | 7385120d65ba893014e980dbc06d72397d7843ce (diff) | |
download | bcm5719-llvm-f849ace2abc4408d3326cf3595e2b9619e4e4e22.tar.gz bcm5719-llvm-f849ace2abc4408d3326cf3595e2b9619e4e4e22.zip |
IR: Optimize size of use-list order shuffle vectors
Since we're storing lots of these, save two-pointers per vector with a
custom type rather than using the relatively heavy `SmallVector`.
Part of PR5680.
llvm-svn: 214135
Diffstat (limited to 'llvm/lib/Bitcode/Writer')
-rw-r--r-- | llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp index 0421332e530..273ea06c641 100644 --- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -133,12 +133,11 @@ static void predictValueUseListOrderImpl(const Value *V, const Function *F, return; // Store the shuffle. - UseListOrder O; - O.V = V; - O.F = F; - for (auto &I : List) - O.Shuffle.push_back(I.second); - Stack.push_back(O); + UseListOrder O(V, F, List.size()); + assert(List.size() == O.Shuffle.size() && "Wrong size"); + for (size_t I = 0, E = List.size(); I != E; ++I) + O.Shuffle[I] = List[I].second; + Stack.emplace_back(std::move(O)); } static void predictValueUseListOrder(const Value *V, const Function *F, |