diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-09-14 05:02:59 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-09-14 05:02:59 +0000 |
commit | a28eeed1b03c33e7a3703572d9e348d1a0d2b220 (patch) | |
tree | 0a539f8dc0f905dec89e8afdbacd6e5bf12d9279 /test/LTO | |
parent | e2d706b2022e3dc90b34fcbed9e324573e590b12 (diff) |
Reland r313157, "ThinLTO: Correctly follow aliasee references when dead stripping." which was reverted in r313222.
This reland includes a fix for the LowerTypeTests pass so that it
looks past aliases when determining which type identifiers are live.
Differential Revision: https://reviews.llvm.org/D37842
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313229 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/LTO')
-rw-r--r-- | test/LTO/Resolution/X86/Inputs/dead-strip-alias.ll | 4 | ||||
-rw-r--r-- | test/LTO/Resolution/X86/dead-strip-alias.ll | 20 | ||||
-rw-r--r-- | test/LTO/Resolution/X86/lowertypetests.ll | 13 |
3 files changed, 36 insertions, 1 deletions
diff --git a/test/LTO/Resolution/X86/Inputs/dead-strip-alias.ll b/test/LTO/Resolution/X86/Inputs/dead-strip-alias.ll new file mode 100644 index 00000000000..16154d2c45b --- /dev/null +++ b/test/LTO/Resolution/X86/Inputs/dead-strip-alias.ll @@ -0,0 +1,4 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@external = global i8 42 diff --git a/test/LTO/Resolution/X86/dead-strip-alias.ll b/test/LTO/Resolution/X86/dead-strip-alias.ll new file mode 100644 index 00000000000..d009a484e4f --- /dev/null +++ b/test/LTO/Resolution/X86/dead-strip-alias.ll @@ -0,0 +1,20 @@ +; RUN: opt -module-summary -o %t %s +; RUN: opt -module-summary -o %t2 %S/Inputs/dead-strip-alias.ll +; RUN: llvm-lto2 run %t -r %t,main,px -r %t,alias,p -r %t,external, \ +; RUN: %t2 -r %t2,external,p \ +; RUN: -save-temps -o %t3 +; RUN: llvm-nm %t3.1 | FileCheck %s + +; CHECK: D external + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@alias = alias i8*, i8** @internal + +@internal = internal global i8* @external +@external = external global i8 + +define i8** @main() { + ret i8** @alias +} diff --git a/test/LTO/Resolution/X86/lowertypetests.ll b/test/LTO/Resolution/X86/lowertypetests.ll index c84a786e66f..b87452c8e7a 100644 --- a/test/LTO/Resolution/X86/lowertypetests.ll +++ b/test/LTO/Resolution/X86/lowertypetests.ll @@ -1,21 +1,32 @@ ; RUN: opt -thinlto-bc -o %t %s -; RUN: llvm-lto2 run -r %t,f,plx -r %t,foo,lx -r %t,foo,plx -o %t1 %t +; RUN: llvm-lto2 run -r %t,f,plx -r %t,g_alias,plx -r %t,foo,lx -r %t,foo,plx -r %t,bar,lx -r %t,bar,plx -o %t1 %t ; RUN: llvm-nm %t1.0 | FileCheck --check-prefix=MERGED %s ; RUN: llvm-nm %t1.1 | FileCheck %s +; MERGED: R __typeid_bar_global_addr ; MERGED: R __typeid_foo_global_addr +; CHECK: U __typeid_bar_global_addr ; CHECK: U __typeid_foo_global_addr target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @foo = global i32 0, !type !0 +@bar = global i32 0, !type !1 define i1 @f(i8* %ptr) { %p = call i1 @llvm.type.test(i8* %ptr, metadata !"foo") ret i1 %p } +@g_alias = alias i1 (i8*), i1 (i8*)* @g + +define internal i1 @g(i8* %ptr) { + %p = call i1 @llvm.type.test(i8* %ptr, metadata !"bar") + ret i1 %p +} + declare i1 @llvm.type.test(i8* %ptr, metadata %typeid) nounwind readnone !0 = !{i32 0, !"foo"} +!1 = !{i32 0, !"bar"} |