[PATCH] D97477: sort ClassInfo lists by name

Khem Raj via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 08:32:32 PST 2021


raj.khem created this revision.
raj.khem requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

sort ClassInfo lists by name as well otherwise, there are instances that are identical in
every other field but not ClassInfo and therefore sort in non-deterministicly.
(which breaks binary and source reproducibility).

This helps in making llvm reproducible


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97477

Files:
  llvm/utils/TableGen/AsmMatcherEmitter.cpp


Index: llvm/utils/TableGen/AsmMatcherEmitter.cpp
===================================================================
--- llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -359,7 +359,10 @@
     // name of a class shouldn't be significant. However, some of the backends
     // accidentally rely on this behaviour, so it will have to stay like this
     // until they are fixed.
-    return ValueName < RHS.ValueName;
+    if (ValueName != RHS.ValueName)
+        return ValueName < RHS.ValueName;
+    // All else being equal, we should sort by name, for source and binary reproducibility
+    return Name < RHS.Name;
   }
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97477.326404.patch
Type: text/x-patch
Size: 670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210225/b7b42591/attachment.bin>


More information about the llvm-commits mailing list