[llvm-branch-commits] [llvm] 0f915e7 - [RegAllocFast] Fix nondeterminism in debuginfo generation

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 7 11:26:59 PST 2022


Author: Ilya Yanok
Date: 2022-01-07T11:26:25-08:00
New Revision: 0f915e755eae63df568e62b877dee558b97bbdc2

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

LOG: [RegAllocFast] Fix nondeterminism in debuginfo generation

Changes from commit 1db137b1859692ae33228c530d4df9f2431b2151
added iteration over hash map that can result in non-deterministic
order. Fix that by using a SmallMapVector to preserve the order.

Differential Revision: https://reviews.llvm.org/D113468

(cherry picked from commit 3c47c5ca13b8a502de3272e8105548715947b7a8)

Added: 
    

Modified: 
    llvm/lib/CodeGen/RegAllocFast.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp
index 707161d5a8b07..68920e2e50df4 100644
--- a/llvm/lib/CodeGen/RegAllocFast.cpp
+++ b/llvm/lib/CodeGen/RegAllocFast.cpp
@@ -15,6 +15,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/IndexedMap.h"
+#include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/SparseSet.h"
@@ -432,7 +433,7 @@ void RegAllocFast::spill(MachineBasicBlock::iterator Before, Register VirtReg,
   // every definition of it, meaning we can switch all the DBG_VALUEs over
   // to just reference the stack slot.
   SmallVectorImpl<MachineOperand *> &LRIDbgOperands = LiveDbgValueMap[VirtReg];
-  SmallDenseMap<MachineInstr *, SmallVector<const MachineOperand *>>
+  SmallMapVector<MachineInstr *, SmallVector<const MachineOperand *>, 2>
       SpilledOperandsMap;
   for (MachineOperand *MO : LRIDbgOperands)
     SpilledOperandsMap[MO->getParent()].push_back(MO);


        


More information about the llvm-branch-commits mailing list