2012-09-28 10:01:27 +00:00
|
|
|
; RUN: opt < %s -globalopt -S | FileCheck %s
|
2004-11-14 20:41:39 +00:00
|
|
|
|
2008-03-01 09:15:35 +00:00
|
|
|
@G = internal global i32 17 ; <i32*> [#uses=3]
|
2012-09-28 10:01:27 +00:00
|
|
|
; CHECK-NOT: @G
|
2004-11-14 20:41:39 +00:00
|
|
|
|
2008-03-01 09:15:35 +00:00
|
|
|
define void @foo() {
|
|
|
|
%V = load i32* @G ; <i32> [#uses=1]
|
|
|
|
store i32 %V, i32* @G
|
2004-11-14 20:41:39 +00:00
|
|
|
ret void
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @foo(
|
2012-09-28 10:01:27 +00:00
|
|
|
; CHECK-NEXT: ret void
|
2004-11-14 20:41:39 +00:00
|
|
|
}
|
2008-03-01 09:15:35 +00:00
|
|
|
|
|
|
|
define i32 @bar() {
|
|
|
|
%X = load i32* @G ; <i32> [#uses=1]
|
|
|
|
ret i32 %X
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @bar(
|
2012-09-28 10:01:27 +00:00
|
|
|
; CHECK-NEXT: ret i32 17
|
|
|
|
}
|
|
|
|
|
|
|
|
@a = internal global i64* null, align 8
|
|
|
|
; CHECK-NOT: @a
|
|
|
|
|
|
|
|
; PR13968
|
|
|
|
define void @qux() nounwind {
|
|
|
|
%b = bitcast i64** @a to i8*
|
|
|
|
%g = getelementptr i64** @a, i32 1
|
|
|
|
%cmp = icmp ne i8* null, %b
|
|
|
|
%cmp2 = icmp eq i8* null, %b
|
|
|
|
%cmp3 = icmp eq i64** null, %g
|
|
|
|
store i64* inttoptr (i64 1 to i64*), i64** @a, align 8
|
|
|
|
%l = load i64** @a, align 8
|
|
|
|
ret void
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @qux(
|
2012-09-28 10:01:27 +00:00
|
|
|
; CHECK-NOT: store
|
|
|
|
; CHECK-NOT: load
|
2004-11-14 20:41:39 +00:00
|
|
|
}
|
|
|
|
|