Home | History | Annotate | Download | only in LTO
      1 ; RUN: opt -S -instcombine <%s | FileCheck %s
      2 ; rdar://problem/16165191
      3 ; llvm.compiler.used functions should not be renamed
      4 
      5 target triple = "x86_64-apple-darwin11"
      6 
      7 @llvm.compiler.used = appending global [1 x i8*] [
      8   i8* bitcast (i32(i8*)* @puts to i8*)
      9   ], section "llvm.metadata"
     10 @llvm.used = appending global [1 x i8*] [
     11   i8* bitcast (i32(i32)* @uses_printf to i8*)
     12   ], section "llvm.metadata"
     13 
     14 @str = private unnamed_addr constant [13 x i8] c"hello world\0A\00"
     15 
     16 define i32 @uses_printf(i32 %i) {
     17 entry:
     18   %s = getelementptr [13 x i8]* @str, i64 0, i64 0
     19   call i32 (i8*, ...)* @printf(i8* %s)
     20   ret i32 0
     21 }
     22 
     23 define internal i32 @printf(i8* readonly nocapture %fmt, ...) {
     24 entry:
     25   %ret = call i32 @bar(i8* %fmt)
     26   ret i32 %ret
     27 }
     28 
     29 ; CHECK: define {{.*}} @puts(
     30 define internal i32 @puts(i8* %s) {
     31 entry:
     32   %ret = call i32 @bar(i8* %s)
     33   ret i32 %ret
     34 }
     35 
     36 declare i32 @bar(i8*)
     37