From 254d6da02067cab500231b0ddb4db67819645cb0 Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Thu, 17 Feb 2022 12:48:32 -0600 Subject: [PATCH] [Attributor][FIX] Ensure stable iteration order With https://github.com/llvm/llvm-project/commit/668c5c688be7ab0af37739bbbe2d653be82d5c6f we introduced an ordering issue revealed by the reverse iteration buildbot. Depending on the order of the map that tracks the AAIsDead AAs we ended up with slightly different attributes. This is not totally unexpected and can happen. We should however be deterministic in our orderings to avoid such issues. --- llvm/lib/Transforms/IPO/AttributorAttributes.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index 0ad64db..c94f386 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -14,6 +14,7 @@ #include "llvm/Transforms/IPO/Attributor.h" #include "llvm/ADT/APInt.h" +#include "llvm/ADT/MapVector.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetOperations.h" @@ -270,7 +271,7 @@ static bool genericValueTraversal( const AAIsDead *LivenessAA = nullptr; bool AnyDead = false; }; - DenseMap LivenessAAs; + SmallMapVector LivenessAAs; auto GetLivenessInfo = [&](const Function &F) -> LivenessInfo & { LivenessInfo &LI = LivenessAAs[&F]; if (!LI.LivenessAA) -- 2.7.4