Removing unused function definitions

Hi,

I wonder if there is a pass in opt that removes unused function
definitions. I'm working on a llvm based compiler backend and when I
link the generated bc files with the runtime system and the standard
library, all functions from the standard library are in the linked bc
file, even unused ones. I've tried some different passes in "opt" but
the definitions are still there.

Regards
Mattias

Hi Mattias,

I wonder if there is a pass in opt that removes unused function
definitions. I'm working on a llvm based compiler backend and when I
link the generated bc files with the runtime system and the standard
library, all functions from the standard library are in the linked bc
file, even unused ones. I've tried some different passes in "opt" but
the definitions are still there.

try running the -internalize pass first.

Ciao,

Duncan.