[llvm-dev] [LLVM LTO]internalize pass

Umesh Kalappa via llvm-dev llvm-dev at lists.llvm.org
Fri May 27 03:43:30 PDT 2016


Hi All ,

We are in process of exploring the  LTO  and found that internalize
pass is the replacement for whole program optimisation
(-fwhole-program in gcc)  in clang  and  in the below case

define i32 @test() #0 {

entry:

  ret i32 0

}


define i32 @main() #0 {

entry:

  %retval = alloca i32, align 4

  store i32 0, i32* %retval, align 4

  %call = call i32 @test()

  ret i32 %call

}

*** IR Dump After Internalize Global Symbols ***; ModuleID = 'ld-temp.o'

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

target triple = "x86_64-unknown-linux-gnu"


; Function Attrs: nounwind uwtable

define internal i32 @test() #0 {

entry:

  ret i32 0

}


; Function Attrs: nounwind uwtable

define internal i32 @main() #0 {

entry:

  %retval = alloca i32, align 4

  store i32 0, i32* %retval, align 4

  %call = call i32 @test()

  ret i32 %call

}


the functions  def like test() and the main()  are marked internal by
the internalize pass.

Queries is ,we tried to prevent mark the internal string attribute
before function name i.e

$bin/llvm-lto -print-after-all  test.o
-internalize-public-api-list=test,main  -o output.o

$bin/llvm-lto -print-after-all  test.o
-internalize-public-api-file=file  -o output.o
$cat file
 test
 main

Both cases ,no luck here ,still the functions are marked internal :(

Any suggestions here or its a bug with internalize pass.


Thank you
~Umesh


More information about the llvm-dev mailing list