diff options
author | Andrew Kaylor <andrew.kaylor@intel.com> | 2015-03-20 21:42:54 +0000 |
---|---|---|
committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2015-03-20 21:42:54 +0000 |
commit | 3170e5620e463b20688bc629bde08c5ca554ea11 (patch) | |
tree | 87630712f2ffc01a189729c53b611c9a5c671025 /llvm/lib/Transforms | |
parent | c88f724fedeff64bd333668bdcda9d8d0a50f537 (diff) | |
download | bcm5719-llvm-3170e5620e463b20688bc629bde08c5ca554ea11.tar.gz bcm5719-llvm-3170e5620e463b20688bc629bde08c5ca554ea11.zip |
Fixing a bug with WinEH PHI handling
llvm-svn: 232851
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Utils/CloneFunction.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index 70532836513..f04ea9c29f5 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -524,11 +524,18 @@ 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) - if (const PHINode *PN = dyn_cast<PHINode>(I)) - PHIToResolve.push_back(PN); - else + for (BasicBlock::const_iterator I = BI->begin(), E = BI->end(); I != E; ++I) { + // 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 { break; + } + } // Finally, remap the terminator instructions, as those can't be remapped // until all BBs are mapped. |