[ADCE] Use MapVector for BlockInfo to make iteration order deterministic
authorMikael Holmen <mikael.holmen@ericsson.com>
Fri, 3 Nov 2017 14:15:08 +0000 (14:15 +0000)
committerMikael Holmen <mikael.holmen@ericsson.com>
Fri, 3 Nov 2017 14:15:08 +0000 (14:15 +0000)
commit9e5188ca177ad10813f233bd693a57d73a90b86b
treead3bb93791c52502d12dad544ad3f96a007ca762
parent3d456013b6bbf241696e8bf1570502412e62a63c
[ADCE] Use MapVector for BlockInfo to make iteration order deterministic

Summary:
Also added a reserve() method to MapVector since we want to use that from
ADCE.

DenseMap does not provide deterministic iteration order so with that
we will handle the members of BlockInfo in random order, eventually
leading to random order of the blocks in the predecessor lists.

Without this change, I get the same predecessor order in about 90% of the
time when I compile a certain reproducer and in 10% I get a different one.

No idea how to make a proper test case for this.

Reviewers: kuhar, david2050

Reviewed By: kuhar

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D39593

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317323 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/MapVector.h
lib/Transforms/Scalar/ADCE.cpp