This almost certainly doesn't matter in some deep sense, but std::set is
essentially always going to be slower here. Now the alias query should
be essentially constant time instead of having to chase the set tree
each time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242893
91177308-0d34-0410-b5e6-
96231b3b80d8
#include "llvm/Analysis/Passes.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/ADT/SCCIterator.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include <list>
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include <list>
using namespace llvm;
#define DEBUG_TYPE "globalsmodref-aa"
using namespace llvm;
#define DEBUG_TYPE "globalsmodref-aa"
/// GlobalsModRef - The actual analysis pass.
class GlobalsModRef : public ModulePass, public AliasAnalysis {
/// The globals that do not have their addresses taken.
/// GlobalsModRef - The actual analysis pass.
class GlobalsModRef : public ModulePass, public AliasAnalysis {
/// The globals that do not have their addresses taken.
- std::set<const GlobalValue *> NonAddressTakenGlobals;
+ SmallPtrSet<const GlobalValue *, 8> NonAddressTakenGlobals;
/// IndirectGlobals - The memory pointed to by this global is known to be
/// 'owned' by the global.
/// IndirectGlobals - The memory pointed to by this global is known to be
/// 'owned' by the global.
- std::set<const GlobalValue *> IndirectGlobals;
+ SmallPtrSet<const GlobalValue *, 8> IndirectGlobals;
/// AllocsForIndirectGlobals - If an instruction allocates memory for an
/// indirect global, this map indicates which one.
/// AllocsForIndirectGlobals - If an instruction allocates memory for an
/// indirect global, this map indicates which one.