Don't DCE the landingpad instruction.

The landingpad instruction can be removed only when its invokes are removed.

llvm-svn: 138930
This commit is contained in:
Bill Wendling 2011-09-01 01:16:58 +00:00
parent 3555b5d717
commit 2d1f11f743
1 changed files with 5 additions and 0 deletions

View File

@ -1577,6 +1577,11 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) {
while (Term != BB->begin()) { // Remove instrs bottom-up
BasicBlock::iterator I = Term; --I;
// Don't remove the landingpad instruction. This should be removed
// only if its invokes are also removed.
if (isa<LandingPadInst>(I))
continue;
DEBUG(errs() << "IC: DCE: " << *I << '\n');
// A debug intrinsic shouldn't force another iteration if we weren't
// going to do one without it.