[llvm-commits] [poolalloc] r112599 - in /poolalloc/trunk/test/dsa/td: ./ call.c call.ll call1.c call1.ll call2.c call2.ll dg.exp params.c params.ll params1.c params1.ll params2.ll recur.c recur.ll recur1.c recur1.ll recur2.c recur2.ll recur3.c testcase.c testcase.ll
Arushi Aggarwal
aggarwa4 at illinois.edu
Tue Aug 31 07:37:24 PDT 2010
Author: aggarwa4
Date: Tue Aug 31 09:37:24 2010
New Revision: 112599
URL: http://llvm.org/viewvc/llvm-project?rev=112599&view=rev
Log:
More Tests
Added:
poolalloc/trunk/test/dsa/td/
poolalloc/trunk/test/dsa/td/call.c
poolalloc/trunk/test/dsa/td/call.ll
poolalloc/trunk/test/dsa/td/call1.c
poolalloc/trunk/test/dsa/td/call1.ll
poolalloc/trunk/test/dsa/td/call2.c
poolalloc/trunk/test/dsa/td/call2.ll
poolalloc/trunk/test/dsa/td/dg.exp
poolalloc/trunk/test/dsa/td/params.c
poolalloc/trunk/test/dsa/td/params.ll
poolalloc/trunk/test/dsa/td/params1.c
poolalloc/trunk/test/dsa/td/params1.ll
poolalloc/trunk/test/dsa/td/params2.ll
poolalloc/trunk/test/dsa/td/recur.c
poolalloc/trunk/test/dsa/td/recur.ll
poolalloc/trunk/test/dsa/td/recur1.c
poolalloc/trunk/test/dsa/td/recur1.ll
poolalloc/trunk/test/dsa/td/recur2.c
poolalloc/trunk/test/dsa/td/recur2.ll
poolalloc/trunk/test/dsa/td/recur3.c
poolalloc/trunk/test/dsa/td/testcase.c
poolalloc/trunk/test/dsa/td/testcase.ll
Added: poolalloc/trunk/test/dsa/td/call.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/call.c?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/call.c (added)
+++ poolalloc/trunk/test/dsa/td/call.c Tue Aug 31 09:37:24 2010
@@ -0,0 +1,27 @@
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+
+#include <stdlib.h>
+
+
+int* test() {
+ int* a2 = (int*)malloc(sizeof(int));
+ *a2 = 10;
+
+ if(*a2 > 5 ) {
+ return a2;
+ }
+
+ int *b2 = (int*)malloc(sizeof(int));
+ return b2;
+
+}
+
+void func() {
+
+ int *a1 = test();
+ int *b1 = test();
+}
+
Added: poolalloc/trunk/test/dsa/td/call.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/call.ll?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/call.ll (added)
+++ poolalloc/trunk/test/dsa/td/call.ll Tue Aug 31 09:37:24 2010
@@ -0,0 +1,66 @@
+
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:a1:0+I"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:b1:0+I"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:a1:0+HMR-I"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:b1:0+HMR-I"
+
+; ModuleID = 'call.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32* @test() nounwind {
+entry:
+ %retval = alloca i32* ; <i32**> [#uses=2]
+ %0 = alloca i32* ; <i32**> [#uses=3]
+ %a2 = alloca i32* ; <i32**> [#uses=4]
+ %b2 = alloca i32* ; <i32**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %1 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %2 = bitcast i8* %1 to i32* ; <i32*> [#uses=1]
+ store i32* %2, i32** %a2, align 8
+ %3 = load i32** %a2, align 8 ; <i32*> [#uses=1]
+ store i32 10, i32* %3, align 4
+ %4 = load i32** %a2, align 8 ; <i32*> [#uses=1]
+ %5 = load i32* %4, align 4 ; <i32> [#uses=1]
+ %6 = icmp sgt i32 %5, 5 ; <i1> [#uses=1]
+ br i1 %6, label %bb, label %bb1
+
+bb: ; preds = %entry
+ %7 = load i32** %a2, align 8 ; <i32*> [#uses=1]
+ store i32* %7, i32** %0, align 8
+ br label %bb2
+
+bb1: ; preds = %entry
+ %8 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %9 = bitcast i8* %8 to i32* ; <i32*> [#uses=1]
+ store i32* %9, i32** %b2, align 8
+ %10 = load i32** %b2, align 8 ; <i32*> [#uses=1]
+ store i32* %10, i32** %0, align 8
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %11 = load i32** %0, align 8 ; <i32*> [#uses=1]
+ store i32* %11, i32** %retval, align 8
+ br label %return
+
+return: ; preds = %bb2
+ %retval3 = load i32** %retval ; <i32*> [#uses=1]
+ ret i32* %retval3
+}
+
+declare noalias i8* @malloc(i64) nounwind
+
+define void @func() nounwind {
+entry:
+ %a1 = alloca i32* ; <i32**> [#uses=1]
+ %b1 = alloca i32* ; <i32**> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %0, i32** %a1, align 8
+ %1 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %1, i32** %b1, align 8
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
Added: poolalloc/trunk/test/dsa/td/call1.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/call1.c?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/call1.c (added)
+++ poolalloc/trunk/test/dsa/td/call1.c Tue Aug 31 09:37:24 2010
@@ -0,0 +1,24 @@
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+
+#include <stdlib.h>
+
+int* test(int **a2, int **b2) {
+ int *temp;
+ temp = *a2;
+ a2 = b2;
+ *b2 = temp;
+
+ return *a2;
+}
+
+void func() {
+
+ int* mem1 = (int *)malloc(sizeof(int));
+ int* mem2 = (int *)malloc(sizeof(int));
+ int *a1 = test(&mem1, &mem2);
+ int *b1 = test(&mem2, &mem1);
+}
+
Added: poolalloc/trunk/test/dsa/td/call1.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/call1.ll?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/call1.ll (added)
+++ poolalloc/trunk/test/dsa/td/call1.ll Tue Aug 31 09:37:24 2010
@@ -0,0 +1,76 @@
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:b2:0+I"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:b2:0+IHM"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:a2:0+I"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:a2:0+IHM"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:a2+IMRE"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:a2+SIMRE"
+
+
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:a1+SM"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:a1+SM"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:b1+SM"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:b1+SM"
+;RUN: dsaopt %s -dsa-td -analyze -check-same-node=func:mem1,func:mem2
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:mem1:0+HI"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:mem2:0+HI"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:mem1:0+HM"
+
+
+; ModuleID = 'call1.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32* @test(i32** %a2, i32** %b2) nounwind {
+entry:
+ %a2_addr = alloca i32** ; <i32***> [#uses=4]
+ %b2_addr = alloca i32** ; <i32***> [#uses=3]
+ %retval = alloca i32* ; <i32**> [#uses=2]
+ %0 = alloca i32* ; <i32**> [#uses=2]
+ %temp = alloca i32* ; <i32**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32** %a2, i32*** %a2_addr
+ store i32** %b2, i32*** %b2_addr
+ %1 = load i32*** %a2_addr, align 8 ; <i32**> [#uses=1]
+ %2 = load i32** %1, align 8 ; <i32*> [#uses=1]
+ store i32* %2, i32** %temp, align 8
+ %3 = load i32*** %b2_addr, align 8 ; <i32**> [#uses=1]
+ store i32** %3, i32*** %a2_addr, align 8
+ %4 = load i32*** %b2_addr, align 8 ; <i32**> [#uses=1]
+ %5 = load i32** %temp, align 8 ; <i32*> [#uses=1]
+ store i32* %5, i32** %4, align 8
+ %6 = load i32*** %a2_addr, align 8 ; <i32**> [#uses=1]
+ %7 = load i32** %6, align 8 ; <i32*> [#uses=1]
+ store i32* %7, i32** %0, align 8
+ %8 = load i32** %0, align 8 ; <i32*> [#uses=1]
+ store i32* %8, i32** %retval, align 8
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32** %retval ; <i32*> [#uses=1]
+ ret i32* %retval1
+}
+
+define void @func() nounwind {
+entry:
+ %mem1 = alloca i32* ; <i32**> [#uses=3]
+ %mem2 = alloca i32* ; <i32**> [#uses=3]
+ %a1 = alloca i32* ; <i32**> [#uses=1]
+ %b1 = alloca i32* ; <i32**> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %1 = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
+ store i32* %1, i32** %mem1, align 8
+ %2 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %3 = bitcast i8* %2 to i32* ; <i32*> [#uses=1]
+ store i32* %3, i32** %mem2, align 8
+ %4 = call i32* @test(i32** %mem1, i32** %mem2) nounwind ; <i32*> [#uses=1]
+ store i32* %4, i32** %a1, align 8
+ %5 = call i32* @test(i32** %mem2, i32** %mem1) nounwind ; <i32*> [#uses=1]
+ store i32* %5, i32** %b1, align 8
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+declare noalias i8* @malloc(i64) nounwind
Added: poolalloc/trunk/test/dsa/td/call2.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/call2.c?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/call2.c (added)
+++ poolalloc/trunk/test/dsa/td/call2.c Tue Aug 31 09:37:24 2010
@@ -0,0 +1,24 @@
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+
+#include <stdlib.h>
+
+int* test(int **a2, int **b2) {
+ int *temp;
+ temp = *a2;
+ a2 = b2;
+ *b2 = temp;
+
+ return *a2;
+}
+
+void func() {
+
+ int* mem1 = (int *)malloc(sizeof(int));
+ int* mem2 = (int *)malloc(sizeof(int));
+ int *a1 = test(&mem1, &mem2);
+ int *b1 = test(&mem1, &mem2);
+}
+
Added: poolalloc/trunk/test/dsa/td/call2.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/call2.ll?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/call2.ll (added)
+++ poolalloc/trunk/test/dsa/td/call2.ll Tue Aug 31 09:37:24 2010
@@ -0,0 +1,75 @@
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:b2:0+I"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:b2:0+IHM"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:a2:0+I"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:a2:0+IHM"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:a2+IMRE"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:a2+SIMRE"
+
+
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:a1+SM"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:a1+SM"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:b1+SM"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:b1+SM"
+;RUN: dsaopt %s -dsa-td -analyze -check-same-node=func:mem1,func:mem2
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:mem1:0+HI"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:mem2:0+HI"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:mem1:0+HM"
+
+; ModuleID = 'call2.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32* @test(i32** %a2, i32** %b2) nounwind {
+entry:
+ %a2_addr = alloca i32** ; <i32***> [#uses=4]
+ %b2_addr = alloca i32** ; <i32***> [#uses=3]
+ %retval = alloca i32* ; <i32**> [#uses=2]
+ %0 = alloca i32* ; <i32**> [#uses=2]
+ %temp = alloca i32* ; <i32**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32** %a2, i32*** %a2_addr
+ store i32** %b2, i32*** %b2_addr
+ %1 = load i32*** %a2_addr, align 8 ; <i32**> [#uses=1]
+ %2 = load i32** %1, align 8 ; <i32*> [#uses=1]
+ store i32* %2, i32** %temp, align 8
+ %3 = load i32*** %b2_addr, align 8 ; <i32**> [#uses=1]
+ store i32** %3, i32*** %a2_addr, align 8
+ %4 = load i32*** %b2_addr, align 8 ; <i32**> [#uses=1]
+ %5 = load i32** %temp, align 8 ; <i32*> [#uses=1]
+ store i32* %5, i32** %4, align 8
+ %6 = load i32*** %a2_addr, align 8 ; <i32**> [#uses=1]
+ %7 = load i32** %6, align 8 ; <i32*> [#uses=1]
+ store i32* %7, i32** %0, align 8
+ %8 = load i32** %0, align 8 ; <i32*> [#uses=1]
+ store i32* %8, i32** %retval, align 8
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32** %retval ; <i32*> [#uses=1]
+ ret i32* %retval1
+}
+
+define void @func() nounwind {
+entry:
+ %mem1 = alloca i32* ; <i32**> [#uses=3]
+ %mem2 = alloca i32* ; <i32**> [#uses=3]
+ %a1 = alloca i32* ; <i32**> [#uses=1]
+ %b1 = alloca i32* ; <i32**> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %1 = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
+ store i32* %1, i32** %mem1, align 8
+ %2 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %3 = bitcast i8* %2 to i32* ; <i32*> [#uses=1]
+ store i32* %3, i32** %mem2, align 8
+ %4 = call i32* @test(i32** %mem1, i32** %mem2) nounwind ; <i32*> [#uses=1]
+ store i32* %4, i32** %a1, align 8
+ %5 = call i32* @test(i32** %mem1, i32** %mem2) nounwind ; <i32*> [#uses=1]
+ store i32* %5, i32** %b1, align 8
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+declare noalias i8* @malloc(i64) nounwind
Added: poolalloc/trunk/test/dsa/td/dg.exp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/dg.exp?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/dg.exp (added)
+++ poolalloc/trunk/test/dsa/td/dg.exp Tue Aug 31 09:37:24 2010
@@ -0,0 +1,3 @@
+load_lib llvm.exp
+
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,cpp}]]
Added: poolalloc/trunk/test/dsa/td/params.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/params.c?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/params.c (added)
+++ poolalloc/trunk/test/dsa/td/params.c Tue Aug 31 09:37:24 2010
@@ -0,0 +1,33 @@
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+
+#include <stdlib.h>
+
+int* test(int **a2, int **b2) {
+ int *temp = *a2;
+ int *temp1 = *b2;
+ if(*temp1 < *temp) {
+ return *b2;
+ }
+ else {
+ int *temp2 = (int*)malloc(sizeof(int));
+ a2 = &temp2;
+ }
+
+ return *a2;
+}
+
+void func() {
+
+ int* mem1;
+ int* mem2;
+ int r1 = 5;
+ int r2 = 6;
+ mem1 = &r1;
+ mem2 = &r2;
+ int *a1 = test(&mem1, &mem2);
+ int *b1 = test(&mem2, &mem1);
+}
+
Added: poolalloc/trunk/test/dsa/td/params.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/params.ll?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/params.ll (added)
+++ poolalloc/trunk/test/dsa/td/params.ll Tue Aug 31 09:37:24 2010
@@ -0,0 +1,122 @@
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:mem1:0+SIM"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:mem2:0+SIM"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:a1+SM"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:b1+SM"
+
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "func:mem1:0+SHMR"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "func:mem2:0+SHMR"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "func:a1+SM"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "func:b1+SM"
+
+;RUN: dsaopt %s -dsa-bu -analyze -check-same-node=func:a1:0,func:b1:0,func:mem2:0,func:mem1:0,func:r1,func:r2
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:mem1:0+SHMR"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:mem2:0+SHMR"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:a1+SM"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:b1+SM"
+
+;RUN: dsaopt %s -dsa-td -analyze -check-same-node=func:a1:0,func:b1:0,func:mem2:0,func:mem1:0,func:r1,func:r2
+
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:b2:0+HIR"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:a2:0+HIR"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:a2+SIMRE"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:temp:0+HIR"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:temp1:0+HIR"
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=test:temp2:0,test:a2:0,test:temp1:0,test:temp:0,test:b2:0
+
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "test:b2:0+HIMR"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "test:a2:0+HIMR"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "test:a2+SIMRE"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "test:temp+SMR"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "test:temp1+SMR"
+;RUN: dsaopt %s -dsa-bu -analyze -check-same-node=test:temp2:0,test:a2:0,test:temp1:0,test:temp:0,test:b2:0
+;RUN: dsaopt %s -dsa-bu -analyze -check-same-node=test:a2,test:temp2
+
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:b2:0+SHIMR"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:a2:0+SHIMR"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:a2+SIMRE"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:temp+SMR"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:temp1+SMR"
+;RUN: dsaopt %s -dsa-td -analyze -check-same-node=test:temp2:0,test:a2:0,test:temp1:0,test:temp:0,test:b2:0
+;RUN: dsaopt %s -dsa-td -analyze -check-same-node=test:a2,test:b2,test:temp2
+
+; ModuleID = 'params.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32* @test(i32** %a2, i32** %b2) nounwind {
+entry:
+ %a2_addr = alloca i32** ; <i32***> [#uses=4]
+ %b2_addr = alloca i32** ; <i32***> [#uses=3]
+ %retval = alloca i32* ; <i32**> [#uses=2]
+ %0 = alloca i32* ; <i32**> [#uses=3]
+ %temp = alloca i32* ; <i32**> [#uses=2]
+ %temp1 = alloca i32* ; <i32**> [#uses=2]
+ %temp2 = alloca i32* ; <i32**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32** %a2, i32*** %a2_addr
+ store i32** %b2, i32*** %b2_addr
+ %1 = load i32*** %a2_addr, align 8 ; <i32**> [#uses=1]
+ %2 = load i32** %1, align 8 ; <i32*> [#uses=1]
+ store i32* %2, i32** %temp, align 8
+ %3 = load i32*** %b2_addr, align 8 ; <i32**> [#uses=1]
+ %4 = load i32** %3, align 8 ; <i32*> [#uses=1]
+ store i32* %4, i32** %temp1, align 8
+ %5 = load i32** %temp1, align 8 ; <i32*> [#uses=1]
+ %6 = load i32* %5, align 4 ; <i32> [#uses=1]
+ %7 = load i32** %temp, align 8 ; <i32*> [#uses=1]
+ %8 = load i32* %7, align 4 ; <i32> [#uses=1]
+ %9 = icmp slt i32 %6, %8 ; <i1> [#uses=1]
+ br i1 %9, label %bb, label %bb1
+
+bb: ; preds = %entry
+ %10 = load i32*** %b2_addr, align 8 ; <i32**> [#uses=1]
+ %11 = load i32** %10, align 8 ; <i32*> [#uses=1]
+ store i32* %11, i32** %0, align 8
+ br label %bb2
+
+bb1: ; preds = %entry
+ %12 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %13 = bitcast i8* %12 to i32* ; <i32*> [#uses=1]
+ store i32* %13, i32** %temp2, align 8
+ store i32** %temp2, i32*** %a2_addr, align 8
+ %14 = load i32*** %a2_addr, align 8 ; <i32**> [#uses=1]
+ %15 = load i32** %14, align 8 ; <i32*> [#uses=1]
+ store i32* %15, i32** %0, align 8
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %16 = load i32** %0, align 8 ; <i32*> [#uses=1]
+ store i32* %16, i32** %retval, align 8
+ br label %return
+
+return: ; preds = %bb2
+ %retval3 = load i32** %retval ; <i32*> [#uses=1]
+ ret i32* %retval3
+}
+
+declare noalias i8* @malloc(i64) nounwind
+
+define void @func() nounwind {
+entry:
+ %mem1 = alloca i32* ; <i32**> [#uses=3]
+ %mem2 = alloca i32* ; <i32**> [#uses=3]
+ %r1 = alloca i32 ; <i32*> [#uses=2]
+ %r2 = alloca i32 ; <i32*> [#uses=2]
+ %a1 = alloca i32* ; <i32**> [#uses=1]
+ %b1 = alloca i32* ; <i32**> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 5, i32* %r1, align 4
+ store i32 6, i32* %r2, align 4
+ store i32* %r1, i32** %mem1, align 8
+ store i32* %r2, i32** %mem2, align 8
+ %0 = call i32* @test(i32** %mem1, i32** %mem2) nounwind ; <i32*> [#uses=1]
+ store i32* %0, i32** %a1, align 8
+ %1 = call i32* @test(i32** %mem2, i32** %mem1) nounwind ; <i32*> [#uses=1]
+ store i32* %1, i32** %b1, align 8
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
Added: poolalloc/trunk/test/dsa/td/params1.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/params1.c?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/params1.c (added)
+++ poolalloc/trunk/test/dsa/td/params1.c Tue Aug 31 09:37:24 2010
@@ -0,0 +1,39 @@
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+
+#include <stdlib.h>
+
+struct InfoStruct {
+ int count;
+ int valid;
+ float factor;
+};
+
+void initialize(struct InfoStruct **arr, int size) {
+ struct InfoStruct *temp = *arr;
+ while(temp < (*arr + size)) {
+ temp->count = 0;
+ temp->valid = 0;
+ temp->factor = 0.0;
+ temp++;
+ }
+}
+
+void process(struct InfoStruct **arr, int loc, int count, float fact) {
+
+ struct InfoStruct *ptr = *arr;
+ struct InfoStruct obj;
+ obj.count = count;
+ obj.factor = fact;
+ obj.valid = 1;
+ ptr[loc]=obj;
+}
+
+int main() {
+
+ struct InfoStruct* InfoArray= (struct InfoStruct*)malloc(sizeof(struct InfoStruct) * 10);
+ initialize(&InfoArray, 10);
+ process(&InfoArray, 4, 3, 5.5);
+}
Added: poolalloc/trunk/test/dsa/td/params1.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/params1.ll?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/params1.ll (added)
+++ poolalloc/trunk/test/dsa/td/params1.ll Tue Aug 31 09:37:24 2010
@@ -0,0 +1,138 @@
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=initialize:temp:0,initialize:arr:0
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "initialize:temp:0+IR"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "initialize:arr+IRE"
+
+;RUN: dsaopt %s -dsa-bu -analyze -check-same-node=initialize:temp:0,initialize:arr:0
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "initialize:temp:0+IR"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "initialize:arr+IRE"
+
+;RUN: dsaopt %s -dsa-td -analyze -check-same-node=initialize:temp:0,initialize:arr:0
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "initialize:temp:0+HIMR"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "initialize:arr+SIMRE"
+
+; ModuleID = 'params1.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+%struct.InfoStruct = type { i32, i32, float }
+
+define void @initialize(%struct.InfoStruct** %arr, i32 %size) nounwind {
+entry:
+ %arr_addr = alloca %struct.InfoStruct** ; <%struct.InfoStruct***> [#uses=3]
+ %size_addr = alloca i32 ; <i32*> [#uses=2]
+ %temp = alloca %struct.InfoStruct* ; <%struct.InfoStruct**> [#uses=5]
+ %elem = alloca %struct.InfoStruct ; <%struct.InfoStruct*> [#uses=6]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store %struct.InfoStruct** %arr, %struct.InfoStruct*** %arr_addr
+ store i32 %size, i32* %size_addr
+ %0 = load %struct.InfoStruct*** %arr_addr, align 8 ; <%struct.InfoStruct**> [#uses=1]
+ %1 = load %struct.InfoStruct** %0, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ store %struct.InfoStruct* %1, %struct.InfoStruct** %temp, align 8
+ br label %bb1
+
+bb: ; preds = %bb1
+ %2 = load %struct.InfoStruct** %temp, align 8 ; <%struct.InfoStruct*> [#uses=3]
+ %3 = getelementptr inbounds %struct.InfoStruct* %elem, i32 0, i32 0 ; <i32*> [#uses=1]
+ %4 = getelementptr inbounds %struct.InfoStruct* %2, i32 0, i32 0 ; <i32*> [#uses=1]
+ %5 = load i32* %4, align 4 ; <i32> [#uses=1]
+ store i32 %5, i32* %3, align 4
+ %6 = getelementptr inbounds %struct.InfoStruct* %elem, i32 0, i32 1 ; <i32*> [#uses=1]
+ %7 = getelementptr inbounds %struct.InfoStruct* %2, i32 0, i32 1 ; <i32*> [#uses=1]
+ %8 = load i32* %7, align 4 ; <i32> [#uses=1]
+ store i32 %8, i32* %6, align 4
+ %9 = getelementptr inbounds %struct.InfoStruct* %elem, i32 0, i32 2 ; <float*> [#uses=1]
+ %10 = getelementptr inbounds %struct.InfoStruct* %2, i32 0, i32 2 ; <float*> [#uses=1]
+ %11 = load float* %10, align 4 ; <float> [#uses=1]
+ store float %11, float* %9, align 4
+ %12 = getelementptr inbounds %struct.InfoStruct* %elem, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %12, align 4
+ %13 = getelementptr inbounds %struct.InfoStruct* %elem, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 0, i32* %13, align 4
+ %14 = getelementptr inbounds %struct.InfoStruct* %elem, i32 0, i32 2 ; <float*> [#uses=1]
+ store float 0.000000e+00, float* %14, align 4
+ %15 = load %struct.InfoStruct** %temp, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ %16 = getelementptr inbounds %struct.InfoStruct* %15, i64 1 ; <%struct.InfoStruct*> [#uses=1]
+ store %struct.InfoStruct* %16, %struct.InfoStruct** %temp, align 8
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %17 = load %struct.InfoStruct*** %arr_addr, align 8 ; <%struct.InfoStruct**> [#uses=1]
+ %18 = load %struct.InfoStruct** %17, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ %19 = load i32* %size_addr, align 4 ; <i32> [#uses=1]
+ %20 = sext i32 %19 to i64 ; <i64> [#uses=1]
+ %21 = getelementptr inbounds %struct.InfoStruct* %18, i64 %20 ; <%struct.InfoStruct*> [#uses=1]
+ %22 = load %struct.InfoStruct** %temp, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ %23 = icmp ugt %struct.InfoStruct* %21, %22 ; <i1> [#uses=1]
+ br i1 %23, label %bb, label %bb2
+
+bb2: ; preds = %bb1
+ br label %return
+
+return: ; preds = %bb2
+ ret void
+}
+
+define void @process(%struct.InfoStruct** %arr, i32 %loc, i32 %count, float %fact) nounwind {
+entry:
+ %arr_addr = alloca %struct.InfoStruct** ; <%struct.InfoStruct***> [#uses=2]
+ %loc_addr = alloca i32 ; <i32*> [#uses=2]
+ %count_addr = alloca i32 ; <i32*> [#uses=2]
+ %fact_addr = alloca float ; <float*> [#uses=2]
+ %ptr = alloca %struct.InfoStruct* ; <%struct.InfoStruct**> [#uses=2]
+ %obj = alloca %struct.InfoStruct ; <%struct.InfoStruct*> [#uses=6]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store %struct.InfoStruct** %arr, %struct.InfoStruct*** %arr_addr
+ store i32 %loc, i32* %loc_addr
+ store i32 %count, i32* %count_addr
+ store float %fact, float* %fact_addr
+ %0 = load %struct.InfoStruct*** %arr_addr, align 8 ; <%struct.InfoStruct**> [#uses=1]
+ %1 = load %struct.InfoStruct** %0, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ store %struct.InfoStruct* %1, %struct.InfoStruct** %ptr, align 8
+ %2 = load %struct.InfoStruct** %ptr, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ %3 = load i32* %loc_addr, align 4 ; <i32> [#uses=1]
+ %4 = sext i32 %3 to i64 ; <i64> [#uses=1]
+ %5 = getelementptr inbounds %struct.InfoStruct* %2, i64 %4 ; <%struct.InfoStruct*> [#uses=3]
+ %6 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 0 ; <i32*> [#uses=1]
+ %7 = getelementptr inbounds %struct.InfoStruct* %5, i32 0, i32 0 ; <i32*> [#uses=1]
+ %8 = load i32* %7, align 1 ; <i32> [#uses=1]
+ store i32 %8, i32* %6, align 1
+ %9 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 1 ; <i32*> [#uses=1]
+ %10 = getelementptr inbounds %struct.InfoStruct* %5, i32 0, i32 1 ; <i32*> [#uses=1]
+ %11 = load i32* %10, align 1 ; <i32> [#uses=1]
+ store i32 %11, i32* %9, align 1
+ %12 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 2 ; <float*> [#uses=1]
+ %13 = getelementptr inbounds %struct.InfoStruct* %5, i32 0, i32 2 ; <float*> [#uses=1]
+ %14 = load float* %13, align 1 ; <float> [#uses=1]
+ store float %14, float* %12, align 1
+ %15 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 0 ; <i32*> [#uses=1]
+ %16 = load i32* %count_addr, align 4 ; <i32> [#uses=1]
+ store i32 %16, i32* %15, align 4
+ %17 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 2 ; <float*> [#uses=1]
+ %18 = load float* %fact_addr, align 4 ; <float> [#uses=1]
+ store float %18, float* %17, align 4
+ %19 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 1, i32* %19, align 4
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define i32 @main() nounwind {
+entry:
+ %retval = alloca i32 ; <i32*> [#uses=1]
+ %InfoArray = alloca %struct.InfoStruct* ; <%struct.InfoStruct**> [#uses=3]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call noalias i8* @malloc(i64 120) nounwind ; <i8*> [#uses=1]
+ %1 = bitcast i8* %0 to %struct.InfoStruct* ; <%struct.InfoStruct*> [#uses=1]
+ store %struct.InfoStruct* %1, %struct.InfoStruct** %InfoArray, align 8
+ call void @initialize(%struct.InfoStruct** %InfoArray, i32 10) nounwind
+ call void @process(%struct.InfoStruct** %InfoArray, i32 4, i32 3, float 5.500000e+00) nounwind
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval1
+}
+
+declare noalias i8* @malloc(i64) nounwind
Added: poolalloc/trunk/test/dsa/td/params2.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/params2.ll?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/params2.ll (added)
+++ poolalloc/trunk/test/dsa/td/params2.ll Tue Aug 31 09:37:24 2010
@@ -0,0 +1,115 @@
+; ModuleID = 'params2.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+%struct.InfoStruct = type { i32, i32, float }
+
+define void @initialize(%struct.InfoStruct** %arr, i32 %size) nounwind {
+entry:
+ %arr_addr = alloca %struct.InfoStruct** ; <%struct.InfoStruct***> [#uses=3]
+ %size_addr = alloca i32 ; <i32*> [#uses=2]
+ %temp = alloca %struct.InfoStruct* ; <%struct.InfoStruct**> [#uses=7]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store %struct.InfoStruct** %arr, %struct.InfoStruct*** %arr_addr
+ store i32 %size, i32* %size_addr
+ %0 = load %struct.InfoStruct*** %arr_addr, align 8 ; <%struct.InfoStruct**> [#uses=1]
+ %1 = load %struct.InfoStruct** %0, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ store %struct.InfoStruct* %1, %struct.InfoStruct** %temp, align 8
+ br label %bb1
+
+bb: ; preds = %bb1
+ %2 = load %struct.InfoStruct** %temp, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ %3 = getelementptr inbounds %struct.InfoStruct* %2, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 0, i32* %3, align 4
+ %4 = load %struct.InfoStruct** %temp, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ %5 = getelementptr inbounds %struct.InfoStruct* %4, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 0, i32* %5, align 4
+ %6 = load %struct.InfoStruct** %temp, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ %7 = getelementptr inbounds %struct.InfoStruct* %6, i32 0, i32 2 ; <float*> [#uses=1]
+ store float 0.000000e+00, float* %7, align 4
+ %8 = load %struct.InfoStruct** %temp, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ %9 = getelementptr inbounds %struct.InfoStruct* %8, i64 1 ; <%struct.InfoStruct*> [#uses=1]
+ store %struct.InfoStruct* %9, %struct.InfoStruct** %temp, align 8
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %10 = load %struct.InfoStruct*** %arr_addr, align 8 ; <%struct.InfoStruct**> [#uses=1]
+ %11 = load %struct.InfoStruct** %10, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ %12 = load i32* %size_addr, align 4 ; <i32> [#uses=1]
+ %13 = sext i32 %12 to i64 ; <i64> [#uses=1]
+ %14 = getelementptr inbounds %struct.InfoStruct* %11, i64 %13 ; <%struct.InfoStruct*> [#uses=1]
+ %15 = load %struct.InfoStruct** %temp, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ %16 = icmp ugt %struct.InfoStruct* %14, %15 ; <i1> [#uses=1]
+ br i1 %16, label %bb, label %bb2
+
+bb2: ; preds = %bb1
+ br label %return
+
+return: ; preds = %bb2
+ ret void
+}
+
+define void @process(%struct.InfoStruct** %arr, i32 %loc, i32 %count, float %fact) nounwind {
+entry:
+ %arr_addr = alloca %struct.InfoStruct** ; <%struct.InfoStruct***> [#uses=2]
+ %loc_addr = alloca i32 ; <i32*> [#uses=2]
+ %count_addr = alloca i32 ; <i32*> [#uses=2]
+ %fact_addr = alloca float ; <float*> [#uses=2]
+ %ptr = alloca %struct.InfoStruct* ; <%struct.InfoStruct**> [#uses=2]
+ %obj = alloca %struct.InfoStruct ; <%struct.InfoStruct*> [#uses=6]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store %struct.InfoStruct** %arr, %struct.InfoStruct*** %arr_addr
+ store i32 %loc, i32* %loc_addr
+ store i32 %count, i32* %count_addr
+ store float %fact, float* %fact_addr
+ %0 = load %struct.InfoStruct*** %arr_addr, align 8 ; <%struct.InfoStruct**> [#uses=1]
+ %1 = load %struct.InfoStruct** %0, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ store %struct.InfoStruct* %1, %struct.InfoStruct** %ptr, align 8
+ %2 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 0 ; <i32*> [#uses=1]
+ %3 = load i32* %count_addr, align 4 ; <i32> [#uses=1]
+ store i32 %3, i32* %2, align 4
+ %4 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 2 ; <float*> [#uses=1]
+ %5 = load float* %fact_addr, align 4 ; <float> [#uses=1]
+ store float %5, float* %4, align 4
+ %6 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 1 ; <i32*> [#uses=1]
+ store i32 1, i32* %6, align 4
+ %7 = load %struct.InfoStruct** %ptr, align 8 ; <%struct.InfoStruct*> [#uses=1]
+ %8 = load i32* %loc_addr, align 4 ; <i32> [#uses=1]
+ %9 = sext i32 %8 to i64 ; <i64> [#uses=1]
+ %10 = getelementptr inbounds %struct.InfoStruct* %7, i64 %9 ; <%struct.InfoStruct*> [#uses=3]
+ %11 = getelementptr inbounds %struct.InfoStruct* %10, i32 0, i32 0 ; <i32*> [#uses=1]
+ %12 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 0 ; <i32*> [#uses=1]
+ %13 = load i32* %12, align 1 ; <i32> [#uses=1]
+ store i32 %13, i32* %11, align 1
+ %14 = getelementptr inbounds %struct.InfoStruct* %10, i32 0, i32 1 ; <i32*> [#uses=1]
+ %15 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 1 ; <i32*> [#uses=1]
+ %16 = load i32* %15, align 1 ; <i32> [#uses=1]
+ store i32 %16, i32* %14, align 1
+ %17 = getelementptr inbounds %struct.InfoStruct* %10, i32 0, i32 2 ; <float*> [#uses=1]
+ %18 = getelementptr inbounds %struct.InfoStruct* %obj, i32 0, i32 2 ; <float*> [#uses=1]
+ %19 = load float* %18, align 1 ; <float> [#uses=1]
+ store float %19, float* %17, align 1
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define i32 @main() nounwind {
+entry:
+ %retval = alloca i32 ; <i32*> [#uses=1]
+ %InfoArray = alloca %struct.InfoStruct* ; <%struct.InfoStruct**> [#uses=3]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call noalias i8* @malloc(i64 120) nounwind ; <i8*> [#uses=1]
+ %1 = bitcast i8* %0 to %struct.InfoStruct* ; <%struct.InfoStruct*> [#uses=1]
+ store %struct.InfoStruct* %1, %struct.InfoStruct** %InfoArray, align 8
+ call void @initialize(%struct.InfoStruct** %InfoArray, i32 10) nounwind
+ call void @process(%struct.InfoStruct** %InfoArray, i32 4, i32 3, float 5.500000e+00) nounwind
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32* %retval ; <i32> [#uses=1]
+ ret i32 %retval1
+}
+
+declare noalias i8* @malloc(i64) nounwind
Added: poolalloc/trunk/test/dsa/td/recur.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/recur.c?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/recur.c (added)
+++ poolalloc/trunk/test/dsa/td/recur.c Tue Aug 31 09:37:24 2010
@@ -0,0 +1,27 @@
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+
+#include <stdlib.h>
+
+
+int* test() {
+ int* a2 = (int*)malloc(sizeof(int));
+ *a2 = 10;
+
+ if(*a2 > 5 ) {
+ return test();
+ }
+
+ int *b2 = (int*)malloc(sizeof(int));
+ return b2;
+
+}
+
+void func() {
+
+ int *a1 = test();
+ int *b1 = test();
+}
+
Added: poolalloc/trunk/test/dsa/td/recur.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/recur.ll?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/recur.ll (added)
+++ poolalloc/trunk/test/dsa/td/recur.ll Tue Aug 31 09:37:24 2010
@@ -0,0 +1,63 @@
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:b2:0+HI"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:b2:0+HIM"
+
+; ModuleID = 'recur.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32* @test() nounwind {
+entry:
+ %retval = alloca i32* ; <i32**> [#uses=2]
+ %0 = alloca i32* ; <i32**> [#uses=3]
+ %a2 = alloca i32* ; <i32**> [#uses=3]
+ %b2 = alloca i32* ; <i32**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %1 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %2 = bitcast i8* %1 to i32* ; <i32*> [#uses=1]
+ store i32* %2, i32** %a2, align 8
+ %3 = load i32** %a2, align 8 ; <i32*> [#uses=1]
+ store i32 10, i32* %3, align 4
+ %4 = load i32** %a2, align 8 ; <i32*> [#uses=1]
+ %5 = load i32* %4, align 4 ; <i32> [#uses=1]
+ %6 = icmp sgt i32 %5, 5 ; <i1> [#uses=1]
+ br i1 %6, label %bb, label %bb1
+
+bb: ; preds = %entry
+ %7 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %7, i32** %0, align 8
+ br label %bb2
+
+bb1: ; preds = %entry
+ %8 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %9 = bitcast i8* %8 to i32* ; <i32*> [#uses=1]
+ store i32* %9, i32** %b2, align 8
+ %10 = load i32** %b2, align 8 ; <i32*> [#uses=1]
+ store i32* %10, i32** %0, align 8
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %11 = load i32** %0, align 8 ; <i32*> [#uses=1]
+ store i32* %11, i32** %retval, align 8
+ br label %return
+
+return: ; preds = %bb2
+ %retval3 = load i32** %retval ; <i32*> [#uses=1]
+ ret i32* %retval3
+}
+
+declare noalias i8* @malloc(i64) nounwind
+
+define void @func() nounwind {
+entry:
+ %a1 = alloca i32* ; <i32**> [#uses=1]
+ %b1 = alloca i32* ; <i32**> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %0, i32** %a1, align 8
+ %1 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %1, i32** %b1, align 8
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
Added: poolalloc/trunk/test/dsa/td/recur1.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/recur1.c?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/recur1.c (added)
+++ poolalloc/trunk/test/dsa/td/recur1.c Tue Aug 31 09:37:24 2010
@@ -0,0 +1,30 @@
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+
+#include <stdlib.h>
+
+int*test1(int *b3) {
+ return b3+1;
+}
+
+int* test() {
+ int* a2 = (int*)malloc(sizeof(int));
+ *a2 = 10;
+
+ if(*a2 > 5 ) {
+ return test();
+ }
+
+ int *b2 = (int*)malloc(sizeof(int));
+ return test1(b2);
+
+}
+
+void func() {
+
+ int *a1 = test();
+ int *b1 = test();
+}
+
Added: poolalloc/trunk/test/dsa/td/recur1.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/recur1.ll?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/recur1.ll (added)
+++ poolalloc/trunk/test/dsa/td/recur1.ll Tue Aug 31 09:37:24 2010
@@ -0,0 +1,83 @@
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:b2:0+HM"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:b2:0+HI"
+
+; ModuleID = 'recur1.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32* @test1(i32* %b3) nounwind {
+entry:
+ %b3_addr = alloca i32* ; <i32**> [#uses=2]
+ %retval = alloca i32* ; <i32**> [#uses=2]
+ %0 = alloca i32* ; <i32**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32* %b3, i32** %b3_addr
+ %1 = load i32** %b3_addr, align 8 ; <i32*> [#uses=1]
+ %2 = getelementptr inbounds i32* %1, i64 1 ; <i32*> [#uses=1]
+ store i32* %2, i32** %0, align 8
+ %3 = load i32** %0, align 8 ; <i32*> [#uses=1]
+ store i32* %3, i32** %retval, align 8
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32** %retval ; <i32*> [#uses=1]
+ ret i32* %retval1
+}
+
+define i32* @test() nounwind {
+entry:
+ %retval = alloca i32* ; <i32**> [#uses=2]
+ %0 = alloca i32* ; <i32**> [#uses=3]
+ %a2 = alloca i32* ; <i32**> [#uses=3]
+ %b2 = alloca i32* ; <i32**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %1 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %2 = bitcast i8* %1 to i32* ; <i32*> [#uses=1]
+ store i32* %2, i32** %a2, align 8
+ %3 = load i32** %a2, align 8 ; <i32*> [#uses=1]
+ store i32 10, i32* %3, align 4
+ %4 = load i32** %a2, align 8 ; <i32*> [#uses=1]
+ %5 = load i32* %4, align 4 ; <i32> [#uses=1]
+ %6 = icmp sgt i32 %5, 5 ; <i1> [#uses=1]
+ br i1 %6, label %bb, label %bb1
+
+bb: ; preds = %entry
+ %7 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %7, i32** %0, align 8
+ br label %bb2
+
+bb1: ; preds = %entry
+ %8 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %9 = bitcast i8* %8 to i32* ; <i32*> [#uses=1]
+ store i32* %9, i32** %b2, align 8
+ %10 = load i32** %b2, align 8 ; <i32*> [#uses=1]
+ %11 = call i32* @test1(i32* %10) nounwind ; <i32*> [#uses=1]
+ store i32* %11, i32** %0, align 8
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %12 = load i32** %0, align 8 ; <i32*> [#uses=1]
+ store i32* %12, i32** %retval, align 8
+ br label %return
+
+return: ; preds = %bb2
+ %retval3 = load i32** %retval ; <i32*> [#uses=1]
+ ret i32* %retval3
+}
+
+declare noalias i8* @malloc(i64) nounwind
+
+define void @func() nounwind {
+entry:
+ %a1 = alloca i32* ; <i32**> [#uses=1]
+ %b1 = alloca i32* ; <i32**> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %0, i32** %a1, align 8
+ %1 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %1, i32** %b1, align 8
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
Added: poolalloc/trunk/test/dsa/td/recur2.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/recur2.c?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/recur2.c (added)
+++ poolalloc/trunk/test/dsa/td/recur2.c Tue Aug 31 09:37:24 2010
@@ -0,0 +1,31 @@
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+
+#include <stdlib.h>
+int* test1(int*);
+
+int* test() {
+ int* a2 = (int*)malloc(sizeof(int));
+ *a2 = 10;
+
+ if(*a2 > 5 ) {
+ return test();
+ }
+
+ int *b2 = (int*)malloc(sizeof(int));
+ return test1(b2);
+
+}
+
+int*test1(int *b3) {
+ return test()+*b3;
+}
+
+void func() {
+
+ int *a1 = test();
+ int *b1 = test();
+}
+
Added: poolalloc/trunk/test/dsa/td/recur2.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/recur2.ll?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/recur2.ll (added)
+++ poolalloc/trunk/test/dsa/td/recur2.ll Tue Aug 31 09:37:24 2010
@@ -0,0 +1,86 @@
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "test:b2:0+HM"
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "test:b2:0+HI"
+
+; ModuleID = 'recur2.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32* @test() nounwind {
+entry:
+ %retval = alloca i32* ; <i32**> [#uses=2]
+ %0 = alloca i32* ; <i32**> [#uses=3]
+ %a2 = alloca i32* ; <i32**> [#uses=3]
+ %b2 = alloca i32* ; <i32**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %1 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %2 = bitcast i8* %1 to i32* ; <i32*> [#uses=1]
+ store i32* %2, i32** %a2, align 8
+ %3 = load i32** %a2, align 8 ; <i32*> [#uses=1]
+ store i32 10, i32* %3, align 4
+ %4 = load i32** %a2, align 8 ; <i32*> [#uses=1]
+ %5 = load i32* %4, align 4 ; <i32> [#uses=1]
+ %6 = icmp sgt i32 %5, 5 ; <i1> [#uses=1]
+ br i1 %6, label %bb, label %bb1
+
+bb: ; preds = %entry
+ %7 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %7, i32** %0, align 8
+ br label %bb2
+
+bb1: ; preds = %entry
+ %8 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %9 = bitcast i8* %8 to i32* ; <i32*> [#uses=1]
+ store i32* %9, i32** %b2, align 8
+ %10 = load i32** %b2, align 8 ; <i32*> [#uses=1]
+ %11 = call i32* @test1(i32* %10) nounwind ; <i32*> [#uses=1]
+ store i32* %11, i32** %0, align 8
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %12 = load i32** %0, align 8 ; <i32*> [#uses=1]
+ store i32* %12, i32** %retval, align 8
+ br label %return
+
+return: ; preds = %bb2
+ %retval3 = load i32** %retval ; <i32*> [#uses=1]
+ ret i32* %retval3
+}
+
+declare noalias i8* @malloc(i64) nounwind
+
+define i32* @test1(i32* %b3) nounwind {
+entry:
+ %b3_addr = alloca i32* ; <i32**> [#uses=2]
+ %retval = alloca i32* ; <i32**> [#uses=2]
+ %0 = alloca i32* ; <i32**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32* %b3, i32** %b3_addr
+ %1 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ %2 = load i32** %b3_addr, align 8 ; <i32*> [#uses=1]
+ %3 = load i32* %2, align 4 ; <i32> [#uses=1]
+ %4 = sext i32 %3 to i64 ; <i64> [#uses=1]
+ %5 = getelementptr inbounds i32* %1, i64 %4 ; <i32*> [#uses=1]
+ store i32* %5, i32** %0, align 8
+ %6 = load i32** %0, align 8 ; <i32*> [#uses=1]
+ store i32* %6, i32** %retval, align 8
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32** %retval ; <i32*> [#uses=1]
+ ret i32* %retval1
+}
+
+define void @func() nounwind {
+entry:
+ %a1 = alloca i32* ; <i32**> [#uses=1]
+ %b1 = alloca i32* ; <i32**> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %0, i32** %a1, align 8
+ %1 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %1, i32** %b1, align 8
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
Added: poolalloc/trunk/test/dsa/td/recur3.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/recur3.c?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/recur3.c (added)
+++ poolalloc/trunk/test/dsa/td/recur3.c Tue Aug 31 09:37:24 2010
@@ -0,0 +1,34 @@
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+
+#include <stdlib.h>
+int* test1(int*);
+
+int* test() {
+ int* a2 = (int*)malloc(sizeof(int));
+ *a2 = 10;
+
+ if(*a2 > 5 ) {
+ return test();
+ }
+
+ int *b2 = (int*)malloc(sizeof(int));
+ return test1(b2);
+
+}
+
+int*test1(int *b3) {
+ return test()+*b3;
+}
+
+int *test2(int *b4) {
+ return test() + *b4;
+}
+void func() {
+
+ int *a1 = test();
+ int *b1 = test();
+}
+
Added: poolalloc/trunk/test/dsa/td/testcase.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/testcase.c?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/testcase.c (added)
+++ poolalloc/trunk/test/dsa/td/testcase.c Tue Aug 31 09:37:24 2010
@@ -0,0 +1,19 @@
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+
+#include <stdlib.h>
+
+
+int* test() {
+ int* a2 = (int*)malloc(sizeof(int));
+ return a2;
+
+}
+
+void func() {
+
+ int *a1 = test();
+}
+
Added: poolalloc/trunk/test/dsa/td/testcase.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/testcase.ll?rev=112599&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/testcase.ll (added)
+++ poolalloc/trunk/test/dsa/td/testcase.ll Tue Aug 31 09:37:24 2010
@@ -0,0 +1,40 @@
+;RUN: dsaopt %s -dsa-local -analyze -verify-flags "func:a1:0+I"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "func:a1:0+HM-I"
+
+; ModuleID = 'testcase.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32* @test() nounwind {
+entry:
+ %retval = alloca i32* ; <i32**> [#uses=2]
+ %0 = alloca i32* ; <i32**> [#uses=2]
+ %a2 = alloca i32* ; <i32**> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %1 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %2 = bitcast i8* %1 to i32* ; <i32*> [#uses=1]
+ store i32* %2, i32** %a2, align 8
+ %3 = load i32** %a2, align 8 ; <i32*> [#uses=1]
+ store i32* %3, i32** %0, align 8
+ %4 = load i32** %0, align 8 ; <i32*> [#uses=1]
+ store i32* %4, i32** %retval, align 8
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32** %retval ; <i32*> [#uses=1]
+ ret i32* %retval1
+}
+
+declare noalias i8* @malloc(i64) nounwind
+
+define void @func() nounwind {
+entry:
+ %a1 = alloca i32* ; <i32**> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call i32* @test() nounwind ; <i32*> [#uses=1]
+ store i32* %0, i32** %a1, align 8
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
More information about the llvm-commits
mailing list