xref: /llvm-project/llvm/test/LTO/Resolution/X86/not-prevailing-weak-aliasee.ll (revision 15655915b38600c28f58721950ae75e6284763b6)
1; Test to ensure that non-prevailing weak aliasee is kept as a weak definition
2; when the alias is not dead.
3; RUN: opt -module-summary %s -o %t1.bc
4; RUN: llvm-lto2 run %t1.bc \
5; RUN:	 -r=%t1.bc,__a,lx \
6; RUN:	 -r=%t1.bc,__b,l \
7; RUN:	 -r=%t1.bc,a,plx \
8; RUN:	 -r=%t1.bc,b,pl \
9; RUN:   -o %t2.o -save-temps
10
11; Check that __a is kept as a weak def. __b can be dropped since its alias is
12; not live and will also be dropped.
13; RUN: llvm-dis %t2.o.1.1.promote.bc -o - | FileCheck %s
14; CHECK: define weak hidden void @__a
15; CHECK: declare hidden void @__b
16; CHECK: declare void @b
17
18target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
19target triple = "x86_64-unknown-linux-gnu"
20
21@a = hidden alias void (), ptr @__a
22
23define weak hidden void @__a() {
24entry:
25  ret void
26}
27
28@b = hidden alias void (), ptr @__b
29
30define weak hidden void @__b() {
31entry:
32  ret void
33}
34