How can I know which functions aren't used within one module?

Every value used in .ll file normally has '#uses=' printed next to it.
But functions don't have this.

Is there a way to make llvm to print uses of functions within the current module?

Thank you,
Yuri

Hi Yuri,

I was waiting for someone with more knowledge to answer that, but I
guess you just need to write a pass that counts the number of 'call's
to each function in each other function and global declarations, and
maybe add uses to Functions.

cheers,
--renato

Hi Yuri,

Every value used in .ll file normally has '#uses=' printed next to it.
But functions don't have this.

I've added this.

Ciao,

Duncan.

I just removed it :slight_smile:

In retrospect, having #uses come out of the asmprinter by default was a "bad thing", because it is just clutter and doesn't add much useful value. It is better to have people interested in this opt into it.

Instead of being on by default, I reimplemented it as part of the llvm-dis tool. To get #uses info (including for functions) you can now run a .bc file through "llvm-dis -show-annotations".

-Chris