diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-05-12 20:05:31 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-05-12 20:05:31 +0000 |
commit | 833f34d837eca1e11370fbdea0bcbae10fee70b7 (patch) | |
tree | 715708db84c3689da9353f39f85088f86359bbe1 /llvm/lib/Transforms/ObjCARC | |
parent | 26b7aa020bdcabd10ba1c81226327007321aeb89 (diff) | |
download | bcm5719-llvm-833f34d837eca1e11370fbdea0bcbae10fee70b7.tar.gz bcm5719-llvm-833f34d837eca1e11370fbdea0bcbae10fee70b7.zip |
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.
llvm-svn: 237169
Diffstat (limited to 'llvm/lib/Transforms/ObjCARC')
-rw-r--r-- | llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp index 4d7565879af..dca3f1b03fb 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp @@ -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()); diff --git a/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp b/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp index 15ad8dc522f..8346345599a 100644 --- a/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp +++ b/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp @@ -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; } |