llvm-6502/test/LTO/keep-used-puts-during-instcombine.ll
Duncan P. N. Exon Smith 76c17d324c IR: Don't allow non-default visibility on local linkage
Visibilities of `hidden` and `protected` are meaningless for symbols
with local linkage.

  - Change the assembler to reject non-default visibility on symbols
    with local linkage.

  - Change the bitcode reader to auto-upgrade `hidden` and `protected`
    to `default` when the linkage is local.

  - Update LangRef.

<rdar://problem/16141113>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208263 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-07 22:57:20 +00:00

37 lines
885 B
LLVM

; RUN: opt -S -instcombine <%s | FileCheck %s
; rdar://problem/16165191
; llvm.compiler.used functions should not be renamed
target triple = "x86_64-apple-darwin11"
@llvm.compiler.used = appending global [1 x i8*] [
i8* bitcast (i32(i8*)* @puts to i8*)
], section "llvm.metadata"
@llvm.used = appending global [1 x i8*] [
i8* bitcast (i32(i32)* @uses_printf to i8*)
], section "llvm.metadata"
@str = private unnamed_addr constant [13 x i8] c"hello world\0A\00"
define i32 @uses_printf(i32 %i) {
entry:
%s = getelementptr [13 x i8]* @str, i64 0, i64 0
call i32 (i8*, ...)* @printf(i8* %s)
ret i32 0
}
define internal i32 @printf(i8* readonly nocapture %fmt, ...) {
entry:
%ret = call i32 @bar(i8* %fmt)
ret i32 %ret
}
; CHECK: define {{.*}} @puts(
define internal i32 @puts(i8* %s) {
entry:
%ret = call i32 @bar(i8* %s)
ret i32 %ret
}
declare i32 @bar(i8*)