[LLVMdev] Function aliases in CallGraph

Eli Friedman eli.friedman at gmail.com
Thu Oct 11 16:02:22 PDT 2012


On Thu, Oct 11, 2012 at 3:56 PM, Stephen Schiffli <sschiffli at gmail.com> wrote:
> Hello, I have a simple program using aliases to functions, and it seems that
> the CallGraph doesn't follow these aliases.  Here is the example:
>
> @alias = alias void ()* @realfunc
>
> define void @realfunc() {
> entry:
>   ret void
> }
>
> define i32 @main() {
> entry:
>   call void @alias()
>   ret i32 0
> }
>
> ******* Output of the CallGraph *******
>
> Call graph node <<null function>><<0xbe64c0>>  #uses=0
>   CS<0x0> calls function 'realfunc'
>   CS<0x0> calls function 'realfunc'
>   CS<0x0> calls function 'main'
>
> Call graph node for function: 'realfunc'<<0xbe6880>>  #uses=2
>
> Call graph node for function: 'main'<<0xbe6d80>>  #uses=1
>   CS<0xbdfe7c> calls external node
>
> Is there a reason the CallGraph doesn't try to see through aliases?  I would
> like this capability, but was wondering if it is generally safe to do.

CallGraph is designed to be as simple as possible.  GlobalOpt will
perform the optimization in question.

-Eli



More information about the llvm-dev mailing list