From 62b3ad70e25ef78a58ab2adc0c155d550a704b80 Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Tue, 4 Apr 2017 14:27:06 +0000 Subject: [PATCH] [globalisel][tablegen] Fix non-determinism introduced in r299430. This should fix the last issue on llvm-clang-x86_64-expensive-checks-win. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299436 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/GlobalISelEmitter.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/utils/TableGen/GlobalISelEmitter.cpp b/utils/TableGen/GlobalISelEmitter.cpp index f581c889234..a2d1b1cbc91 100644 --- a/utils/TableGen/GlobalISelEmitter.cpp +++ b/utils/TableGen/GlobalISelEmitter.cpp @@ -1011,9 +1011,14 @@ StringRef RuleMatcher::getInsnVarName(const InstructionMatcher &InsnMatcher) con /// Emit a C++ initializer_list containing references to every matched instruction. void RuleMatcher::emitCxxCapturedInsnList(raw_ostream &OS) { - OS << "{"; + SmallVector Names; for (const auto &Pair : InsnVariableNames) - OS << "&" << Pair.second << ", "; + Names.push_back(Pair.second); + std::sort(Names.begin(), Names.end()); + + OS << "{"; + for (const auto &Name : Names) + OS << "&" << Name << ", "; OS << "}"; } -- 2.40.0