[llvm] bfdca15 - RegAllocGreedy: Fix nondeterminism in tryLastChanceRecoloring

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 16:02:11 PDT 2022


Author: Matt Arsenault
Date: 2022-07-27T19:02:06-04:00
New Revision: bfdca1535c0d6b8ace3de69ec2e448d93a88b97f

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

LOG: RegAllocGreedy: Fix nondeterminism in tryLastChanceRecoloring

tryLastChanceRecoloring iterates over the set of LiveInterval pointers
and used that to seed the recoloring stack, which was
nondeterministic. Fixes a future test failing about 20% of the time.

This just takes the order the interfering vreg was encountered. Not
sure if we should try to order this more intelligently.

Added: 
    

Modified: 
    llvm/lib/CodeGen/RegAllocGreedy.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/RegAllocGreedy.h b/llvm/lib/CodeGen/RegAllocGreedy.h
index 483f59ed8e8e..4c2c659fe16c 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.h
+++ b/llvm/lib/CodeGen/RegAllocGreedy.h
@@ -150,7 +150,7 @@ class LLVM_LIBRARY_VISIBILITY RAGreedy : public MachineFunctionPass,
 private:
   // Convenient shortcuts.
   using PQueue = std::priority_queue<std::pair<unsigned, unsigned>>;
-  using SmallLISet = SmallPtrSet<const LiveInterval *, 4>;
+  using SmallLISet = SmallSetVector<const LiveInterval *, 4>;
 
   // We need to track all tentative recolorings so we can roll back any
   // successful and unsuccessful recoloring attempts.


        


More information about the llvm-commits mailing list