2010-04-29 00:34:35 +02:00
|
|
|
; RUN: opt -S -globalopt < %s | FileCheck %s
|
2010-04-28 22:16:12 +02:00
|
|
|
|
|
|
|
; PR6112 - When globalopt does RAUW(@G, %G), the metadata reference should drop
|
2010-05-04 14:43:36 +02: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 22:16:12 +02:00
|
|
|
@G = internal global i8** null
|
|
|
|
|
|
|
|
define i32 @main(i32 %argc, i8** %argv) {
|
2013-07-14 03:42:54 +02:00
|
|
|
; CHECK-LABEL: @main(
|
2010-04-28 22:16:12 +02:00
|
|
|
; CHECK: %G = alloca
|
|
|
|
store i8** %argv, i8*** @G
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2010-05-04 14:43:36 +02:00
|
|
|
define void @foo(i32 %x) {
|
2010-05-04 22:09:25 +02:00
|
|
|
call void @llvm.foo(metadata !{i8*** @G, i32 %x})
|
|
|
|
; CHECK: call void @llvm.foo(metadata !{null, i32 %x})
|
2010-05-04 14:43:36 +02:00
|
|
|
ret void
|
|
|
|
}
|
2010-04-28 22:16:12 +02:00
|
|
|
|
2010-05-04 22:09:25 +02:00
|
|
|
declare void @llvm.foo(metadata) nounwind readnone
|
2010-04-28 22:16:12 +02:00
|
|
|
|
2010-05-04 14:43:36 +02:00
|
|
|
!named = !{!0}
|
2010-04-28 22:16:12 +02:00
|
|
|
|
2010-05-04 14:43:36 +02:00
|
|
|
!0 = metadata !{i8*** @G}
|
|
|
|
; CHECK: !0 = metadata !{null}
|