diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index d93ca4f..222f8af 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -4083,9 +4083,10 @@ static bool removeEmptyCleanup(CleanupReturnInst *RI) { // The iterator must be incremented here because the instructions are // being moved to another block. PHINode *PN = cast<PHINode>(I++); - if (PN->use_empty()) - // If the PHI node has no uses, just leave it. It will be erased - // when we erase BB below. + if (PN->use_empty() || !PN->isUsedOutsideOfBlock(BB)) + // If the PHI node has no uses or all of its uses are in this basic + // block (meaning they are debug or lifetime intrinsics), just leave + // it. It will be erased when we erase BB below. continue; // Otherwise, sink this PHI node into UnwindDest. |