Sort handler names to ensure deterministic behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84878 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2009-10-22 17:40:37 +00:00
parent 4a53e1ef9d
commit d41fc65c56
2 changed files with 6 additions and 5 deletions

View File

@ -285,9 +285,9 @@ public:
/// the same metadata to In2.
void copyMD(Instruction *In1, Instruction *In2);
/// getHandlerNames - Get handler names. This is used by bitcode
/// writer.
void getHandlerNames(SmallVectorImpl<std::pair<unsigned, StringRef> >&N) const;
/// getHandlerNames - Populate client supplied smallvector using custome
/// metadata name and ID.
void getHandlerNames(SmallVectorImpl<std::pair<unsigned, StringRef> >&) const;
/// ValueIsDeleted - This handler is used to update metadata store
/// when a value is deleted.

View File

@ -304,13 +304,14 @@ MetadataContext::getMDs(const Instruction *Inst) {
return &I->second;
}
/// getHandlerNames - Get handler names. This is used by bitcode
/// writer and aswm writer.
/// getHandlerNames - Populate client supplied smallvector using custome
/// metadata name and ID.
void MetadataContext::
getHandlerNames(SmallVectorImpl<std::pair<unsigned, StringRef> >&Names) const {
for (StringMap<unsigned>::const_iterator I = MDHandlerNames.begin(),
E = MDHandlerNames.end(); I != E; ++I)
Names.push_back(std::make_pair(I->second, I->first()));
std::sort(Names.begin(), Names.end());
}
/// ValueIsCloned - This handler is used to update metadata store