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