[LLVMdev] Internalize pass

Chris Lattner clattner at apple.com
Wed Sep 30 08:13:06 PDT 2009


On Sep 30, 2009, at 12:06 AM, Talin wrote:

> I'm playing around with different combinations of LTO passes, and  
> I've run into a strange problem:
>
> I have a 'main' function that looks like this:
>
> define i32 @"main(tart.core.Array[tart.core.String])- 
> >int"(%"tart.core.Array[tart.core.String]"* %args) {
> entry:
>   call void @llvm.dbg.func.start(metadata !0)
>   call void @llvm.dbg.stoppoint(i32 2, i32 19, metadata !1)
>   %integerLimitsTest = call { } @integerLimitsTest() ; <{ }> [#uses=0]
>   call void @llvm.dbg.stoppoint(i32 3, i32 21, metadata !1)
>   %integerToStringTest = call { } @integerToStringTest() ; <{ }>  
> [#uses=0]
>   call void @llvm.dbg.stoppoint(i32 4, i32 9, metadata !1)
>   call void @llvm.dbg.region.end(metadata !0)
>   ret i32 0
> }
>
> However, when I add an internalize pass before the other LTO passes,  
> the 'main' function turns into this:
>
> define i32 @main(i32, i8** nocapture) nounwind readnone {
> entry:
>   tail call void @llvm.dbg.func.start(metadata !0)
>   tail call void @llvm.dbg.stoppoint(i32 3, i32 21, metadata !1)
>   unreachable
> }
>
> The thing is, there's nothing particularly special or interesting  
> about the functions being called from main().

This is likely to not be due to internalize itself.  Internalize marks  
functions "internal", which allows other interprocedural optimizers to  
have more freedom to change their interfaces etc.  The likely problem  
here is that you are calling something from 'main' with mismatching  
calling conventions or something like that.  It is hard to say without  
a full testcase.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090930/5610832a/attachment.html>


More information about the llvm-dev mailing list