Erase instructions _after_ checking their type.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 28 May 2011 11:48:37 +0000 (11:48 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 28 May 2011 11:48:37 +0000 (11:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132256 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/DwarfEHPrepare.cpp

index 6a53e6933704ee57d8bef4611a164da243b4ebf0..873ddd20b8c5be7e6041779d81ecd9005971e078 100644 (file)
@@ -532,13 +532,14 @@ bool DwarfEHPrepare::LowerUnwindsAndResumes() {
     if (isa<UnwindInst>(RI))
       new UnreachableInst(RI->getContext(), RI);
 
-    // Nuke the resume instruction.
-    RI->eraseFromParent();
-
     if (isa<UnwindInst>(RI))
       ++NumUnwindsLowered;
     else
       ++NumResumesLowered;
+
+    // Nuke the resume instruction.
+    RI->eraseFromParent();
+
     Changed = true;
   }