[LLVMdev] Pass to remove unused functions

Villmow, Micah Micah.Villmow at amd.com
Wed May 6 10:53:42 PDT 2009


Yeah, I found that out, which is why I was hoping some kind of attribute
existed that the compiler knew about.

We might go the path of modifying llvm-link to only link in functions
that are required as that seems to be the most optimal way of doing it.

Thanks,

Micah

 

From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
On Behalf Of Chris Lattner
Sent: Tuesday, May 05, 2009 7:47 PM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Pass to remove unused functions

 

 

On May 5, 2009, at 4:50 PM, Villmow, Micah wrote:





Is there a way to mark all functions as internal from source via some
sort of attribute?

 

"static".  However, if you do that, they won't make it into the bc file.

 

-Chris





 

Thanks for the tips,

Micah

 

From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
On Behalf Of Chris Lattner
Sent: Tuesday, May 05, 2009 4:16 PM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Pass to remove unused functions

 

 

On May 5, 2009, at 4:07 PM, Villmow, Micah wrote:






I thought this pass would do it, but when I run it over my bc file the
output file is the same as the input file.

 

that's probably because your symbols are not internal.






 

The issue I guess  is a little different. When I link in the huge bc
file with the tiny bc file, I only want the resulting bc file to have
the function definitions that the tiny bc file requires and not every
function in the huge bc file.

 

Any idea's how to do this with the current llvm toolset?

 

You have to roll your own using the lower level APIs.  You can move
functions between modules etc.  Alternatively, you can link the two
modules and mark the functions you don't want as internal, then use
globaldce.

 

-Chris

_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090506/40ece989/attachment.html>


More information about the llvm-dev mailing list