aboutsummaryrefslogtreecommitdiff
path: root/test/Verifier
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-04-22 14:58:02 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-04-22 14:58:02 +0000
commitcde25b435a907e7741da0c0d18953850936277c4 (patch)
tree30353631edc608810481f7ad09e5163c2826d3f6 /test/Verifier
parent2c55362848eab1a8552a31f8da1a47d17105b4d9 (diff)
Clarify that llvm.used can contain aliases.
Also add a check for llvm.used in the verifier and simplify clients now that they can assume they have a ConstantArray. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180019 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Verifier')
-rw-r--r--test/Verifier/llvm.used-invalid-init.ll6
-rw-r--r--test/Verifier/llvm.used-invalid-init2.ll7
-rw-r--r--test/Verifier/llvm.used-invalid-type.ll6
-rw-r--r--test/Verifier/llvm.used-invalid-type2.ll5
-rw-r--r--test/Verifier/llvm.used-ptr-type.ll4
5 files changed, 28 insertions, 0 deletions
diff --git a/test/Verifier/llvm.used-invalid-init.ll b/test/Verifier/llvm.used-invalid-init.ll
new file mode 100644
index 0000000000..b0887c994e
--- /dev/null
+++ b/test/Verifier/llvm.used-invalid-init.ll
@@ -0,0 +1,6 @@
+; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
+
+@llvm.used = appending global [1 x i8*] zeroinitializer, section "llvm.metadata"
+
+; CHECK: wrong initalizer for intrinsic global variable
+; CHECK-NEXT: [1 x i8*] zeroinitializer
diff --git a/test/Verifier/llvm.used-invalid-init2.ll b/test/Verifier/llvm.used-invalid-init2.ll
new file mode 100644
index 0000000000..ee8a970bf1
--- /dev/null
+++ b/test/Verifier/llvm.used-invalid-init2.ll
@@ -0,0 +1,7 @@
+; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
+
+@a = global i8 42
+@llvm.used = appending global [2 x i8*] [i8* @a, i8* null], section "llvm.metadata"
+
+; CHECK: invalid llvm.used member
+; CHECK-NEXT: i8* null
diff --git a/test/Verifier/llvm.used-invalid-type.ll b/test/Verifier/llvm.used-invalid-type.ll
new file mode 100644
index 0000000000..2de5c86fce
--- /dev/null
+++ b/test/Verifier/llvm.used-invalid-type.ll
@@ -0,0 +1,6 @@
+; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
+
+@llvm.used = appending global [1 x i32] [i32 0], section "llvm.metadata"
+
+; CHECK: wrong type for intrinsic global variable
+; CHECK-NEXT: [1 x i32]* @llvm.used
diff --git a/test/Verifier/llvm.used-invalid-type2.ll b/test/Verifier/llvm.used-invalid-type2.ll
new file mode 100644
index 0000000000..bff3f2d153
--- /dev/null
+++ b/test/Verifier/llvm.used-invalid-type2.ll
@@ -0,0 +1,5 @@
+; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
+@llvm.used = appending global i32 0, section "llvm.metadata"
+
+; CHECK: Only global arrays can have appending linkage!
+; CHEKC-NEXT: i32* @llvm.used
diff --git a/test/Verifier/llvm.used-ptr-type.ll b/test/Verifier/llvm.used-ptr-type.ll
new file mode 100644
index 0000000000..adfb1691d3
--- /dev/null
+++ b/test/Verifier/llvm.used-ptr-type.ll
@@ -0,0 +1,4 @@
+; RUN: llvm-as < %s -o /dev/null
+
+@a = global i32 42
+@llvm.used = appending global [1 x i32*] [i32* @a], section "llvm.metadata"