aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-05-04 12:43:36 +0000
committerDuncan Sands <baldrick@free.fr>2010-05-04 12:43:36 +0000
commit203f7cb68b6c509b388d1662d8439693f75bb964 (patch)
tree682e419c5bf8666129f76bd20da9577d22fcb226 /test
parent2f256f45612fe86f20d6439b917fbc3662e20f02 (diff)
downloadexternal_llvm-203f7cb68b6c509b388d1662d8439693f75bb964.zip
external_llvm-203f7cb68b6c509b388d1662d8439693f75bb964.tar.gz
external_llvm-203f7cb68b6c509b388d1662d8439693f75bb964.tar.bz2
Fix a variant of PR6112 found by thinking about it: when doing
RAUW of a global variable with a local variable in function F, if function local metadata M in function G was using the global then M would become function-local to both F and G, which is not allowed. See the testcase for an example. Fixed by detecting this situation and zapping the metadata operand when it occurs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103007 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/GlobalOpt/metadata.ll16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/Transforms/GlobalOpt/metadata.ll b/test/Transforms/GlobalOpt/metadata.ll
index a09ba72..d5521bf 100644
--- a/test/Transforms/GlobalOpt/metadata.ll
+++ b/test/Transforms/GlobalOpt/metadata.ll
@@ -1,7 +1,8 @@
; RUN: opt -S -globalopt < %s | FileCheck %s
; PR6112 - When globalopt does RAUW(@G, %G), the metadata reference should drop
-; to null.
+; to null. Function local metadata that references @G from a different function
+; to that containing %G should likewise drop to null.
@G = internal global i8** null
define i32 @main(i32 %argc, i8** %argv) {
@@ -11,9 +12,16 @@ define i32 @main(i32 %argc, i8** %argv) {
ret i32 0
}
-!named = !{!0}
+define void @foo(i32 %x) {
+ call void @llvm.dbg.value(metadata !{i8*** @G, i32 %x}, i64 0, metadata !1)
+; CHECK: call void @llvm.dbg.value(metadata !{null, i32 %x}, i64 0, metadata !1)
+ ret void
+}
-; CHECK: !0 = metadata !{null}
-!0 = metadata !{i8*** @G}
+declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
+!named = !{!0}
+!0 = metadata !{i8*** @G}
+; CHECK: !0 = metadata !{null}
+!1 = metadata !{i8* null}