[llvm-commits] [poolalloc] r118663 - in /poolalloc/trunk/test/dsa/td: checkIncomplete.ll checkIncomplete1.ll

Arushi Aggarwal aggarwa4 at illinois.edu
Tue Nov 9 17:17:59 PST 2010


Author: aggarwa4
Date: Tue Nov  9 19:17:59 2010
New Revision: 118663

URL: http://llvm.org/viewvc/llvm-project?rev=118663&view=rev
Log:
More testcases. Must fix td to handle these.

Added:
    poolalloc/trunk/test/dsa/td/checkIncomplete.ll
    poolalloc/trunk/test/dsa/td/checkIncomplete1.ll

Added: poolalloc/trunk/test/dsa/td/checkIncomplete.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/checkIncomplete.ll?rev=118663&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/checkIncomplete.ll (added)
+++ poolalloc/trunk/test/dsa/td/checkIncomplete.ll Tue Nov  9 19:17:59 2010
@@ -0,0 +1,39 @@
+;RUN: dsaopt %s -dsa-stdlib -analyze -verify-flags "print:buffer+I"
+;RUN: dsaopt %s -dsa-stdlib -analyze -verify-flags "@buf+I"
+
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "print:buffer+I"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "@buf-I"
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "print:buffer-I"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "@buf-I"
+
+; global buf, is passed as argument to print. It should not be marked incomplete after td
+
+; ModuleID = 'checkIncomplete.o'
+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"
+
+ at buf = internal global [30 x i8] zeroinitializer, align 16 ; <[30 x i8]*> [#uses=1]
+
+define internal void @print(i8* %buffer) nounwind {
+entry:
+  %buffer_addr = alloca i8*                       ; <i8**> [#uses=2]
+  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
+  store i8* %buffer, i8** %buffer_addr
+  %0 = load i8** %buffer_addr, align 8            ; <i8*> [#uses=1]
+  %1 = getelementptr inbounds i8* %0, i64 0       ; <i8*> [#uses=1]
+  store i8 97, i8* %1, align 1
+  br label %return
+
+return:                                           ; preds = %entry
+  ret void
+}
+
+define void @main() nounwind {
+entry:
+  call void @print(i8* getelementptr inbounds ([30 x i8]* @buf, i64 0, i64 0)) nounwind
+  br label %return
+
+return:                                           ; preds = %entry
+  ret void
+}

Added: poolalloc/trunk/test/dsa/td/checkIncomplete1.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/td/checkIncomplete1.ll?rev=118663&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/td/checkIncomplete1.ll (added)
+++ poolalloc/trunk/test/dsa/td/checkIncomplete1.ll Tue Nov  9 19:17:59 2010
@@ -0,0 +1,64 @@
+;RUN: dsaopt %s -dsa-stdlib -analyze -verify-flags "testfunc:f+I"
+;RUN: dsaopt %s -dsa-stdlib -analyze -verify-flags "main:F+I"
+
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "testfunc:f+I"
+;RUN: dsaopt %s -dsa-bu -analyze -verify-flags "main:F+I"
+
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "testfunc:f+IE"
+;RUN: dsaopt %s -dsa-td -analyze -verify-flags "main:F+IE"
+
+; ModuleID = 'fptr.o'
+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"
+
+; F is passes as argument to testfunc. But since F is incomplete, f should remain incomplete after td.
+define internal void @A(void (i8*)** %f) nounwind {
+entry:
+  %f_addr = alloca void (i8*)**                   ; <void (i8*)***> [#uses=1]
+  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
+  store void (i8*)** %f, void (i8*)*** %f_addr
+  br label %return
+
+return:                                           ; preds = %entry
+  ret void
+}
+
+define internal void @B(void (i8*)** %f) nounwind {
+entry:
+  %f_addr = alloca void (i8*)**                   ; <void (i8*)***> [#uses=1]
+  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
+  store void (i8*)** %f, void (i8*)*** %f_addr
+  br label %return
+
+return:                                           ; preds = %entry
+  ret void
+}
+
+define internal void @testfunc(void (i8*)** %f) nounwind {
+entry:
+  %f_addr = alloca void (i8*)**                   ; <void (i8*)***> [#uses=2]
+  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
+  store void (i8*)** %f, void (i8*)*** %f_addr
+  store void (i8*)** bitcast (void (void (i8*)**)* @B to void (i8*)**), void (i8*)*** %f_addr, align 8
+  br label %return
+
+return:                                           ; preds = %entry
+  ret void
+}
+
+define i32 @main() nounwind {
+entry:
+  %retval = alloca i32                            ; <i32*> [#uses=1]
+  %F = alloca void (i8*)*                         ; <void (i8*)**> [#uses=4]
+  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
+  store void (i8*)* bitcast (void (void (i8*)**)* @A to void (i8*)*), void (i8*)** %F, align 8
+  %0 = load void (i8*)** %F, align 8              ; <void (i8*)*> [#uses=1]
+  %F1 = bitcast void (i8*)** %F to i8*            ; <i8*> [#uses=1]
+  call void %0(i8* %F1) nounwind
+  call void @testfunc(void (i8*)** %F) nounwind
+  br label %return
+
+return:                                           ; preds = %entry
+  %retval2 = load i32* %retval                    ; <i32> [#uses=1]
+  ret i32 %retval2
+}





More information about the llvm-commits mailing list