eliminate some std::set's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59409 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 56829bd..2af10a6 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -53,6 +53,7 @@
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
using namespace llvm;
@@ -87,12 +88,12 @@
private:
void EliminatePointerRecurrence(PHINode *PN, BasicBlock *Preheader,
- std::set<Instruction*> &DeadInsts);
+ SmallPtrSet<Instruction*, 16> &DeadInsts);
Instruction *LinearFunctionTestReplace(Loop *L, SCEV *IterationCount,
SCEVExpander &RW);
void RewriteLoopExitValues(Loop *L, SCEV *IterationCount);
- void DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts);
+ void DeleteTriviallyDeadInstructions(SmallPtrSet<Instruction*, 16> &Insts);
void OptimizeCanonicalIVType(Loop *L);
void HandleFloatingPointIV(Loop *L);
@@ -111,10 +112,10 @@
/// specified set are trivially dead, delete them and see if this makes any of
/// their operands subsequently dead.
void IndVarSimplify::
-DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts) {
+DeleteTriviallyDeadInstructions(SmallPtrSet<Instruction*, 16> &Insts) {
while (!Insts.empty()) {
Instruction *I = *Insts.begin();
- Insts.erase(Insts.begin());
+ Insts.erase(I);
if (isInstructionTriviallyDead(I)) {
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
if (Instruction *U = dyn_cast<Instruction>(I->getOperand(i)))
@@ -133,7 +134,7 @@
/// analysis by the SCEV routines.
void IndVarSimplify::EliminatePointerRecurrence(PHINode *PN,
BasicBlock *Preheader,
- std::set<Instruction*> &DeadInsts) {
+ SmallPtrSet<Instruction*, 16> &DeadInsts) {
assert(PN->getNumIncomingValues() == 2 && "Noncanonicalized loop!");
unsigned PreheaderIdx = PN->getBasicBlockIndex(Preheader);
unsigned BackedgeIdx = PreheaderIdx^1;
@@ -326,7 +327,7 @@
bool HasConstantItCount = isa<SCEVConstant>(IterationCount);
- std::set<Instruction*> InstructionsToDelete;
+ SmallPtrSet<Instruction*, 16> InstructionsToDelete;
std::map<Instruction*, Value*> ExitValues;
// Find all values that are computed inside the loop, but used outside of it.
@@ -427,7 +428,7 @@
BasicBlock *Preheader = L->getLoopPreheader();
SE = &LPM.getAnalysis<ScalarEvolution>();
- std::set<Instruction*> DeadInsts;
+ SmallPtrSet<Instruction*, 16> DeadInsts;
for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) {
PHINode *PN = cast<PHINode>(I);
if (isa<PointerType>(PN->getType()))
@@ -448,7 +449,7 @@
Changed = false;
BasicBlock *Header = L->getHeader();
- std::set<Instruction*> DeadInsts;
+ SmallPtrSet<Instruction*, 16> DeadInsts;
// Verify the input to the pass in already in LCSSA form.
assert(L->isLCSSAForm());
@@ -495,7 +496,7 @@
IterationCount->getType());
if (Instruction *I = LinearFunctionTestReplace(L, IterationCount,
Rewriter)) {
- std::set<Instruction*> InstructionsToDelete;
+ SmallPtrSet<Instruction*, 16> InstructionsToDelete;
InstructionsToDelete.insert(I);
DeleteTriviallyDeadInstructions(InstructionsToDelete);
}