[LLVMdev] call graph not complete

Vasudev.Negi at microchip.com Vasudev.Negi at microchip.com
Wed Jan 20 21:59:42 PST 2010


Consider C code

void foo();

int main(void) {

  foo();

  return 0; 

}

void foo(void) {

 int a =10;

}

 

Bitcode generated by clang with -O0 is :

 

define i32 @main() nounwind {

entry:

  %retval = alloca i32                            ; <i32*> [#uses=3]

  store i32 0, i32* %retval

  call void (...)* bitcast (void ()* @foo to void (...)*)()

  store i32 0, i32* %retval

  %0 = load i32* %retval                          ; <i32> [#uses=1]

  ret i32 %0

}

 

define void @foo() nounwind {

entry:

  %a = alloca i32, align 4                        ; <i32*> [#uses=1]

  store i32 10, i32* %a

  ret void

}

 

Bitcode generated by llvm-ld with -disable-opt and -basiccg options is:

 

define i32 @main() nounwind {

entry:

  %retval = alloca i32                            ; <i32*> [#uses=3]

  store i32 0, i32* %retval

  call void (...)* bitcast (void ()* @foo to void (...)*)()

  store i32 0, i32* %retval

  %0 = load i32* %retval                          ; <i32> [#uses=1]

  ret i32 %0

}

 

define void @foo() nounwind {

entry:

  %a = alloca i32, align 4                        ; <i32*> [#uses=1]

  store i32 10, i32* %a

  ret void

}

 

My point is why is the call to foo not resolved correctly in llvm-ld.
Here if I try to make use of the call graph pass to get the call graph,
I do not get the complete call graph.

 

Thanks

Vasudev

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


More information about the llvm-dev mailing list