[llvm-commits] [poolalloc] r106177 - in /poolalloc/trunk/test/var_arg: ./ basic.c dg.exp multiple_callee.c
Will Dietz
wdietz2 at illinois.edu
Wed Jun 16 16:49:36 PDT 2010
Author: wdietz2
Date: Wed Jun 16 18:49:35 2010
New Revision: 106177
URL: http://llvm.org/viewvc/llvm-project?rev=106177&view=rev
Log:
poolalloc: added basic var_arg tests
Added:
poolalloc/trunk/test/var_arg/
poolalloc/trunk/test/var_arg/basic.c
poolalloc/trunk/test/var_arg/dg.exp
poolalloc/trunk/test/var_arg/multiple_callee.c
Added: poolalloc/trunk/test/var_arg/basic.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/var_arg/basic.c?rev=106177&view=auto
==============================================================================
--- poolalloc/trunk/test/var_arg/basic.c (added)
+++ poolalloc/trunk/test/var_arg/basic.c Wed Jun 16 18:49:35 2010
@@ -0,0 +1,33 @@
+#include <stdarg.h>
+#include <stdio.h>
+//This is a basic use of vararg pointer use
+
+//--build the code into a .bc
+//RUN: llvm-gcc -O0 %s -S --emit-llvm -o - | llvm-as > %t.bc
+//--check if ds-aa breaks, breaks opts, or results in miscompiled code
+//RUN: dsaopt %t.bc -ds-aa -O3 -o - | lli -force-interpreter > %t.out1
+//RUN: opt %t.bc -O3 -o - | lli -force-interpreter > %t.out2
+//RUN: diff %t.out1 %t.out2
+//--check properties of this particular test
+//N/A
+
+static int get( int unused, ... )
+{
+ va_list ap;
+ va_start( ap, unused );
+
+ int *val = va_arg( ap, int* );
+
+ va_end( ap );
+
+ return *val;
+}
+
+int main()
+{
+ int stack_val = 5;
+
+ int ret = get( 0, &stack_val );
+
+ return ret;
+}
Added: poolalloc/trunk/test/var_arg/dg.exp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/var_arg/dg.exp?rev=106177&view=auto
==============================================================================
--- poolalloc/trunk/test/var_arg/dg.exp (added)
+++ poolalloc/trunk/test/var_arg/dg.exp Wed Jun 16 18:49:35 2010
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
Added: poolalloc/trunk/test/var_arg/multiple_callee.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/var_arg/multiple_callee.c?rev=106177&view=auto
==============================================================================
--- poolalloc/trunk/test/var_arg/multiple_callee.c (added)
+++ poolalloc/trunk/test/var_arg/multiple_callee.c Wed Jun 16 18:49:35 2010
@@ -0,0 +1,54 @@
+#include <stdarg.h>
+//This tests having multiple parameters
+
+//What to check:
+//'val' should alias stack_val and stack_val2
+//'p1' and 'p2' should alias
+//'p1' and 'p2' should be modref'd by assign
+//(accordingly stack_val/stack_val2 are modref'd)
+//
+//--build the code into a .bc
+//RUN: llvm-gcc -O0 %s -S --emit-llvm -o - | llvm-as > %t.bc
+//--check if ds-aa breaks, breaks opts, or results in miscompiled code
+//RUN: lli -force-interpreter %t.bc > %t.refout
+//RUN: dsaopt %t.bc -ds-aa -O3 -o - | lli -force-interpreter > %t.out
+//RUN: diff %t.refout %t.out
+//--check properties of this particular test
+//N/A
+
+static int assign( int count, ... )
+{
+ va_list ap;
+ va_start( ap, count );
+
+ int sum = 0;
+ int i = 1;
+ int ** old = va_arg( ap, int** );
+ for ( ; i < count; ++i )
+ {
+ int **val = va_arg( ap, int** );
+ *old = *val;
+ old = val;
+ }
+
+ va_end( ap );
+
+ return sum;
+}
+
+int main()
+{
+ int stack_val = 5;
+ int stack_val2 = 10;
+
+ int * p1 = &stack_val;
+ int * p2 = &stack_val2;
+
+ assign( 2, &p1, &p2 );
+
+ if ( p1 != &stack_val || p2 != &stack_val2 )
+ {
+ return -1;
+ }
+ return 0;
+}
More information about the llvm-commits
mailing list