From 3b30a9bda88374e8f03bf96e972aee5bd214b98b Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Fri, 27 Nov 2020 10:11:08 +0000 Subject: [PATCH] AsmMatcherEmitter: sort ClassInfo lists by name as well Otherwise, there are instances which are identical in every other field and therefore sort non-reproducibly (which breaks binary and source reproducibiliy). Upstream-Status: Submitted [https://reviews.llvm.org/D97477] Signed-off-by: Alexander Kanavin --- llvm/utils/TableGen/AsmMatcherEmitter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp index 73724e662f9e..1ca9c73415db 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -361,7 +361,10 @@ public: // 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; } };