[llvm] dd887d9 - [PhiValues] Use SetVector to avoid non-determinism
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 11:14:17 PDT 2020
Author: Nikita Popov
Date: 2020-10-23T20:14:02+02:00
New Revision: dd887d97ce38bc60f3680d2481fc2d96ce45c4f5
URL: https://github.com/llvm/llvm-project/commit/dd887d97ce38bc60f3680d2481fc2d96ce45c4f5
DIFF: https://github.com/llvm/llvm-project/commit/dd887d97ce38bc60f3680d2481fc2d96ce45c4f5.diff
LOG: [PhiValues] Use SetVector to avoid non-determinism
I'm not sure whether this can cause actual non-determinism in the
compiler output, but at least it causes non-determinism in the
statistics collected by BasicAA.
Use SetVector to have a predictable iteration order.
Added:
Modified:
llvm/include/llvm/Analysis/PhiValues.h
llvm/lib/Analysis/PhiValues.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/PhiValues.h b/llvm/include/llvm/Analysis/PhiValues.h
index ea879d727282..c0e91c8b0bdf 100644
--- a/llvm/include/llvm/Analysis/PhiValues.h
+++ b/llvm/include/llvm/Analysis/PhiValues.h
@@ -21,7 +21,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/ValueHandle.h"
@@ -40,7 +40,7 @@ class Function;
/// it is queried.
class PhiValues {
public:
- using ValueSet = SmallPtrSet<Value *, 4>;
+ using ValueSet = SmallSetVector<Value *, 4>;
/// Construct an empty PhiValues.
PhiValues(const Function &F) : F(F) {}
@@ -70,8 +70,7 @@ class PhiValues {
FunctionAnalysisManager::Invalidator &);
private:
- using PhiSet = SmallPtrSet<const PHINode *, 4>;
- using ConstValueSet = SmallPtrSet<const Value *, 4>;
+ using ConstValueSet = SmallSetVector<const Value *, 4>;
/// The next depth number to be used by processPhi.
unsigned int NextDepthNumber = 1;
diff --git a/llvm/lib/Analysis/PhiValues.cpp b/llvm/lib/Analysis/PhiValues.cpp
index 198647dafbef..656a17e9dc30 100644
--- a/llvm/lib/Analysis/PhiValues.cpp
+++ b/llvm/lib/Analysis/PhiValues.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/PhiValues.h"
-#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/Instructions.h"
#include "llvm/InitializePasses.h"
More information about the llvm-commits
mailing list