[PATCH] D159174: [clang] Use stable_sort in AppendTargetMangling

Piyou Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 30 00:38:20 PDT 2023


BeMg created this revision.
Herald added a subscriber: mgrang.
Herald added a project: All.
BeMg requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

For the target features in the same priority, make sure it is not a random mangling name.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159174

Files:
  clang/lib/CodeGen/CodeGenModule.cpp


Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -1627,7 +1627,7 @@
   Out << '.';
   const TargetInfo &Target = CGM.getTarget();
   ParsedTargetAttr Info = Target.parseTargetAttr(Attr->getFeaturesStr());
-  llvm::sort(Info.Features, [&Target](StringRef LHS, StringRef RHS) {
+  llvm::stable_sort(Info.Features, [&Target](StringRef LHS, StringRef RHS) {
     // Multiversioning doesn't allow "no-${feature}", so we can
     // only have "+" prefixes here.
     assert(LHS.startswith("+") && RHS.startswith("+") &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159174.554608.patch
Type: text/x-patch
Size: 659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230830/c10ee4fe/attachment.bin>


More information about the cfe-commits mailing list