Index: lib/Transforms/IPO/DeadArgumentElimination.cpp =================================================================== --- lib/Transforms/IPO/DeadArgumentElimination.cpp +++ lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -957,6 +957,9 @@ // function empty. NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList()); + // Patch the pointer to LLVM function in debug info descriptor. + NF->setSubprogram(F->getSubprogram()); + // Loop over the argument list, transferring uses of the old arguments over to // the new arguments, also transferring over the names as well. i = 0; @@ -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();