diff options
author | Stephen Hines <srhines@google.com> | 2014-04-23 16:57:46 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-04-24 15:53:16 -0700 |
commit | 36b56886974eae4f9c5ebc96befd3e7bfe5de338 (patch) | |
tree | e6cfb69fbbd937f450eeb83bfb83b9da3b01275a /test/LTO | |
parent | 69a8640022b04415ae9fac62f8ab090601d8f889 (diff) | |
download | external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.zip external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.gz external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.bz2 |
Update to LLVM 3.5a.
Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
Diffstat (limited to 'test/LTO')
-rw-r--r-- | test/LTO/current-section.ll | 4 | ||||
-rw-r--r-- | test/LTO/keep-used-puts-during-instcombine.ll | 36 | ||||
-rw-r--r-- | test/LTO/linkonce_odr_func.ll | 8 | ||||
-rw-r--r-- | test/LTO/no-undefined-puts-when-implemented.ll | 40 | ||||
-rw-r--r-- | test/LTO/private-symbol.ll | 7 | ||||
-rw-r--r-- | test/LTO/symver-asm.ll | 16 | ||||
-rw-r--r-- | test/LTO/triple-init.ll | 16 |
7 files changed, 126 insertions, 1 deletions
diff --git a/test/LTO/current-section.ll b/test/LTO/current-section.ll new file mode 100644 index 0000000..f79b378 --- /dev/null +++ b/test/LTO/current-section.ll @@ -0,0 +1,4 @@ +; RUN: llvm-as < %s >%t1 +; RUN: llvm-lto -o %t2 %t1 + +module asm ".align 4" diff --git a/test/LTO/keep-used-puts-during-instcombine.ll b/test/LTO/keep-used-puts-during-instcombine.ll new file mode 100644 index 0000000..1dc63dd --- /dev/null +++ b/test/LTO/keep-used-puts-during-instcombine.ll @@ -0,0 +1,36 @@ +; 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 hidden i32 @printf(i8* readonly nocapture %fmt, ...) { +entry: + %ret = call i32 @bar(i8* %fmt) + ret i32 %ret +} + +; CHECK: define {{.*}} @puts( +define internal hidden i32 @puts(i8* %s) { +entry: + %ret = call i32 @bar(i8* %s) + ret i32 %ret +} + +declare i32 @bar(i8*) diff --git a/test/LTO/linkonce_odr_func.ll b/test/LTO/linkonce_odr_func.ll index 8a49326..a67ffc0 100644 --- a/test/LTO/linkonce_odr_func.ll +++ b/test/LTO/linkonce_odr_func.ll @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s >%t1 ; RUN: llvm-lto -o %t2 -dso-symbol=foo1 -dso-symbol=foo2 -dso-symbol=foo3 \ -; RUN: -dso-symbol=foo4 %t1 -disable-opt +; RUN: -dso-symbol=foo4 -dso-symbol=v1 -dso-symbol=v2 %t1 -disable-opt ; RUN: llvm-nm %t2 | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" @@ -26,6 +26,12 @@ define linkonce_odr void @foo4() noinline { ret void } +; CHECK: r v1 +@v1 = linkonce_odr constant i32 32 + +; CHECK: V v2 +@v2 = linkonce_odr global i32 32 + declare void @f(void()*) declare void @p() diff --git a/test/LTO/no-undefined-puts-when-implemented.ll b/test/LTO/no-undefined-puts-when-implemented.ll new file mode 100644 index 0000000..18f5d21 --- /dev/null +++ b/test/LTO/no-undefined-puts-when-implemented.ll @@ -0,0 +1,40 @@ +; RUN: llvm-as <%s >%t1 +; RUN: llvm-lto -exported-symbol=_uses_puts -exported-symbol=_uses_printf -o - %t1 | \ +; RUN: llvm-nm | \ +; RUN: FileCheck %s +; rdar://problem/16165191 +; runtime library implementations should not be renamed + +target triple = "x86_64-apple-darwin11" + +@str = private unnamed_addr constant [13 x i8] c"hello world\0A\00" + +; CHECK-NOT: U _puts +; CHECK: T _uses_printf +; CHECK: T _uses_puts +define i32 @uses_puts(i32 %i) { +entry: + %s = call i8* @foo(i32 %i) + %ret = call i32 @puts(i8* %s) + ret i32 %ret +} +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 hidden i32 @printf(i8* readonly nocapture %fmt, ...) { +entry: + %ret = call i32 @bar(i8* %fmt) + ret i32 %ret +} +define hidden i32 @puts(i8* %s) { +entry: + %ret = call i32 @bar(i8* %s) + ret i32 %ret +} + +declare i8* @foo(i32) +declare i32 @bar(i8*) diff --git a/test/LTO/private-symbol.ll b/test/LTO/private-symbol.ll new file mode 100644 index 0000000..e13a393 --- /dev/null +++ b/test/LTO/private-symbol.ll @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s >%t1 +; RUN: llvm-lto -o %t2 %t1 + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@.str = private unnamed_addr constant [7 x i8] c"hello\0A\00", align 1 diff --git a/test/LTO/symver-asm.ll b/test/LTO/symver-asm.ll new file mode 100644 index 0000000..03dda2b --- /dev/null +++ b/test/LTO/symver-asm.ll @@ -0,0 +1,16 @@ +; RUN: llvm-as < %s >%t1 +; RUN: llvm-lto -o %t2 %t1 +; RUN: llvm-nm %t2 | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" + +module asm ".symver io_cancel_0_4,io_cancel@@LIBAIO_0.4" + +; Even without -exported-symbol, io_cancel_0_4 should be noticed by LTOModule's +; RecordStreamer, so it shouldn't get eliminated. However, the object file will +; contain the aliased symver as well as the original. +define i32 @io_cancel_0_4() { +; CHECK: io_cancel@@LIBAIO_0.4 +; CHECK: io_cancel_0_4 + ret i32 0 +} diff --git a/test/LTO/triple-init.ll b/test/LTO/triple-init.ll new file mode 100644 index 0000000..e0ad879 --- /dev/null +++ b/test/LTO/triple-init.ll @@ -0,0 +1,16 @@ +; RUN: llvm-as < %s >%t1 +; RUN: llvm-lto -exported-symbol=_main -o %t2 %t1 +; RUN: llvm-nm %t2 | FileCheck %s + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" + +target triple = "x86_64-apple-macosx10.9" + +declare double @pow(double, double) + +define double @main(double %x) { +; We check that LTO will be aware of target triple and apply pow to __exp10 transformation. +; CHECK: U ___exp10 + %retval = call double @pow(double 10.0, double %x) + ret double %retval +} |