Changes to fix up the inst_iterator to pass to boost iterator checks. This
patch was graciously contributed by Vladimir Prus.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13185 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp
index 19d44dd..ef7b501 100644
--- a/lib/Analysis/AliasAnalysisEvaluator.cpp
+++ b/lib/Analysis/AliasAnalysisEvaluator.cpp
@@ -83,15 +83,15 @@
Pointers.insert(I);
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
- if (isa<PointerType>((*I)->getType())) // Add all pointer instructions
- Pointers.insert(*I);
- for (User::op_iterator OI = (*I)->op_begin(); OI != (*I)->op_end(); ++OI)
+ if (isa<PointerType>(I->getType())) // Add all pointer instructions
+ Pointers.insert(&*I);
+ for (User::op_iterator OI = (*I).op_begin(); OI != (*I).op_end(); ++OI)
if (isa<PointerType>((*OI)->getType()))
Pointers.insert(*OI);
}
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
- CallSite CS = CallSite::get(*I);
+ CallSite CS = CallSite::get(&*I);
if (CS.getInstruction()) CallSites.insert(CS);
}
diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp
index 303d798..82b6ede 100644
--- a/lib/Analysis/AliasSetTracker.cpp
+++ b/lib/Analysis/AliasSetTracker.cpp
@@ -366,7 +366,7 @@
Tracker = new AliasSetTracker(getAnalysis<AliasAnalysis>());
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
- Tracker->add(*I);
+ Tracker->add(&*I);
return false;
}
diff --git a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
index 45f5b72..67ab52d 100644
--- a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
+++ b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
@@ -42,8 +42,8 @@
PrintFailures("printunsafeptrinst", cl::Hidden,
cl::desc("Print Unsafe Pointer Access Instructions"));
-static inline bool isSafeInstruction(const Instruction *I) {
- switch (I->getOpcode()) {
+static inline bool isSafeInstruction(const Instruction &I) {
+ switch (I.getOpcode()) {
case Instruction::Alloca:
case Instruction::Malloc:
case Instruction::Free:
@@ -72,7 +72,7 @@
if (PrintFailures) {
CachedWriter CW(F->getParent(), std::cerr);
CW << "FindUnsafePointerTypes: Type '" << ITy
- << "' marked unsafe in '" << F->getName() << "' by:\n" << **I;
+ << "' marked unsafe in '" << F->getName() << "' by:\n" << *I;
}
}
}
diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp
index e930499..870f571 100644
--- a/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -79,11 +79,11 @@
//
for (const_inst_iterator II = inst_begin(F), IE = inst_end(F);
II != IE; ++II) {
- const Instruction *I = *II;
- const Type *Ty = I->getType();
+ const Instruction &I = *II;
+ const Type *Ty = I.getType();
IncorporateType(Ty); // Incorporate the type of the instruction
- for (User::const_op_iterator OI = I->op_begin(), OE = I->op_end();
+ for (User::const_op_iterator OI = I.op_begin(), OE = I.op_end();
OI != OE; ++OI)
IncorporateValue(*OI); // Insert inst operand types as well
}
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 68cad3c..ae3aa41 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2175,22 +2175,22 @@
OS << "Classifying expressions for: " << F.getName() << "\n";
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
- if ((*I)->getType()->isInteger()) {
- OS << **I;
+ if (I->getType()->isInteger()) {
+ OS << *I;
OS << " --> ";
- SCEVHandle SV = getSCEV(*I);
+ SCEVHandle SV = getSCEV(&*I);
SV->print(OS);
OS << "\t\t";
- if ((*I)->getType()->isIntegral()) {
+ if ((*I).getType()->isIntegral()) {
ConstantRange Bounds = SV->getValueRange();
if (!Bounds.isFullSet())
OS << "Bounds: " << Bounds << " ";
}
- if (const Loop *L = LI.getLoopFor((*I)->getParent())) {
+ if (const Loop *L = LI.getLoopFor((*I).getParent())) {
OS << "Exits: ";
- SCEVHandle ExitValue = getSCEVAtScope(*I, L->getParentLoop());
+ SCEVHandle ExitValue = getSCEVAtScope(&*I, L->getParentLoop());
if (isa<SCEVCouldNotCompute>(ExitValue)) {
OS << "<<Unknown>>";
} else {