Fix ids and remove invoke when inlining.

Bugs found by Razvan Lupusoru.

Change-Id: I3a5a9af280d8700d18f52abb4a2cff0e3a9aac74
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index fb941b5..4133cf6 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -750,13 +750,16 @@
     }
   }
 
-  // Finally, replace the invoke with the return value of the inlined graph.
+  // Replace the invoke with the return value of the inlined graph.
   if (last->IsReturn()) {
     invoke->ReplaceWith(last->InputAt(0));
     body->RemoveInstruction(last);
   } else {
     DCHECK(last->IsReturnVoid());
   }
+
+  // Finally remove the invoke from the caller.
+  invoke->GetBlock()->RemoveInstruction(invoke);
 }
 
 }  // namespace art