A test case for the the ExitInMain libcall simplification.
authorReid Spencer <rspencer@reidspencer.com>
Mon, 25 Apr 2005 02:50:08 +0000 (02:50 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 25 Apr 2005 02:50:08 +0000 (02:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21521 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/SimplifyLibCalls/2005-04-24-ExitInMain.ll [new file with mode: 0644]
test/Transforms/SimplifyLibCalls/dg.exp [new file with mode: 0644]

diff --git a/test/Transforms/SimplifyLibCalls/2005-04-24-ExitInMain.ll b/test/Transforms/SimplifyLibCalls/2005-04-24-ExitInMain.ll
new file mode 100644 (file)
index 0000000..f33eac0
--- /dev/null
@@ -0,0 +1,13 @@
+; Test that the ExitInMainOptimization pass works correctly
+; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | grep -c 'ret int 3' | grep 1
+
+declare void "exit"(int)
+declare void "exitonly"(int)
+
+implementation   ; Functions:
+
+int "main"() {
+        call void "exitonly" ( int 3 )
+        call void "exit" ( int 3 )
+        ret int 0
+}
diff --git a/test/Transforms/SimplifyLibCalls/dg.exp b/test/Transforms/SimplifyLibCalls/dg.exp
new file mode 100644 (file)
index 0000000..e326ea7
--- /dev/null
@@ -0,0 +1,3 @@
+load_lib llvm-dg.exp
+
+llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext