diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2017-12-30 15:27:33 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2017-12-30 15:27:33 +0000 |
commit | c7fc81e6595865296738fe0f8ffe692ea41b1ffc (patch) | |
tree | 9c14093b59b87a53d42ecbeb9c263c85f46f97e3 /llvm/lib/Transforms/Utils/CloneFunction.cpp | |
parent | 06f6d262f99d4bc13739eb224084d239f5445682 (diff) | |
download | llvm-c7fc81e6595865296738fe0f8ffe692ea41b1ffc.zip llvm-c7fc81e6595865296738fe0f8ffe692ea41b1ffc.tar.gz llvm-c7fc81e6595865296738fe0f8ffe692ea41b1ffc.tar.bz2 |
Use phi ranges to simplify code. No functionality change intended.
llvm-svn: 321585
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/CloneFunction.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index 3b19ba1..16af2c7 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -493,17 +493,13 @@ void llvm::CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc, // Handle PHI nodes specially, as we have to remove references to dead // blocks. - for (BasicBlock::const_iterator I = BI.begin(), E = BI.end(); I != E; ++I) { + for (const PHINode &PN : BI.phis()) { // PHI nodes may have been remapped to non-PHI nodes by the caller or // during the cloning process. - if (const PHINode *PN = dyn_cast<PHINode>(I)) { - if (isa<PHINode>(VMap[PN])) - PHIToResolve.push_back(PN); - else - break; - } else { + if (isa<PHINode>(VMap[&PN])) + PHIToResolve.push_back(&PN); + else break; - } } // Finally, remap the terminator instructions, as those can't be remapped |