summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/ConstantsContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/ConstantsContext.h')
-rw-r--r--llvm/lib/IR/ConstantsContext.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index e87e23128fc..2f8c9c447d4 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -15,7 +15,7 @@
#ifndef LLVM_LIB_IR_CONSTANTSCONTEXT_H
#define LLVM_LIB_IR_CONSTANTSCONTEXT_H
-#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
@@ -584,26 +584,25 @@ private:
};
public:
- typedef DenseMap<ConstantClass *, char, MapInfo> MapTy;
+ typedef DenseSet<ConstantClass *, MapInfo> MapTy;
private:
MapTy Map;
public:
- typename MapTy::iterator map_begin() { return Map.begin(); }
- typename MapTy::iterator map_end() { return Map.end(); }
+ typename MapTy::iterator begin() { return Map.begin(); }
+ typename MapTy::iterator end() { return Map.end(); }
void freeConstants() {
for (auto &I : Map)
- // Asserts that use_empty().
- delete I.first;
+ delete I; // Asserts that use_empty().
}
private:
ConstantClass *create(TypeClass *Ty, ValType V, LookupKeyHashed &HashKey) {
ConstantClass *Result = V.create(Ty);
assert(Result->getType() == Ty && "Type specified is not correct!");
- Map.insert_as(std::make_pair(Result, '\0'), HashKey);
+ Map.insert_as(Result, HashKey);
return Result;
}
@@ -621,7 +620,7 @@ public:
if (I == Map.end())
Result = create(Ty, V, Lookup);
else
- Result = I->first;
+ Result = *I;
assert(Result && "Unexpected nullptr");
return Result;
@@ -631,7 +630,7 @@ public:
void remove(ConstantClass *CP) {
typename MapTy::iterator I = Map.find(CP);
assert(I != Map.end() && "Constant not found in constant table!");
- assert(I->first == CP && "Didn't find correct element?");
+ assert(*I == CP && "Didn't find correct element?");
Map.erase(I);
}
@@ -645,7 +644,7 @@ public:
auto I = Map.find_as(Lookup);
if (I != Map.end())
- return I->first;
+ return *I;
// Update to the new value. Optimize for the case when we have a single
// operand that we're changing, but handle bulk updates efficiently.
@@ -659,7 +658,7 @@ public:
if (CP->getOperand(I) == From)
CP->setOperand(I, To);
}
- Map.insert_as(std::make_pair(CP, '\0'), Lookup);
+ Map.insert_as(CP, Lookup);
return nullptr;
}
OpenPOWER on IntegriCloud