OSDN Git Service

[DeadArgumentElim] Set pointer to DISubprogram before calling RAUW. NFC
[android-x86/external-llvm.git] / lib / Transforms / IPO / DeadArgumentElimination.cpp
index 5446541..78e4d66 100644 (file)
@@ -825,6 +825,9 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
   F->getParent()->getFunctionList().insert(F->getIterator(), NF);
   NF->takeName(F);
 
+  // Patch the pointer to LLVM function in debug info descriptor.
+  NF->setSubprogram(F->getSubprogram());
+
   // Loop over all of the callers of the function, transforming the call sites
   // to pass in a smaller number of arguments into the new function.
   std::vector<Value*> Args;
@@ -1017,9 +1020,6 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
         BB.getInstList().erase(RI);
       }
 
-  // Patch the pointer to LLVM function in debug info descriptor.
-  NF->setSubprogram(F->getSubprogram());
-
   // Now that the old function is dead, delete it.
   F->eraseFromParent();