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
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index 0421332..273ea06 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -133,12 +133,11 @@
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,