OSDN Git Service

Fix PR4834, a tricky case where the inliner would resolve an
authorChris Lattner <sabre@nondot.org>
Mon, 31 Aug 2009 03:15:49 +0000 (03:15 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 31 Aug 2009 03:15:49 +0000 (03:15 +0000)
commitb374b90e81d0ce6b5d02041ba4f7b15a945b38d8
treec25a672fec1906289c9f27809afc94e17f372657
parent2adb8306e2256a4d1bef8f21ebb6dba55a108a88
Fix PR4834, a tricky case where the inliner would resolve an
indirect function pointer, inline it, then go to delete the body.
The problem is that the callgraph had other references to the function,
though the inliner had no way to know it, so we got a dangling pointer
and an invalid iterator out of the deal.

The fix to this is pretty simple: stop the inliner from deleting the
function by knowing that there are references to it.  Do this by making
CallGraphNodes contain a refcount.  This requires moving deletion of
available_externally functions to the module-level cleanup sweep where
it belongs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80533 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/CallGraph.h
lib/Analysis/IPA/CallGraph.cpp
lib/Transforms/IPO/Inliner.cpp
test/Transforms/Inline/indirect_resolve.ll [new file with mode: 0644]