aboutsummaryrefslogtreecommitdiffstats
path: root/test/Verifier
diff options
context:
space:
mode:
authorDan Gohman <djg@cray.com>2007-07-18 16:29:46 +0000
committerDan Gohman <djg@cray.com>2007-07-18 16:29:46 +0000
commitf17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc (patch)
treeebb79ea1ee5e3bc1fdf38541a811a8b804f0679a /test/Verifier
downloadexternal_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.zip
external_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.tar.gz
external_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.tar.bz2
It's not necessary to do rounding for alloca operations when the requested
alignment is equal to the stack alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40004 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Verifier')
-rw-r--r--test/Verifier/2002-04-13-RetTypes.ll11
-rw-r--r--test/Verifier/2002-11-05-GetelementptrPointers.ll9
-rw-r--r--test/Verifier/2003-11-21-FunctionReturningStructure.ll7
-rw-r--r--test/Verifier/2004-05-21-SwitchConstantMismatch.ll13
-rw-r--r--test/Verifier/2005-03-21-UndefinedTypeReference.ll6
-rw-r--r--test/Verifier/2006-07-11-StoreStruct.ll11
-rw-r--r--test/Verifier/2006-10-15-AddrLabel.ll9
-rw-r--r--test/Verifier/2006-12-12-IntrinsicDefine.ll7
-rw-r--r--test/Verifier/AmbiguousPhi.ll10
-rw-r--r--test/Verifier/PhiGrouping.ll17
-rw-r--r--test/Verifier/README.txt3
-rw-r--r--test/Verifier/SelfReferential.ll11
-rw-r--r--test/Verifier/byval-1.ll2
-rw-r--r--test/Verifier/byval-2.ll2
-rw-r--r--test/Verifier/byval-3.ll2
-rw-r--r--test/Verifier/byval-4.ll4
-rw-r--r--test/Verifier/dg.exp3
-rw-r--r--test/Verifier/invoke-1.ll10
-rw-r--r--test/Verifier/invoke-2.ll13
19 files changed, 150 insertions, 0 deletions
diff --git a/test/Verifier/2002-04-13-RetTypes.ll b/test/Verifier/2002-04-13-RetTypes.ll
new file mode 100644
index 0000000..1ebed17
--- /dev/null
+++ b/test/Verifier/2002-04-13-RetTypes.ll
@@ -0,0 +1,11 @@
+; RUN: not llvm-as -f %s -o /dev/null
+
+; Verify the the operand type of the ret instructions in a function match the
+; delcared return type of the function they live in.
+;
+implementation
+
+uint "testfunc"()
+begin
+ ret int* null
+end
diff --git a/test/Verifier/2002-11-05-GetelementptrPointers.ll b/test/Verifier/2002-11-05-GetelementptrPointers.ll
new file mode 100644
index 0000000..d1e5169
--- /dev/null
+++ b/test/Verifier/2002-11-05-GetelementptrPointers.ll
@@ -0,0 +1,9 @@
+; RUN: not llvm-as -f %s -o /dev/null
+
+; This testcase is invalid because we are indexing into a pointer that is
+; contained WITHIN a structure.
+
+void %test({int, int*} * %X) {
+ getelementptr {int, int*} * %X, long 0, uint 1, long 0
+ ret void
+}
diff --git a/test/Verifier/2003-11-21-FunctionReturningStructure.ll b/test/Verifier/2003-11-21-FunctionReturningStructure.ll
new file mode 100644
index 0000000..e1d3ba8
--- /dev/null
+++ b/test/Verifier/2003-11-21-FunctionReturningStructure.ll
@@ -0,0 +1,7 @@
+; RUN: not llvm-as -f %s -o /dev/null
+
+
+%T = type { int }
+
+declare %T %test()
+
diff --git a/test/Verifier/2004-05-21-SwitchConstantMismatch.ll b/test/Verifier/2004-05-21-SwitchConstantMismatch.ll
new file mode 100644
index 0000000..e965c6d
--- /dev/null
+++ b/test/Verifier/2004-05-21-SwitchConstantMismatch.ll
@@ -0,0 +1,13 @@
+; RUN: not llvm-as -f %s -o /dev/null
+
+
+
+int %main() {
+start1:
+ switch uint 0, label %brt0 [int 3, label %brt1 ]
+brt0:
+ ret int 0
+brt1:
+ ret int 0
+}
+
diff --git a/test/Verifier/2005-03-21-UndefinedTypeReference.ll b/test/Verifier/2005-03-21-UndefinedTypeReference.ll
new file mode 100644
index 0000000..653eeec
--- /dev/null
+++ b/test/Verifier/2005-03-21-UndefinedTypeReference.ll
@@ -0,0 +1,6 @@
+; RUN: not llvm-as -f %s -o /dev/null
+void %test() {
+ malloc %InvalidType
+ ret void
+}
+
diff --git a/test/Verifier/2006-07-11-StoreStruct.ll b/test/Verifier/2006-07-11-StoreStruct.ll
new file mode 100644
index 0000000..31e2dd4
--- /dev/null
+++ b/test/Verifier/2006-07-11-StoreStruct.ll
@@ -0,0 +1,11 @@
+; RUN: not llvm-as %s -o /dev/null -f
+; PR826
+
+ %struct_4 = type { int }
+
+implementation ; Functions:
+
+void %test() {
+ store %struct_4 zeroinitializer, %struct_4* null
+ unreachable
+}
diff --git a/test/Verifier/2006-10-15-AddrLabel.ll b/test/Verifier/2006-10-15-AddrLabel.ll
new file mode 100644
index 0000000..173b0cf
--- /dev/null
+++ b/test/Verifier/2006-10-15-AddrLabel.ll
@@ -0,0 +1,9 @@
+; RUN: ignore llvm-as < %s > /dev/null |& \
+; RUN: grep {Cannot form a pointer to a basic block}
+
+define i32 @main() {
+ %foo = call i8* %llvm.stacksave()
+ %foop = bitcast i8* %foo to label*
+ %nret = load label* %foop
+ br label %nret;
+}
diff --git a/test/Verifier/2006-12-12-IntrinsicDefine.ll b/test/Verifier/2006-12-12-IntrinsicDefine.ll
new file mode 100644
index 0000000..a7fe274
--- /dev/null
+++ b/test/Verifier/2006-12-12-IntrinsicDefine.ll
@@ -0,0 +1,7 @@
+; RUN: not llvm-as < %s
+; PR1047
+
+void %llvm.memcpy.i32(sbyte*, sbyte*, uint, uint) {
+entry:
+ ret void
+}
diff --git a/test/Verifier/AmbiguousPhi.ll b/test/Verifier/AmbiguousPhi.ll
new file mode 100644
index 0000000..f64ec3f
--- /dev/null
+++ b/test/Verifier/AmbiguousPhi.ll
@@ -0,0 +1,10 @@
+; RUN: not llvm-as -f %s -o /dev/null
+
+
+
+int "test"(int %i, int %j, bool %c) {
+ br bool %c, label %A, label %A
+A:
+ %a = phi int [%i, %0], [%j, %0] ; Error, different values from same block!
+ ret int %a
+}
diff --git a/test/Verifier/PhiGrouping.ll b/test/Verifier/PhiGrouping.ll
new file mode 100644
index 0000000..aa1203b
--- /dev/null
+++ b/test/Verifier/PhiGrouping.ll
@@ -0,0 +1,17 @@
+; RUN: not llvm-as -f %s -o /dev/null
+
+
+
+int "test"(int %i, int %j, bool %c) {
+ br bool %c, label %A, label %B
+A:
+ br label %C
+B:
+ br label %C
+
+C:
+ %a = phi int [%i, %A], [%j, %B]
+ %x = add int %a, 0 ; Error, PHI's should be grouped!
+ %b = phi int [%i, %A], [%j, %B]
+ ret int %x
+}
diff --git a/test/Verifier/README.txt b/test/Verifier/README.txt
new file mode 100644
index 0000000..b7e96ea
--- /dev/null
+++ b/test/Verifier/README.txt
@@ -0,0 +1,3 @@
+This directory contains testcases that the verifier is supposed to detect as
+malformed LLVM code. Testcases for situations that the verifier incorrectly
+identifies as malformed should go in the Regressions/Assembler directory.
diff --git a/test/Verifier/SelfReferential.ll b/test/Verifier/SelfReferential.ll
new file mode 100644
index 0000000..1f7b837
--- /dev/null
+++ b/test/Verifier/SelfReferential.ll
@@ -0,0 +1,11 @@
+; RUN: not llvm-as -f %s -o /dev/null
+
+; Test that self referential instructions are not allowed
+
+implementation
+
+void "test"()
+begin
+ %A = add int %A, 0
+ ret void
+end
diff --git a/test/Verifier/byval-1.ll b/test/Verifier/byval-1.ll
new file mode 100644
index 0000000..cbae548
--- /dev/null
+++ b/test/Verifier/byval-1.ll
@@ -0,0 +1,2 @@
+; RUN: not llvm-as < %s -o /dev/null -f
+declare void @h(i32* byval %num)
diff --git a/test/Verifier/byval-2.ll b/test/Verifier/byval-2.ll
new file mode 100644
index 0000000..56b8a27
--- /dev/null
+++ b/test/Verifier/byval-2.ll
@@ -0,0 +1,2 @@
+; RUN: not llvm-as < %s -o /dev/null -f
+declare void @h(i32* %num) byval
diff --git a/test/Verifier/byval-3.ll b/test/Verifier/byval-3.ll
new file mode 100644
index 0000000..9c2cb98
--- /dev/null
+++ b/test/Verifier/byval-3.ll
@@ -0,0 +1,2 @@
+; RUN: not llvm-as < %s -o /dev/null -f
+declare void @h(i32 byval %num)
diff --git a/test/Verifier/byval-4.ll b/test/Verifier/byval-4.ll
new file mode 100644
index 0000000..ff733a5
--- /dev/null
+++ b/test/Verifier/byval-4.ll
@@ -0,0 +1,4 @@
+; RUN: llvm-as < %s -o /dev/null -f
+%struct.foo = type { i64 }
+
+declare void @h(%struct.foo* byval %num)
diff --git a/test/Verifier/dg.exp b/test/Verifier/dg.exp
new file mode 100644
index 0000000..879685c
--- /dev/null
+++ b/test/Verifier/dg.exp
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
diff --git a/test/Verifier/invoke-1.ll b/test/Verifier/invoke-1.ll
new file mode 100644
index 0000000..362f268
--- /dev/null
+++ b/test/Verifier/invoke-1.ll
@@ -0,0 +1,10 @@
+; RUN: not llvm-as < %s -o /dev/null -f
+; PR1042
+
+int %foo() {
+ %A = invoke int %foo( )
+ to label %L unwind label %L ; <int> [#uses=1]
+
+L: ; preds = %0, %0
+ ret int %A
+}
diff --git a/test/Verifier/invoke-2.ll b/test/Verifier/invoke-2.ll
new file mode 100644
index 0000000..b3a5750
--- /dev/null
+++ b/test/Verifier/invoke-2.ll
@@ -0,0 +1,13 @@
+; RUN: not llvm-as < %s -o /dev/null -f
+; PR1042
+
+int %foo() {
+ br bool false, label %L1, label %L2
+L1:
+ %A = invoke int %foo() to label %L unwind label %L
+
+L2:
+ br label %L
+L:
+ ret int %A
+}