From d215fd3b74b90f5dc1964610926fcc2a20f959aa Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 6 Jan 2018 21:34:26 +0000 Subject: Vendor import of llvm release_60 branch r321788: https://llvm.org/svn/llvm-project/llvm/branches/release_60@321788 --- lib/Transforms/Utils/CloneFunction.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/Transforms/Utils/CloneFunction.cpp') diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp index 3b19ba1b50f2f..16af2c7b808b5 100644 --- a/lib/Transforms/Utils/CloneFunction.cpp +++ b/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(I)) { - if (isa(VMap[PN])) - PHIToResolve.push_back(PN); - else - break; - } else { + if (isa(VMap[&PN])) + PHIToResolve.push_back(&PN); + else break; - } } // Finally, remap the terminator instructions, as those can't be remapped -- cgit v1.2.3