Home | History | Annotate | Download | only in GlobalOpt
      1 ; RUN: opt < %s -globalopt -S | FileCheck %s
      2 
      3 @G = internal global i32 17             ; <i32*> [#uses=3]
      4 ; CHECK-NOT: @G
      5 
      6 define void @foo() {
      7         %V = load i32, i32* @G               ; <i32> [#uses=1]
      8         store i32 %V, i32* @G
      9         ret void
     10 ; CHECK-LABEL: @foo(
     11 ; CHECK-NEXT: ret void
     12 }
     13 
     14 define i32 @bar() {
     15         %X = load i32, i32* @G               ; <i32> [#uses=1]
     16         ret i32 %X
     17 ; CHECK-LABEL: @bar(
     18 ; CHECK-NEXT: ret i32 17
     19 }
     20 
     21 @a = internal global i64* null, align 8
     22 ; CHECK-NOT: @a
     23 
     24 ; PR13968
     25 define void @qux() nounwind {
     26   %b = bitcast i64** @a to i8*
     27   %g = getelementptr i64*, i64** @a, i32 1
     28   %cmp = icmp ne i8* null, %b
     29   %cmp2 = icmp eq i8* null, %b
     30   %cmp3 = icmp eq i64** null, %g
     31   store i64* inttoptr (i64 1 to i64*), i64** @a, align 8
     32   %l = load i64*, i64** @a, align 8
     33   ret void
     34 ; CHECK-LABEL: @qux(
     35 ; CHECK-NOT: store
     36 ; CHECK-NOT: load
     37 }
     38 
     39