0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. From 86940d87026432683fb6741cd8a34d3b9b18e40d Mon Sep 17 00:00:00 2001
  2. From: Alexander Kanavin <alex.kanavin@gmail.com>
  3. Date: Fri, 27 Nov 2020 10:11:08 +0000
  4. Subject: [PATCH] AsmMatcherEmitter: sort ClassInfo lists by name as well
  5. Otherwise, there are instances which are identical in
  6. every other field and therefore sort non-reproducibly
  7. (which breaks binary and source reproducibiliy).
  8. Upstream-Status: Submitted [https://reviews.llvm.org/D97477]
  9. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
  10. ---
  11. llvm/utils/TableGen/AsmMatcherEmitter.cpp | 5 ++++-
  12. 1 file changed, 4 insertions(+), 1 deletion(-)
  13. diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
  14. index ccf0959389b..1f801e83b7d 100644
  15. --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
  16. +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
  17. @@ -359,7 +359,10 @@ public:
  18. // name of a class shouldn't be significant. However, some of the backends
  19. // accidentally rely on this behaviour, so it will have to stay like this
  20. // until they are fixed.
  21. - return ValueName < RHS.ValueName;
  22. + if (ValueName != RHS.ValueName)
  23. + return ValueName < RHS.ValueName;
  24. + // All else being equal, we should sort by name, for source and binary reproducibility
  25. + return Name < RHS.Name;
  26. }
  27. };