[llvm] 254d6da - [Attributor][FIX] Ensure stable iteration order
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 17 10:53:24 PST 2022
Author: Johannes Doerfert
Date: 2022-02-17T12:53:10-06:00
New Revision: 254d6da02067cab500231b0ddb4db67819645cb0
URL: https://github.com/llvm/llvm-project/commit/254d6da02067cab500231b0ddb4db67819645cb0
DIFF: https://github.com/llvm/llvm-project/commit/254d6da02067cab500231b0ddb4db67819645cb0.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 0ad64dbb45953..c94f38687b219 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<const Function *, LivenessInfo> LivenessAAs;
+ SmallMapVector<const Function *, LivenessInfo, 4> LivenessAAs;
auto GetLivenessInfo = [&](const Function &F) -> LivenessInfo & {
LivenessInfo &LI = LivenessAAs[&F];
if (!LI.LivenessAA)
More information about the llvm-commits
mailing list