diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2010-02-12 23:05:31 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2010-02-12 23:05:31 +0000 |
commit | 2d36eb6e18791da7b1dc018ad2fcaff864aed144 (patch) | |
tree | e93327e5de3228ef6fd2537be0788c9f921d4e6a /llvm/lib/ExecutionEngine | |
parent | 4ad96055fb180c243eb38665a60f3a053c0fc01b (diff) | |
download | bcm5719-llvm-2d36eb6e18791da7b1dc018ad2fcaff864aed144.tar.gz bcm5719-llvm-2d36eb6e18791da7b1dc018ad2fcaff864aed144.zip |
Make JIT::runFunction clean up the generated stub function.
Patch by Shivram K!
llvm-svn: 96037
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JIT.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp index 59a9a3dfe0b..3684a27744d 100644 --- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp +++ b/llvm/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<GenericValue>()); + // Finally, call our nullary stub function. + GenericValue Result = runFunction(Stub, std::vector<GenericValue>()); + // 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) { |