1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

New testcases for bugs and the new DAE pass

llvm-svn: 6693
This commit is contained in:
Chris Lattner 2003-06-16 12:05:38 +00:00
parent 713b9542eb
commit 25e6231cd8
10 changed files with 147 additions and 0 deletions

View File

@ -0,0 +1,17 @@
struct foo {
int y;
foo();
};
struct bar : public foo {
//int x;
bar();
};
//int bar::X() { return 0; }
bar::bar() {
}

View File

@ -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() {
}

View File

@ -0,0 +1,8 @@
void bar();
void foo() {
struct TEST {
~TEST() { bar(); }
} TESTOBJ;
}

View File

@ -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"

View File

@ -0,0 +1,3 @@
%version = global [3 x sbyte] c"1\00\00"

View File

@ -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
}

View File

@ -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
}

View File

@ -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) $<

View File

@ -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
}

View File

@ -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
}