Sort handler names to ensure deterministic behavior.

llvm-svn: 84878
This commit is contained in:
Devang Patel 2009-10-22 17:40:37 +00:00
parent a96b72a4ca
commit 09c319e269
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