[llvm-commits] [poolalloc] r111301 - in /poolalloc/trunk/test/dsa/local: arrays.c arrays.ll arrays1.c arrays1.ll arrays2.c arrays2.ll arrays3.c arrays3.ll ptr.c ptr.ll ptr1.c ptr1.ll ptr2.c ptr2.ll struct.c struct.ll struct1.c struct1.ll
Will Dietz
wdietz2 at illinois.edu
Tue Aug 17 14:53:59 PDT 2010
Author: wdietz2
Date: Tue Aug 17 16:53:59 2010
New Revision: 111301
URL: http://llvm.org/viewvc/llvm-project?rev=111301&view=rev
Log:
Added number of tests for dsa-local, committing on Arushi's behalf.
Added:
poolalloc/trunk/test/dsa/local/arrays.c
poolalloc/trunk/test/dsa/local/arrays.ll
poolalloc/trunk/test/dsa/local/arrays1.c
poolalloc/trunk/test/dsa/local/arrays1.ll
poolalloc/trunk/test/dsa/local/arrays2.c
poolalloc/trunk/test/dsa/local/arrays2.ll
poolalloc/trunk/test/dsa/local/arrays3.c
poolalloc/trunk/test/dsa/local/arrays3.ll
poolalloc/trunk/test/dsa/local/ptr.c
poolalloc/trunk/test/dsa/local/ptr.ll
poolalloc/trunk/test/dsa/local/ptr1.c
poolalloc/trunk/test/dsa/local/ptr1.ll
poolalloc/trunk/test/dsa/local/ptr2.c
poolalloc/trunk/test/dsa/local/ptr2.ll
poolalloc/trunk/test/dsa/local/struct.c
poolalloc/trunk/test/dsa/local/struct.ll
poolalloc/trunk/test/dsa/local/struct1.c
poolalloc/trunk/test/dsa/local/struct1.ll
Added: poolalloc/trunk/test/dsa/local/arrays.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/arrays.c?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/arrays.c (added)
+++ poolalloc/trunk/test/dsa/local/arrays.c Tue Aug 17 16:53:59 2010
@@ -0,0 +1,21 @@
+
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+//H, S, G, R, M
+
+#include <stdlib.h>
+
+void func() {
+
+ int *arr = (int*) malloc(sizeof(int)*10);
+ int i;
+ for(i=0;i<10;i++)
+ arr[i] = i;
+
+ int *b = &arr[5];
+ int **c = &arr;
+ int **d = &arr + 4;
+}
+
Added: poolalloc/trunk/test/dsa/local/arrays.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/arrays.ll?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/arrays.ll (added)
+++ poolalloc/trunk/test/dsa/local/arrays.ll Tue Aug 17 16:53:59 2010
@@ -0,0 +1,53 @@
+
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:arr:0,func:b:0
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:arr,func:d:0,func:c:0
+
+; ModuleID = 'arrays.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 void @func() nounwind {
+entry:
+ %arr = alloca i32* ; <i32**> [#uses=5]
+ %i = alloca i32 ; <i32*> [#uses=6]
+ %b = alloca i32* ; <i32**> [#uses=1]
+ %c = alloca i32** ; <i32***> [#uses=1]
+ %d = alloca i32** ; <i32***> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call noalias i8* @malloc(i64 40) nounwind ; <i8*> [#uses=1]
+ %1 = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
+ store i32* %1, i32** %arr, align 8
+ store i32 0, i32* %i, align 4
+ br label %bb1
+
+bb: ; preds = %bb1
+ %2 = load i32** %arr, align 8 ; <i32*> [#uses=1]
+ %3 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %4 = sext i32 %3 to i64 ; <i64> [#uses=1]
+ %5 = getelementptr inbounds i32* %2, i64 %4 ; <i32*> [#uses=1]
+ %6 = load i32* %i, align 4 ; <i32> [#uses=1]
+ store i32 %6, i32* %5, align 1
+ %7 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %8 = add nsw i32 %7, 1 ; <i32> [#uses=1]
+ store i32 %8, i32* %i, align 4
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %9 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %10 = icmp sle i32 %9, 9 ; <i1> [#uses=1]
+ br i1 %10, label %bb, label %bb2
+
+bb2: ; preds = %bb1
+ %11 = load i32** %arr, align 8 ; <i32*> [#uses=1]
+ %12 = getelementptr inbounds i32* %11, i64 5 ; <i32*> [#uses=1]
+ store i32* %12, i32** %b, align 8
+ store i32** %arr, i32*** %c, align 8
+ %13 = getelementptr inbounds i32** %arr, i64 4 ; <i32**> [#uses=1]
+ store i32** %13, i32*** %d, align 8
+ br label %return
+
+return: ; preds = %bb2
+ ret void
+}
+
+declare noalias i8* @malloc(i64) nounwind
Added: poolalloc/trunk/test/dsa/local/arrays1.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/arrays1.c?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/arrays1.c (added)
+++ poolalloc/trunk/test/dsa/local/arrays1.c Tue Aug 17 16:53:59 2010
@@ -0,0 +1,25 @@
+//--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 StructType {
+
+ int a;
+ int *b;
+};
+
+void func() {
+
+ struct StructType *tmp = (struct StructType*) malloc(sizeof(struct StructType)*10);
+ int i;
+ for(i=0;i<10;i++) {
+ tmp[i].a = i;
+ tmp[i].b = &tmp[i].a;
+ }
+
+ struct StructType s2 = tmp[0];
+ int * c = s2.b;
+}
+
Added: poolalloc/trunk/test/dsa/local/arrays1.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/arrays1.ll?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/arrays1.ll (added)
+++ poolalloc/trunk/test/dsa/local/arrays1.ll Tue Aug 17 16:53:59 2010
@@ -0,0 +1,72 @@
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:tmp:0:0,func:tmp:0
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:c:0,func:tmp:0,func:s2:8
+
+; ModuleID = 'arrays1.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.StructType = type { i32, i32* }
+
+define void @func() nounwind {
+entry:
+ %tmp = alloca %struct.StructType* ; <%struct.StructType**> [#uses=5]
+ %i = alloca i32 ; <i32*> [#uses=8]
+ %s2 = alloca %struct.StructType ; <%struct.StructType*> [#uses=3]
+ %c = alloca i32* ; <i32**> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call noalias i8* @malloc(i64 160) nounwind ; <i8*> [#uses=1]
+ %1 = bitcast i8* %0 to %struct.StructType* ; <%struct.StructType*> [#uses=1]
+ store %struct.StructType* %1, %struct.StructType** %tmp, align 8
+ store i32 0, i32* %i, align 4
+ br label %bb1
+
+bb: ; preds = %bb1
+ %2 = load %struct.StructType** %tmp, align 8 ; <%struct.StructType*> [#uses=1]
+ %3 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %4 = sext i32 %3 to i64 ; <i64> [#uses=1]
+ %5 = getelementptr inbounds %struct.StructType* %2, i64 %4 ; <%struct.StructType*> [#uses=1]
+ %6 = getelementptr inbounds %struct.StructType* %5, i32 0, i32 0 ; <i32*> [#uses=1]
+ %7 = load i32* %i, align 4 ; <i32> [#uses=1]
+ store i32 %7, i32* %6, align 8
+ %8 = load %struct.StructType** %tmp, align 8 ; <%struct.StructType*> [#uses=1]
+ %9 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %10 = sext i32 %9 to i64 ; <i64> [#uses=1]
+ %11 = getelementptr inbounds %struct.StructType* %8, i64 %10 ; <%struct.StructType*> [#uses=1]
+ %12 = load %struct.StructType** %tmp, align 8 ; <%struct.StructType*> [#uses=1]
+ %13 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %14 = sext i32 %13 to i64 ; <i64> [#uses=1]
+ %15 = getelementptr inbounds %struct.StructType* %12, i64 %14 ; <%struct.StructType*> [#uses=1]
+ %16 = getelementptr inbounds %struct.StructType* %15, i32 0, i32 0 ; <i32*> [#uses=1]
+ %17 = getelementptr inbounds %struct.StructType* %11, i32 0, i32 1 ; <i32**> [#uses=1]
+ store i32* %16, i32** %17, align 8
+ %18 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %19 = add nsw i32 %18, 1 ; <i32> [#uses=1]
+ store i32 %19, i32* %i, align 4
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %20 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %21 = icmp sle i32 %20, 9 ; <i1> [#uses=1]
+ br i1 %21, label %bb, label %bb2
+
+bb2: ; preds = %bb1
+ %22 = load %struct.StructType** %tmp, align 8 ; <%struct.StructType*> [#uses=1]
+ %23 = getelementptr inbounds %struct.StructType* %22, i64 0 ; <%struct.StructType*> [#uses=2]
+ %24 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 0 ; <i32*> [#uses=1]
+ %25 = getelementptr inbounds %struct.StructType* %23, i32 0, i32 0 ; <i32*> [#uses=1]
+ %26 = load i32* %25, align 1 ; <i32> [#uses=1]
+ store i32 %26, i32* %24, align 1
+ %27 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 1 ; <i32**> [#uses=1]
+ %28 = getelementptr inbounds %struct.StructType* %23, i32 0, i32 1 ; <i32**> [#uses=1]
+ %29 = load i32** %28, align 1 ; <i32*> [#uses=1]
+ store i32* %29, i32** %27, align 1
+ %30 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 1 ; <i32**> [#uses=1]
+ %31 = load i32** %30, align 8 ; <i32*> [#uses=1]
+ store i32* %31, i32** %c, align 8
+ br label %return
+
+return: ; preds = %bb2
+ ret void
+}
+
+declare noalias i8* @malloc(i64) nounwind
Added: poolalloc/trunk/test/dsa/local/arrays2.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/arrays2.c?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/arrays2.c (added)
+++ poolalloc/trunk/test/dsa/local/arrays2.c Tue Aug 17 16:53:59 2010
@@ -0,0 +1,26 @@
+//--Make sure we can run DSA on it!
+//RUN: llvm-gcc %s -c --emit-llvm -o - | \
+//RUN: dsaopt -dsa-bu -dsa-td -disable-output
+
+//H, S, G, R, M
+
+#include <stdlib.h>
+
+struct StructType {
+
+ int a;
+ int *b;
+};
+
+void func() {
+
+ struct StructType *tmp = (struct StructType*) malloc(sizeof(struct StructType)*10);
+ int i;
+ for(i=0;i<10;i++) {
+ tmp[i].a = i;
+ }
+
+ struct StructType s2 = tmp[0];
+ int * c = s2.b;
+}
+
Added: poolalloc/trunk/test/dsa/local/arrays2.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/arrays2.ll?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/arrays2.ll (added)
+++ poolalloc/trunk/test/dsa/local/arrays2.ll Tue Aug 17 16:53:59 2010
@@ -0,0 +1,61 @@
+
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:s2:8,func:c:0,func:tmp:0:0
+
+; ModuleID = 'arrays2.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.StructType = type { i32, i32* }
+
+define void @func() nounwind {
+entry:
+ %tmp = alloca %struct.StructType* ; <%struct.StructType**> [#uses=3]
+ %i = alloca i32 ; <i32*> [#uses=6]
+ %s2 = alloca %struct.StructType ; <%struct.StructType*> [#uses=3]
+ %c = alloca i32* ; <i32**> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call noalias i8* @malloc(i64 160) nounwind ; <i8*> [#uses=1]
+ %1 = bitcast i8* %0 to %struct.StructType* ; <%struct.StructType*> [#uses=1]
+ store %struct.StructType* %1, %struct.StructType** %tmp, align 8
+ store i32 0, i32* %i, align 4
+ br label %bb1
+
+bb: ; preds = %bb1
+ %2 = load %struct.StructType** %tmp, align 8 ; <%struct.StructType*> [#uses=1]
+ %3 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %4 = sext i32 %3 to i64 ; <i64> [#uses=1]
+ %5 = getelementptr inbounds %struct.StructType* %2, i64 %4 ; <%struct.StructType*> [#uses=1]
+ %6 = getelementptr inbounds %struct.StructType* %5, i32 0, i32 0 ; <i32*> [#uses=1]
+ %7 = load i32* %i, align 4 ; <i32> [#uses=1]
+ store i32 %7, i32* %6, align 8
+ %8 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %9 = add nsw i32 %8, 1 ; <i32> [#uses=1]
+ store i32 %9, i32* %i, align 4
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %10 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %11 = icmp sle i32 %10, 9 ; <i1> [#uses=1]
+ br i1 %11, label %bb, label %bb2
+
+bb2: ; preds = %bb1
+ %12 = load %struct.StructType** %tmp, align 8 ; <%struct.StructType*> [#uses=1]
+ %13 = getelementptr inbounds %struct.StructType* %12, i64 0 ; <%struct.StructType*> [#uses=2]
+ %14 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 0 ; <i32*> [#uses=1]
+ %15 = getelementptr inbounds %struct.StructType* %13, i32 0, i32 0 ; <i32*> [#uses=1]
+ %16 = load i32* %15, align 1 ; <i32> [#uses=1]
+ store i32 %16, i32* %14, align 1
+ %17 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 1 ; <i32**> [#uses=1]
+ %18 = getelementptr inbounds %struct.StructType* %13, i32 0, i32 1 ; <i32**> [#uses=1]
+ %19 = load i32** %18, align 1 ; <i32*> [#uses=1]
+ store i32* %19, i32** %17, align 1
+ %20 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 1 ; <i32**> [#uses=1]
+ %21 = load i32** %20, align 8 ; <i32*> [#uses=1]
+ store i32* %21, i32** %c, align 8
+ br label %return
+
+return: ; preds = %bb2
+ ret void
+}
+
+declare noalias i8* @malloc(i64) nounwind
Added: poolalloc/trunk/test/dsa/local/arrays3.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/arrays3.c?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/arrays3.c (added)
+++ poolalloc/trunk/test/dsa/local/arrays3.c Tue Aug 17 16:53:59 2010
@@ -0,0 +1,29 @@
+//--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 StructType {
+
+ int a;
+ int *b;
+};
+
+void func() {
+
+ struct StructType *tmp = (struct StructType*) malloc(sizeof(struct StructType)*10);
+ int i;
+ for(i=0;i<10;i++) {
+ tmp[i].a = i;
+ tmp[i].b = (int*) malloc(sizeof(int));
+ }
+
+ struct StructType s2 = tmp[1];
+ int * c = s2.b;
+ struct StructType *ptr = &s2;
+ struct StructType *ptr1 = ptr + 1;
+
+}
+
Added: poolalloc/trunk/test/dsa/local/arrays3.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/arrays3.ll?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/arrays3.ll (added)
+++ poolalloc/trunk/test/dsa/local/arrays3.ll Tue Aug 17 16:53:59 2010
@@ -0,0 +1,75 @@
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:s2:0,func:c:0,func:tmp:0:0
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:ptr:0,func:ptr1:0,func:s2
+
+; ModuleID = 'arrays3.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.StructType = type { i32, i32* }
+
+define void @func() nounwind {
+entry:
+ %tmp = alloca %struct.StructType* ; <%struct.StructType**> [#uses=4]
+ %i = alloca i32 ; <i32*> [#uses=7]
+ %s2 = alloca %struct.StructType ; <%struct.StructType*> [#uses=4]
+ %c = alloca i32* ; <i32**> [#uses=1]
+ %ptr = alloca %struct.StructType* ; <%struct.StructType**> [#uses=2]
+ %ptr1 = alloca %struct.StructType* ; <%struct.StructType**> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ %0 = call noalias i8* @malloc(i64 160) nounwind ; <i8*> [#uses=1]
+ %1 = bitcast i8* %0 to %struct.StructType* ; <%struct.StructType*> [#uses=1]
+ store %struct.StructType* %1, %struct.StructType** %tmp, align 8
+ store i32 0, i32* %i, align 4
+ br label %bb1
+
+bb: ; preds = %bb1
+ %2 = load %struct.StructType** %tmp, align 8 ; <%struct.StructType*> [#uses=1]
+ %3 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %4 = sext i32 %3 to i64 ; <i64> [#uses=1]
+ %5 = getelementptr inbounds %struct.StructType* %2, i64 %4 ; <%struct.StructType*> [#uses=1]
+ %6 = getelementptr inbounds %struct.StructType* %5, i32 0, i32 0 ; <i32*> [#uses=1]
+ %7 = load i32* %i, align 4 ; <i32> [#uses=1]
+ store i32 %7, i32* %6, align 8
+ %8 = load %struct.StructType** %tmp, align 8 ; <%struct.StructType*> [#uses=1]
+ %9 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %10 = sext i32 %9 to i64 ; <i64> [#uses=1]
+ %11 = getelementptr inbounds %struct.StructType* %8, i64 %10 ; <%struct.StructType*> [#uses=1]
+ %12 = call noalias i8* @malloc(i64 4) nounwind ; <i8*> [#uses=1]
+ %13 = bitcast i8* %12 to i32* ; <i32*> [#uses=1]
+ %14 = getelementptr inbounds %struct.StructType* %11, i32 0, i32 1 ; <i32**> [#uses=1]
+ store i32* %13, i32** %14, align 8
+ %15 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %16 = add nsw i32 %15, 1 ; <i32> [#uses=1]
+ store i32 %16, i32* %i, align 4
+ br label %bb1
+
+bb1: ; preds = %bb, %entry
+ %17 = load i32* %i, align 4 ; <i32> [#uses=1]
+ %18 = icmp sle i32 %17, 9 ; <i1> [#uses=1]
+ br i1 %18, label %bb, label %bb2
+
+bb2: ; preds = %bb1
+ %19 = load %struct.StructType** %tmp, align 8 ; <%struct.StructType*> [#uses=1]
+ %20 = getelementptr inbounds %struct.StructType* %19, i64 1 ; <%struct.StructType*> [#uses=2]
+ %21 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 0 ; <i32*> [#uses=1]
+ %22 = getelementptr inbounds %struct.StructType* %20, i32 0, i32 0 ; <i32*> [#uses=1]
+ %23 = load i32* %22, align 1 ; <i32> [#uses=1]
+ store i32 %23, i32* %21, align 1
+ %24 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 1 ; <i32**> [#uses=1]
+ %25 = getelementptr inbounds %struct.StructType* %20, i32 0, i32 1 ; <i32**> [#uses=1]
+ %26 = load i32** %25, align 1 ; <i32*> [#uses=1]
+ store i32* %26, i32** %24, align 1
+ %27 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 1 ; <i32**> [#uses=1]
+ %28 = load i32** %27, align 8 ; <i32*> [#uses=1]
+ store i32* %28, i32** %c, align 8
+ store %struct.StructType* %s2, %struct.StructType** %ptr, align 8
+ %29 = load %struct.StructType** %ptr, align 8 ; <%struct.StructType*> [#uses=1]
+ %30 = getelementptr inbounds %struct.StructType* %29, i64 1 ; <%struct.StructType*> [#uses=1]
+ store %struct.StructType* %30, %struct.StructType** %ptr1, align 8
+ br label %return
+
+return: ; preds = %bb2
+ ret void
+}
+
+declare noalias i8* @malloc(i64) nounwind
Added: poolalloc/trunk/test/dsa/local/ptr.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/ptr.c?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/ptr.c (added)
+++ poolalloc/trunk/test/dsa/local/ptr.c Tue Aug 17 16:53:59 2010
@@ -0,0 +1,14 @@
+
+//--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>
+
+void func() {
+ int a = 10;
+ int *b = &a;
+ int **c = &b;
+ int *d = *c;
+ int e = *d;
+}
+
Added: poolalloc/trunk/test/dsa/local/ptr.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/ptr.ll?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/ptr.ll (added)
+++ poolalloc/trunk/test/dsa/local/ptr.ll Tue Aug 17 16:53:59 2010
@@ -0,0 +1,31 @@
+
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:b:0,func:a,func:d:0
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:c:0,func:b
+
+
+; ModuleID = 'ptr.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 void @func() nounwind {
+entry:
+ %a = alloca i32 ; <i32*> [#uses=2]
+ %b = alloca i32* ; <i32**> [#uses=2]
+ %c = alloca i32** ; <i32***> [#uses=2]
+ %d = alloca i32* ; <i32**> [#uses=2]
+ %e = alloca i32 ; <i32*> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 10, i32* %a, align 4
+ store i32* %a, i32** %b, align 8
+ store i32** %b, i32*** %c, align 8
+ %0 = load i32*** %c, align 8 ; <i32**> [#uses=1]
+ %1 = load i32** %0, align 8 ; <i32*> [#uses=1]
+ store i32* %1, i32** %d, align 8
+ %2 = load i32** %d, align 8 ; <i32*> [#uses=1]
+ %3 = load i32* %2, align 4 ; <i32> [#uses=1]
+ store i32 %3, i32* %e, align 4
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
Added: poolalloc/trunk/test/dsa/local/ptr1.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/ptr1.c?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/ptr1.c (added)
+++ poolalloc/trunk/test/dsa/local/ptr1.c Tue Aug 17 16:53:59 2010
@@ -0,0 +1,21 @@
+
+//--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>
+
+void func() {
+ int a = 10;
+ int a1 = 20;
+ int *b = &a;
+ int *b1 = &a1;
+ int **c;
+ if( a > a1) {
+ c = &b1;
+ } else {
+ c = &b;
+ }
+ int *d = *c;
+ int e = *d;
+}
+
Added: poolalloc/trunk/test/dsa/local/ptr1.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/ptr1.ll?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/ptr1.ll (added)
+++ poolalloc/trunk/test/dsa/local/ptr1.ll Tue Aug 17 16:53:59 2010
@@ -0,0 +1,48 @@
+
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:a,func:a1
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:a,func:b:0,func:b1:0,func:d:0
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:b,func:b1,func:c:0
+
+; ModuleID = 'ptr1.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 void @func() nounwind {
+entry:
+ %a = alloca i32 ; <i32*> [#uses=3]
+ %a1 = alloca i32 ; <i32*> [#uses=3]
+ %b = alloca i32* ; <i32**> [#uses=2]
+ %b1 = alloca i32* ; <i32**> [#uses=2]
+ %c = alloca i32** ; <i32***> [#uses=3]
+ %d = alloca i32* ; <i32**> [#uses=2]
+ %e = alloca i32 ; <i32*> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 10, i32* %a, align 4
+ store i32 20, i32* %a1, align 4
+ store i32* %a, i32** %b, align 8
+ store i32* %a1, i32** %b1, align 8
+ %0 = load i32* %a, align 4 ; <i32> [#uses=1]
+ %1 = load i32* %a1, align 4 ; <i32> [#uses=1]
+ %2 = icmp sgt i32 %0, %1 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %bb1
+
+bb: ; preds = %entry
+ store i32** %b1, i32*** %c, align 8
+ br label %bb2
+
+bb1: ; preds = %entry
+ store i32** %b, i32*** %c, align 8
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %3 = load i32*** %c, align 8 ; <i32**> [#uses=1]
+ %4 = load i32** %3, align 8 ; <i32*> [#uses=1]
+ store i32* %4, i32** %d, align 8
+ %5 = load i32** %d, align 8 ; <i32*> [#uses=1]
+ %6 = load i32* %5, align 4 ; <i32> [#uses=1]
+ store i32 %6, i32* %e, align 4
+ br label %return
+
+return: ; preds = %bb2
+ ret void
+}
Added: poolalloc/trunk/test/dsa/local/ptr2.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/ptr2.c?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/ptr2.c (added)
+++ poolalloc/trunk/test/dsa/local/ptr2.c Tue Aug 17 16:53:59 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>
+
+void func() {
+ int a = 10;
+ int a1 = 20;
+ int *b = &a;
+ int *b1 = &a1;
+ int **c;
+ if( a > a1) {
+ c = &b1;
+ } else {
+ c = &b;
+ }
+ int *d = *c;
+ int e = *d;
+ int * f = d ;
+ int ** g = c;
+}
+
Added: poolalloc/trunk/test/dsa/local/ptr2.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/ptr2.ll?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/ptr2.ll (added)
+++ poolalloc/trunk/test/dsa/local/ptr2.ll Tue Aug 17 16:53:59 2010
@@ -0,0 +1,56 @@
+
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:a,func:a1,func:d:0,func:f:0
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:a,func:b:0,func:b1:0
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:b,func:b1
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:c:0,func:b,func:b1,func:g:0
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:c:0,func:b,func:b1,func:g:0
+
+; ModuleID = 'ptr2.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 void @func() nounwind {
+entry:
+ %a = alloca i32 ; <i32*> [#uses=3]
+ %a1 = alloca i32 ; <i32*> [#uses=3]
+ %b = alloca i32* ; <i32**> [#uses=2]
+ %b1 = alloca i32* ; <i32**> [#uses=2]
+ %c = alloca i32** ; <i32***> [#uses=4]
+ %d = alloca i32* ; <i32**> [#uses=3]
+ %e = alloca i32 ; <i32*> [#uses=1]
+ %f = alloca i32* ; <i32**> [#uses=1]
+ %g = alloca i32** ; <i32***> [#uses=1]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i32 10, i32* %a, align 4
+ store i32 20, i32* %a1, align 4
+ store i32* %a, i32** %b, align 8
+ store i32* %a1, i32** %b1, align 8
+ %0 = load i32* %a, align 4 ; <i32> [#uses=1]
+ %1 = load i32* %a1, align 4 ; <i32> [#uses=1]
+ %2 = icmp sgt i32 %0, %1 ; <i1> [#uses=1]
+ br i1 %2, label %bb, label %bb1
+
+bb: ; preds = %entry
+ store i32** %b1, i32*** %c, align 8
+ br label %bb2
+
+bb1: ; preds = %entry
+ store i32** %b, i32*** %c, align 8
+ br label %bb2
+
+bb2: ; preds = %bb1, %bb
+ %3 = load i32*** %c, align 8 ; <i32**> [#uses=1]
+ %4 = load i32** %3, align 8 ; <i32*> [#uses=1]
+ store i32* %4, i32** %d, align 8
+ %5 = load i32** %d, align 8 ; <i32*> [#uses=1]
+ %6 = load i32* %5, align 4 ; <i32> [#uses=1]
+ store i32 %6, i32* %e, align 4
+ %7 = load i32** %d, align 8 ; <i32*> [#uses=1]
+ store i32* %7, i32** %f, align 8
+ %8 = load i32*** %c, align 8 ; <i32**> [#uses=1]
+ store i32** %8, i32*** %g, align 8
+ br label %return
+
+return: ; preds = %bb2
+ ret void
+}
Added: poolalloc/trunk/test/dsa/local/struct.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/struct.c?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/struct.c (added)
+++ poolalloc/trunk/test/dsa/local/struct.c Tue Aug 17 16:53:59 2010
@@ -0,0 +1,25 @@
+
+//--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 StructType {
+
+ int a;
+ int *b;
+};
+
+void func() {
+
+ int *tmp = (int*) malloc(sizeof(int));
+ struct StructType s1;
+ s1.a = 10;
+ s1.b = tmp;
+
+ int *c = &s1.a;
+ struct StructType s2 = s1;
+}
+
Added: poolalloc/trunk/test/dsa/local/struct.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/struct.ll?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/struct.ll (added)
+++ poolalloc/trunk/test/dsa/local/struct.ll Tue Aug 17 16:53:59 2010
@@ -0,0 +1,43 @@
+
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:tmp:0,func:s2:8,func:s1:8
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:c:0,func:s1
+
+
+; ModuleID = 'struct.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.StructType = type { i32, i32* }
+
+define void @func() nounwind {
+entry:
+ %tmp = alloca i32* ; <i32**> [#uses=2]
+ %s1 = alloca %struct.StructType ; <%struct.StructType*> [#uses=5]
+ %c = alloca i32* ; <i32**> [#uses=1]
+ %s2 = alloca %struct.StructType ; <%struct.StructType*> [#uses=2]
+ %"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** %tmp, align 8
+ %2 = getelementptr inbounds %struct.StructType* %s1, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 10, i32* %2, align 8
+ %3 = getelementptr inbounds %struct.StructType* %s1, i32 0, i32 1 ; <i32**> [#uses=1]
+ %4 = load i32** %tmp, align 8 ; <i32*> [#uses=1]
+ store i32* %4, i32** %3, align 8
+ %5 = getelementptr inbounds %struct.StructType* %s1, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32* %5, i32** %c, align 8
+ %6 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 0 ; <i32*> [#uses=1]
+ %7 = getelementptr inbounds %struct.StructType* %s1, i32 0, i32 0 ; <i32*> [#uses=1]
+ %8 = load i32* %7, align 8 ; <i32> [#uses=1]
+ store i32 %8, i32* %6, align 8
+ %9 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 1 ; <i32**> [#uses=1]
+ %10 = getelementptr inbounds %struct.StructType* %s1, i32 0, i32 1 ; <i32**> [#uses=1]
+ %11 = load i32** %10, align 8 ; <i32*> [#uses=1]
+ store i32* %11, i32** %9, align 8
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+declare noalias i8* @malloc(i64) nounwind
Added: poolalloc/trunk/test/dsa/local/struct1.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/struct1.c?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/struct1.c (added)
+++ poolalloc/trunk/test/dsa/local/struct1.c Tue Aug 17 16:53:59 2010
@@ -0,0 +1,25 @@
+
+//--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 StructType {
+
+ int a;
+ int *b;
+};
+
+void func() {
+
+ int *tmp = (int*) malloc(sizeof(int));
+ struct StructType* s1 = (struct StructType*) malloc(sizeof(struct StructType));
+ s1->a = 10;
+ s1->b = tmp;
+
+ int *c = &(s1->a);
+ struct StructType s2 = *s1;
+}
+
Added: poolalloc/trunk/test/dsa/local/struct1.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/struct1.ll?rev=111301&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/local/struct1.ll (added)
+++ poolalloc/trunk/test/dsa/local/struct1.ll Tue Aug 17 16:53:59 2010
@@ -0,0 +1,48 @@
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:tmp:0,func:s2:8,func:s1:0:8,func:c:0:8
+;RUN: dsaopt %s -dsa-local -analyze -check-same-node=func:c:0,func:s1:0
+
+; ModuleID = 'struct1.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.StructType = type { i32, i32* }
+
+define void @func() nounwind {
+entry:
+ %tmp = alloca i32* ; <i32**> [#uses=2]
+ %s1 = alloca %struct.StructType* ; <%struct.StructType**> [#uses=5]
+ %c = alloca i32* ; <i32**> [#uses=1]
+ %s2 = alloca %struct.StructType ; <%struct.StructType*> [#uses=2]
+ %"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** %tmp, align 8
+ %2 = call noalias i8* @malloc(i64 16) nounwind ; <i8*> [#uses=1]
+ %3 = bitcast i8* %2 to %struct.StructType* ; <%struct.StructType*> [#uses=1]
+ store %struct.StructType* %3, %struct.StructType** %s1, align 8
+ %4 = load %struct.StructType** %s1, align 8 ; <%struct.StructType*> [#uses=1]
+ %5 = getelementptr inbounds %struct.StructType* %4, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 10, i32* %5, align 8
+ %6 = load %struct.StructType** %s1, align 8 ; <%struct.StructType*> [#uses=1]
+ %7 = getelementptr inbounds %struct.StructType* %6, i32 0, i32 1 ; <i32**> [#uses=1]
+ %8 = load i32** %tmp, align 8 ; <i32*> [#uses=1]
+ store i32* %8, i32** %7, align 8
+ %9 = load %struct.StructType** %s1, align 8 ; <%struct.StructType*> [#uses=1]
+ %10 = getelementptr inbounds %struct.StructType* %9, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32* %10, i32** %c, align 8
+ %11 = load %struct.StructType** %s1, align 8 ; <%struct.StructType*> [#uses=2]
+ %12 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 0 ; <i32*> [#uses=1]
+ %13 = getelementptr inbounds %struct.StructType* %11, i32 0, i32 0 ; <i32*> [#uses=1]
+ %14 = load i32* %13, align 8 ; <i32> [#uses=1]
+ store i32 %14, i32* %12, align 8
+ %15 = getelementptr inbounds %struct.StructType* %s2, i32 0, i32 1 ; <i32**> [#uses=1]
+ %16 = getelementptr inbounds %struct.StructType* %11, i32 0, i32 1 ; <i32**> [#uses=1]
+ %17 = load i32** %16, align 8 ; <i32*> [#uses=1]
+ store i32* %17, i32** %15, align 8
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+declare noalias i8* @malloc(i64) nounwind
More information about the llvm-commits
mailing list