From: Jeffrey Yasskin Date: Fri, 12 Feb 2010 23:05:31 +0000 (+0000) Subject: Make JIT::runFunction clean up the generated stub function. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3174f6703e534366382390b7c7daa913483f4340;p=oota-llvm.git Make JIT::runFunction clean up the generated stub function. Patch by Shivram K! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96037 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index 59a9a3dfe0b..3684a27744d 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -553,8 +553,12 @@ GenericValue JIT::runFunction(Function *F, else ReturnInst::Create(F->getContext(), StubBB); // Just return void. - // Finally, return the value returned by our nullary stub function. - return runFunction(Stub, std::vector()); + // Finally, call our nullary stub function. + GenericValue Result = runFunction(Stub, std::vector()); + // Erase it, since no other function can have a reference to it. + Stub->eraseFromParent(); + // And return the result. + return Result; } void JIT::RegisterJITEventListener(JITEventListener *L) {