Index: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -825,6 +825,9 @@ 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 Args; @@ -1017,9 +1020,6 @@ 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();