Summary:
r296498 introduced a DenseSet to store function importing info.
Using this container causes a test failure in
test/Transform/SampleProfile/import.ll when in Reverse Iteration mode.
This patch orders IDs before iterating through this container.
Reviewers: danielcdh, mgrang
Reviewed By: danielcdh
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D37246
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312012
91177308-0d34-0410-b5e6-
96231b3b80d8
SmallVector<Metadata *, 8> Ops;
Ops.push_back(createString("function_entry_count"));
Ops.push_back(createConstant(ConstantInt::get(Int64Ty, Count)));
- if (Imports)
- for (auto ID : *Imports)
+ if (Imports) {
+ SmallVector<GlobalValue::GUID, 2> OrderID(Imports->begin(), Imports->end());
+ std::stable_sort(OrderID.begin(), OrderID.end(),
+ [] (GlobalValue::GUID A, GlobalValue::GUID B) {
+ return A < B;});
+ for (auto ID : OrderID)
Ops.push_back(createConstant(ConstantInt::get(Int64Ty, ID)));
+ }
return MDNode::get(Context, Ops);
}