RegAllocGreedy: Fix nondeterminism in tryLastChanceRecoloring
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 27 Jul 2022 13:26:41 +0000 (09:26 -0400)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 27 Jul 2022 23:02:06 +0000 (19:02 -0400)
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.

llvm/lib/CodeGen/RegAllocGreedy.h

index 483f59e..4c2c659 100644 (file)
@@ -150,7 +150,7 @@ public:
 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.