New testcases for bugs and the new DAE pass
authorChris Lattner <sabre@nondot.org>
Mon, 16 Jun 2003 12:05:38 +0000 (12:05 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 16 Jun 2003 12:05:38 +0000 (12:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6693 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
test/C++Frontend/2003-06-08-BaseType.cpp [new file with mode: 0644]
test/C++Frontend/2003-06-08-VirtualFunctions.cpp [new file with mode: 0644]
test/C++Frontend/2003-06-13-Crasher.cpp [new file with mode: 0644]
test/CBackend/2003-06-11-HexConstant.ll [new file with mode: 0644]
test/CBackend/2003-06-11-LiteralStringProblem.ll [new file with mode: 0644]
test/CodeGen/CBackend/2003-06-11-HexConstant.ll [new file with mode: 0644]
test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll [new file with mode: 0644]
test/Transforms/ADCE/2003-06-11-InvalidCFG.ll [new file with mode: 0644]
test/Transforms/DSAnalysis/physicalsubtype.ll [new file with mode: 0644]
test/Transforms/DeadArgElim/Makefile [new file with mode: 0644]
test/Transforms/DeadArgElim/basictest.ll [new file with mode: 0644]
test/Transforms/GCSE/2003-06-13-LoadStoreEliminate.ll [new file with mode: 0644]

diff --git a/test/C++Frontend/2003-06-08-BaseType.cpp b/test/C++Frontend/2003-06-08-BaseType.cpp
new file mode 100644 (file)
index 0000000..b78af2a
--- /dev/null
@@ -0,0 +1,17 @@
+
+
+struct foo {
+  int y;
+  foo();
+};
+
+struct bar : public foo {
+  //int x;
+  bar();
+};
+
+//int bar::X() { return 0; }
+
+bar::bar() {
+
+}
diff --git a/test/C++Frontend/2003-06-08-VirtualFunctions.cpp b/test/C++Frontend/2003-06-08-VirtualFunctions.cpp
new file mode 100644 (file)
index 0000000..ea32e19
--- /dev/null
@@ -0,0 +1,23 @@
+
+
+struct foo {
+  int y;
+  foo();
+  virtual int T() = 0;
+};
+
+struct bar : public foo {
+  //int x;
+  bar();
+  int T() {}
+};
+
+//int bar::X() { return 0; }
+
+foo::foo() : y(4) {
+
+}
+
+bar::bar() {
+
+}
diff --git a/test/C++Frontend/2003-06-13-Crasher.cpp b/test/C++Frontend/2003-06-13-Crasher.cpp
new file mode 100644 (file)
index 0000000..be581dd
--- /dev/null
@@ -0,0 +1,8 @@
+void bar();
+
+void foo() {
+         struct TEST {
+                 ~TEST() { bar(); }
+         } TESTOBJ;
+
+}
diff --git a/test/CBackend/2003-06-11-HexConstant.ll b/test/CBackend/2003-06-11-HexConstant.ll
new file mode 100644 (file)
index 0000000..31bbf88
--- /dev/null
@@ -0,0 +1,3 @@
+; Make sure hex constant does not continue into a valid hexadecimal letter/number
+%version = global [3 x sbyte] c"\001\00"
+
diff --git a/test/CBackend/2003-06-11-LiteralStringProblem.ll b/test/CBackend/2003-06-11-LiteralStringProblem.ll
new file mode 100644 (file)
index 0000000..80d8aea
--- /dev/null
@@ -0,0 +1,3 @@
+
+%version = global [3 x sbyte] c"1\00\00"
+
diff --git a/test/CodeGen/CBackend/2003-06-11-HexConstant.ll b/test/CodeGen/CBackend/2003-06-11-HexConstant.ll
new file mode 100644 (file)
index 0000000..31bbf88
--- /dev/null
@@ -0,0 +1,3 @@
+; Make sure hex constant does not continue into a valid hexadecimal letter/number
+%version = global [3 x sbyte] c"\001\00"
+
diff --git a/test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll b/test/CodeGen/CBackend/2003-06-11-LiteralStringProblem.ll
new file mode 100644 (file)
index 0000000..80d8aea
--- /dev/null
@@ -0,0 +1,3 @@
+
+%version = global [3 x sbyte] c"1\00\00"
+
diff --git a/test/Transforms/ADCE/2003-06-11-InvalidCFG.ll b/test/Transforms/ADCE/2003-06-11-InvalidCFG.ll
new file mode 100644 (file)
index 0000000..036b114
--- /dev/null
@@ -0,0 +1,28 @@
+; RUN: as < %s | opt -adce -disable-output
+%G = external global int*
+
+implementation   ; Functions:
+
+declare void %Fn(int*)
+
+int %main(int %argc.1, sbyte** %argv.1) {
+entry:         ; No predecessors!
+       br label %endif.42
+
+endif.42:              ; preds = %entry, %shortcirc_done.12, %then.66, %endif.42
+       br bool false, label %endif.65, label %endif.42
+       
+then.66:               ; preds = %shortcirc_done.12
+       call void %Fn( int* %tmp.2846)
+       br label %endif.42
+
+endif.65:              ; preds = %endif.42
+       %tmp.2846 = load int** %G
+       br bool false, label %shortcirc_next.12, label %shortcirc_done.12
+
+shortcirc_next.12:             ; preds = %endif.65
+       br label %shortcirc_done.12
+
+shortcirc_done.12:             ; preds = %endif.65, %shortcirc_next.12
+       br bool false, label %then.66, label %endif.42
+}
diff --git a/test/Transforms/DSAnalysis/physicalsubtype.ll b/test/Transforms/DSAnalysis/physicalsubtype.ll
new file mode 100644 (file)
index 0000000..cdda0d5
--- /dev/null
@@ -0,0 +1,14 @@
+; A test for "physical subtyping" used in some C programs...
+;
+%ST = type { int, int* }            ; "Subtype"
+%DT = type { int, int*, int }       ; "derived type"
+
+int %test(%DT* %DT) {
+       %DTp = getelementptr %DT* %DT, long 0, ubyte 0
+       %A = load int* %DTp
+       %ST = cast %DT* %DT to %ST*
+       %STp = getelementptr %ST* %ST, long 0, ubyte 0
+       %B = load int* %STp
+       %C = sub int %A, %B         ; A & B are equal, %C = 0
+       ret int %C
+}
diff --git a/test/Transforms/DeadArgElim/Makefile b/test/Transforms/DeadArgElim/Makefile
new file mode 100644 (file)
index 0000000..91acd4d
--- /dev/null
@@ -0,0 +1,10 @@
+
+LEVEL = ../../../..
+include $(LEVEL)/test/Makefile.tests
+
+TESTS := $(wildcard *.ll)
+
+all:: $(addprefix Output/, $(TESTS:%.ll=%.ll.out))
+
+Output/%.ll.out: %.ll Output/.dir $(LOPT)
+       -$(TESTRUNR) $<
diff --git a/test/Transforms/DeadArgElim/basictest.ll b/test/Transforms/DeadArgElim/basictest.ll
new file mode 100644 (file)
index 0000000..8d70f53
--- /dev/null
@@ -0,0 +1,27 @@
+; RUN: if as < %s | opt -load ~/llvm/lib/Debug/libhello.so -deadargelim | dis | grep DEADARG
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+implementation
+
+; test - an obviously dead argument
+internal int %test(int %v, int %DEADARG1, int* %p) {
+       store int %v, int* %p
+       ret int %v
+}
+
+; hardertest - an argument which is only used by a call of a function with a 
+; dead argument.
+internal int %hardertest(int %DEADARG2) {
+       %p = alloca int
+       %V = call int %test(int 5, int %DEADARG2, int* %p)
+       ret int %V
+}
+
+; evenhardertest - recursive dead argument...
+internal void %evenhardertest(int %DEADARG3) {
+       call void %evenhardertest(int %DEADARG3)
+       ret void
+}
+
diff --git a/test/Transforms/GCSE/2003-06-13-LoadStoreEliminate.ll b/test/Transforms/GCSE/2003-06-13-LoadStoreEliminate.ll
new file mode 100644 (file)
index 0000000..77a087a
--- /dev/null
@@ -0,0 +1,14 @@
+; This testcase shows a bug where an common subexpression exists, but there
+; is no shared dominator block that the expression can be hoisted out to.
+;
+; RUN: if as < %s | opt -load-vn -gcse | dis | grep load
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+int %test(int* %P) {
+       store int 5, int* %P
+       %Z = load int* %P
+        ret int %Z
+}
+