2010-04-28 22:34:35 +00:00
|
|
|
; RUN: opt -S -globalopt < %s | FileCheck %s
|
2010-04-28 20:16:12 +00:00
|
|
|
|
|
|
|
; PR6112 - When globalopt does RAUW(@G, %G), the metadata reference should drop
|
2010-05-04 12:43:36 +00:00
|
|
|
; to null. Function local metadata that references @G from a different function
|
|
|
|
; to that containing %G should likewise drop to null.
|
2010-04-28 20:16:12 +00:00
|
|
|
@G = internal global i8** null
|
|
|
|
|
|
|
|
define i32 @main(i32 %argc, i8** %argv) {
|
|
|
|
; CHECK: @main
|
|
|
|
; CHECK: %G = alloca
|
|
|
|
store i8** %argv, i8*** @G
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2010-05-04 12:43:36 +00:00
|
|
|
define void @foo(i32 %x) {
|
2010-05-04 20:09:25 +00:00
|
|
|
call void @llvm.foo(metadata !{i8*** @G, i32 %x})
|
|
|
|
; CHECK: call void @llvm.foo(metadata !{null, i32 %x})
|
2010-05-04 12:43:36 +00:00
|
|
|
ret void
|
|
|
|
}
|
2010-04-28 20:16:12 +00:00
|
|
|
|
2010-05-04 20:09:25 +00:00
|
|
|
declare void @llvm.foo(metadata) nounwind readnone
|
2010-04-28 20:16:12 +00:00
|
|
|
|
2010-05-04 12:43:36 +00:00
|
|
|
!named = !{!0}
|
2010-04-28 20:16:12 +00:00
|
|
|
|
2010-05-04 12:43:36 +00:00
|
|
|
!0 = metadata !{i8*** @G}
|
|
|
|
; CHECK: !0 = metadata !{null}
|