Convert PHI getIncomingValue() to foreach over incoming_values(). NFC.

We already had a method to iterate over all the incoming values of a PHI.  This just changes all eligible code to use it.

Ineligible code included anything which cared about the index, or was also trying to get the i'th incoming BB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237169 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Pete Cooper
2015-05-12 20:05:31 +00:00
parent 762a691bd6
commit f23c6af13d
17 changed files with 40 additions and 49 deletions

View File

@@ -105,8 +105,8 @@ static inline bool AreAnyUnderlyingObjectsAnAlloca(const Value *V,
}
if (const PHINode *PN = dyn_cast<const PHINode>(P)) {
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
Worklist.push_back(PN->getIncomingValue(i));
for (Value *IncValue : PN->incoming_values())
Worklist.push_back(IncValue);
continue;
}
} while (!Worklist.empty());

View File

@@ -62,8 +62,7 @@ bool ProvenanceAnalysis::relatedPHI(const PHINode *A,
// Check each unique source of the PHI node against B.
SmallPtrSet<const Value *, 4> UniqueSrc;
for (unsigned i = 0, e = A->getNumIncomingValues(); i != e; ++i) {
const Value *PV1 = A->getIncomingValue(i);
for (Value *PV1 : A->incoming_values()) {
if (UniqueSrc.insert(PV1).second && related(PV1, B, DL))
return true;
}