[llvm] r299436 - [globalisel][tablegen] Fix non-determinism introduced in r299430.

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 07:27:06 PDT 2017


Author: dsanders
Date: Tue Apr  4 09:27:06 2017
New Revision: 299436

URL: http://llvm.org/viewvc/llvm-project?rev=299436&view=rev
Log:
[globalisel][tablegen] Fix non-determinism introduced in r299430.

This should fix the last issue on llvm-clang-x86_64-expensive-checks-win.


Modified:
    llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp

Modified: llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp?rev=299436&r1=299435&r2=299436&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp Tue Apr  4 09:27:06 2017
@@ -1011,9 +1011,14 @@ StringRef RuleMatcher::getInsnVarName(co
 
 /// Emit a C++ initializer_list containing references to every matched instruction.
 void RuleMatcher::emitCxxCapturedInsnList(raw_ostream &OS) {
-  OS << "{";
+  SmallVector<StringRef, 2> 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 << "}";
 }
 




More information about the llvm-commits mailing list