Home | History | Annotate | Download | only in GlobalOpt
      1 ; RUN: opt < %s -globalopt -S | FileCheck %s
      2 
      3 @c = global i8 42
      4 
      5 @i = internal global i8 42
      6 ; CHECK: @ia = internal global i8 42
      7 @ia = alias internal i8* @i
      8 
      9 @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata"
     10 ; CHECK-DAG: @llvm.used = appending global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca], section "llvm.metadata"
     11 
     12 @llvm.compiler.used = appending global [4 x i8*] [i8* bitcast (void ()* @fa3 to i8*), i8* bitcast (void ()* @fa to i8*), i8* @ia, i8* @i], section "llvm.metadata"
     13 ; CHECK-DAG: @llvm.compiler.used = appending global [2 x i8*] [i8* bitcast (void ()* @fa3 to i8*), i8* @ia], section "llvm.metadata"
     14 
     15 @sameAsUsed = global [3 x i8*] [i8* bitcast (void ()* @fa to i8*), i8* bitcast (void ()* @f to i8*), i8* @ca]
     16 ; CHECK-DAG: @sameAsUsed = global [3 x i8*] [i8* bitcast (void ()* @f to i8*), i8* bitcast (void ()* @f to i8*), i8* @c]
     17 
     18 @other = global i32* bitcast (void ()* @fa to i32*)
     19 ; CHECK-DAG: @other = global i32* bitcast (void ()* @f to i32*)
     20 
     21 @fa = alias internal void ()* @f
     22 ; CHECK: @fa = alias internal void ()* @f
     23 
     24 @fa2 = alias internal void ()* @f
     25 ; CHECK-NOT: @fa2
     26 
     27 @fa3 = alias internal void ()* @f
     28 ; CHECK: @fa3
     29 
     30 @ca = alias internal i8* @c
     31 ; CHECK: @ca = alias internal i8* @c
     32 
     33 define void @f() {
     34   ret void
     35 }
     36 
     37 define i8* @g() {
     38   ret i8* bitcast (void ()* @fa to i8*);
     39 }
     40 
     41 define i8* @g2() {
     42   ret i8* bitcast (void ()* @fa2 to i8*);
     43 }
     44 
     45 define i8* @h() {
     46   ret i8* @ca
     47 }
     48