summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/WinEHPrepare.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-04-16 17:02:23 +0000
committerReid Kleckner <reid@kleckner.net>2015-04-16 17:02:23 +0000
commit1c130bb04be91042cdbaf3361c4c55bbc5313093 (patch)
treed49a137cc22e596afbe8a2253b54dcb72d6cc8b0 /llvm/lib/CodeGen/WinEHPrepare.cpp
parent2ac115e5716d1998f2fe6c934d47eb128665cc96 (diff)
downloadbcm5719-llvm-1c130bb04be91042cdbaf3361c4c55bbc5313093.tar.gz
bcm5719-llvm-1c130bb04be91042cdbaf3361c4c55bbc5313093.zip
[WinEH] Handle a landingpad, resume, and cleanup all rolled into a BB
This happens a lot with simple cleanups after SimplifyCFG. llvm-svn: 235117
Diffstat (limited to 'llvm/lib/CodeGen/WinEHPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/WinEHPrepare.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp
index 4b0ce21111b..35b944ea309 100644
--- a/llvm/lib/CodeGen/WinEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WinEHPrepare.cpp
@@ -1582,11 +1582,10 @@ void WinEHPrepare::findCleanupHandlers(LandingPadActions &Actions,
InsertValueInst *Insert1 = nullptr;
InsertValueInst *Insert2 = nullptr;
Value *ResumeVal = Resume->getOperand(0);
- // If there is only one landingpad, we may use the lpad directly with no
- // insertions.
- if (isa<LandingPadInst>(ResumeVal))
- return;
- if (!isa<PHINode>(ResumeVal)) {
+ // If the resume value isn't a phi or landingpad value, it should be a
+ // series of insertions. Identify them so we can avoid them when scanning
+ // for cleanups.
+ if (!isa<PHINode>(ResumeVal) && !isa<LandingPadInst>(ResumeVal)) {
Insert2 = dyn_cast<InsertValueInst>(ResumeVal);
if (!Insert2)
return createCleanupHandler(Actions, CleanupHandlerMap, BB);
@@ -1702,7 +1701,6 @@ void WinEHPrepare::findCleanupHandlers(LandingPadActions &Actions,
return;
BB = Branch->getSuccessor(0);
}
- return;
}
// This is a public function, declared in WinEHFuncInfo.h and is also
OpenPOWER on IntegriCloud