IRGen: Sort the target-features string

Function merging will not identify two otherwise equivalent if the order of the target-features list differs.

rdar://33057710
This commit is contained in:
Arnold Schwaighofer
2017-06-30 10:25:53 -07:00
parent 1803c04bf9
commit 1e794cdebf
2 changed files with 10 additions and 0 deletions

View File

@@ -817,6 +817,8 @@ llvm::AttributeSet IRGenModule::constructInitialAttributes() {
std::vector<std::string> &Features = ClangOpts.Features;
if (!Features.empty()) {
SmallString<64> allFeatures;
// Sort so that the target features string is canonical.
std::sort(Features.begin(), Features.end());
interleave(Features, [&](const std::string &s) {
allFeatures.append(s);
}, [&]{