blob: 730e2b080236226a1092a24d3858c867c285b5a8 [file] [log] [blame]
Chris Lattnerc1c45952010-04-28 22:34:35 +00001; RUN: opt -S -globalopt < %s | FileCheck %s
Chris Lattnerf3f325b2010-04-28 20:16:12 +00002
3; PR6112 - When globalopt does RAUW(@G, %G), the metadata reference should drop
Duncan Sands203f7cb2010-05-04 12:43:36 +00004; to null. Function local metadata that references @G from a different function
5; to that containing %G should likewise drop to null.
Chris Lattnerf3f325b2010-04-28 20:16:12 +00006@G = internal global i8** null
7
8define i32 @main(i32 %argc, i8** %argv) {
9; CHECK: @main
10; CHECK: %G = alloca
11 store i8** %argv, i8*** @G
12 ret i32 0
13}
14
Duncan Sands203f7cb2010-05-04 12:43:36 +000015define void @foo(i32 %x) {
Duncan Sands55cd6cb2010-05-04 20:09:25 +000016 call void @llvm.foo(metadata !{i8*** @G, i32 %x})
17; CHECK: call void @llvm.foo(metadata !{null, i32 %x})
Duncan Sands203f7cb2010-05-04 12:43:36 +000018 ret void
19}
20
Duncan Sands55cd6cb2010-05-04 20:09:25 +000021declare void @llvm.foo(metadata) nounwind readnone
Duncan Sands203f7cb2010-05-04 12:43:36 +000022
Chris Lattnerf3f325b2010-04-28 20:16:12 +000023!named = !{!0}
24
Chris Lattnerf3f325b2010-04-28 20:16:12 +000025!0 = metadata !{i8*** @G}
Duncan Sands203f7cb2010-05-04 12:43:36 +000026; CHECK: !0 = metadata !{null}