1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[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.
This commit is contained in:
Nikita Popov 2020-10-22 23:49:08 +02:00
parent 55c9f68e17
commit bac894562a
2 changed files with 3 additions and 5 deletions

View File

@ -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 @@ public:
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;

View File

@ -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"