[llvm] ff04d0d - [TableGen] Fix the non-determinism in DFAPacketizerEmitter.cpp (#192037)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 07:54:07 PDT 2026


Author: David Stuttard
Date: 2026-04-14T15:54:02+01:00
New Revision: ff04d0d6cd5dbb21122cefc13a68afd51b65067a

URL: https://github.com/llvm/llvm-project/commit/ff04d0d6cd5dbb21122cefc13a68afd51b65067a
DIFF: https://github.com/llvm/llvm-project/commit/ff04d0d6cd5dbb21122cefc13a68afd51b65067a.diff

LOG: [TableGen] Fix the non-determinism in DFAPacketizerEmitter.cpp (#192037)

Sort the std::set ProcItinList by Record name, not the pointer address.

---------

Co-authored-by: Bao, Qiaojin (Fred) <Qiaojin.Bao at amd.com>

Added: 
    

Modified: 
    llvm/utils/TableGen/DFAPacketizerEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/DFAPacketizerEmitter.cpp b/llvm/utils/TableGen/DFAPacketizerEmitter.cpp
index 1bf4c7a8fd80a..dfc92711d9e85 100644
--- a/llvm/utils/TableGen/DFAPacketizerEmitter.cpp
+++ b/llvm/utils/TableGen/DFAPacketizerEmitter.cpp
@@ -101,7 +101,9 @@ int DFAPacketizerEmitter::collectAllFuncUnits(
   LLVM_DEBUG(dbgs() << "collectAllFuncUnits");
   LLVM_DEBUG(dbgs() << " (" << ProcModels.size() << " itineraries)\n");
 
-  std::set<const Record *> ProcItinList;
+  // Use the LessRecord comparator to make the traversal deterministic with the
+  // same input
+  std::set<const Record *, LessRecord> ProcItinList;
   for (const CodeGenProcModel *Model : ProcModels)
     ProcItinList.insert(Model->ItinsDef);
 


        


More information about the llvm-commits mailing list