[PATCH] D39593: [ADCE] Use MapVector for BlockInfo to make iteration order deterministic

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 05:50:37 PDT 2017


uabelho added inline comments.


================
Comment at: lib/Transforms/Scalar/ADCE.cpp:214
 void AggressiveDeadCodeElimination::initialize() {
-  auto NumBlocks = F.size();
-
-  // We will have an entry in the map for each block so we grow the
-  // structure to twice that size to keep the load factor low in the hash table.
-  BlockInfo.reserve(NumBlocks);
   size_t NumInsts = 0;
 
----------------
kuhar wrote:
> I can see that MapVector doesn't expose `.reserve` -- what is the reason for that? While I don't claim that it would have any noticeable performance impact here, I'm a bit surprised by that.
Unfortunately I have no idea. I just noticed there is no such function, and thus removed the call.

I don't really understand the comment preceding the original reserve call though, it says "so we grow the structure to twice that size", but then it only reserves NumBlocks anyway? Not 2*Numblocks?


https://reviews.llvm.org/D39593





More information about the llvm-commits mailing list