When removing a function from the function set and adding it to deferred, we
[llvm.git] / test / Transforms / GlobalOpt / metadata.ll
blob730e2b080236226a1092a24d3858c867c285b5a8
1 ; RUN: opt -S -globalopt < %s | FileCheck %s
3 ; PR6112 - When globalopt does RAUW(@G, %G), the metadata reference should drop
4 ; to null.  Function local metadata that references @G from a different function
5 ; to that containing %G should likewise drop to null.
6 @G = internal global i8** null
8 define i32 @main(i32 %argc, i8** %argv) {
9 ; CHECK: @main
10 ; CHECK: %G = alloca
11   store i8** %argv, i8*** @G
12   ret i32 0
15 define void @foo(i32 %x) {
16   call void @llvm.foo(metadata !{i8*** @G, i32 %x})
17 ; CHECK: call void @llvm.foo(metadata !{null, i32 %x})
18   ret void
21 declare void @llvm.foo(metadata) nounwind readnone
23 !named = !{!0}
25 !0 = metadata !{i8*** @G}
26 ; CHECK: !0 = metadata !{null}