[llvm-dev] Finding the entry point function in a LLVM IR

mohie pokhriyal via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 25 07:26:29 PDT 2017


Thanks David !
Appreciate the guidance. :)

Ill go through the internalize pass , hopefully that should also give me an
idea to find the entry point .

Thanks

On Wed, Oct 25, 2017 at 2:07 PM, David Chisnall <David.Chisnall at cl.cam.ac.uk
> wrote:

> On 25 Oct 2017, at 05:34, mohie pokhriyal <mohie10 at gmail.com> wrote:
> >
> > Thank You David and Mats for the reply,
> >
> > The reason I need to know that main is the entry point is as follows :
> >
> > I have a dead code elimination pass that removes the function call for
> boo. boo was initially called from the main function , but since the return
> in the main function has no dependency on boo, boo function call is removed.
>
> This is not sound.  The linkage of boo means that it is externally
> visible.  There is no guarantee that it will not be called from another
> compilation unit.  If boo had internal or private linkage, then you would
> be safe to delete it as soon as its uses count dropped to zero (and LLVM’s
> dead code elimination pass will do exactly that).
>
> If you run the Internalize pass first, then it will mark functions that
> are not reachable from main as internal and then DCE can delete them.
>
> David
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171025/40400c8b/attachment.html>


More information about the llvm-dev mailing list