Initial checkin of testcases for Pi node inserter
authorChris Lattner <sabre@nondot.org>
Fri, 10 May 2002 05:38:18 +0000 (05:38 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 10 May 2002 05:38:18 +0000 (05:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2590 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/PiNodeInserter/Makefile [new file with mode: 0644]
test/Transforms/PiNodeInserter/substitutetest.ll [new file with mode: 0644]
test/Transforms/PiNodeInserter/test.ll [new file with mode: 0644]

diff --git a/test/Transforms/PiNodeInserter/Makefile b/test/Transforms/PiNodeInserter/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/PiNodeInserter/substitutetest.ll b/test/Transforms/PiNodeInserter/substitutetest.ll
new file mode 100644 (file)
index 0000000..2c103b9
--- /dev/null
@@ -0,0 +1,16 @@
+; RUN: if as < %s | opt -pinodes -instcombine -die | dis | grep add
+; RUN: then exit 1
+; RUN: else exit 0
+; RUN: fi
+
+int "test"(int %i, int %j) {
+       %c = seteq int %i, 0
+       br bool %c, label %iIsZero, label %iIsNotZero
+
+iIsZero:
+       %j2 = add int %j, %i      ; This is always equal to j
+       ret int %j2
+
+iIsNotZero:
+       ret int 1
+}
diff --git a/test/Transforms/PiNodeInserter/test.ll b/test/Transforms/PiNodeInserter/test.ll
new file mode 100644 (file)
index 0000000..5b0e545
--- /dev/null
@@ -0,0 +1,17 @@
+
+int "test"(int %i) {
+       %c = seteq int %i, 0
+       br bool %c, label %iIsZero, label %iIsNotZero
+
+iIsZero:
+       ret int %i
+
+iIsZero2:
+       ret int 0
+iIsNotZero:
+       %d = setne int %i, 0
+       br bool %d, label %Quit, label %iIsZero2
+
+Quit:
+       ret int 1
+}