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